c++ - c++ eigen svd sum to float
问题描述
我正在计算矩阵的 bdcsvd ,然后像这样计算奇异值的总和
std::stringstream ss(mat_str);
int m = 66;
int n = 66;
MatrixXd A(m,n);
for(int i=0; i<m; ++i)
for(int j=0; j<n; ++j)
ss >> A(i,j);
Eigen::BDCSVD<MatrixXd> svd(A,ComputeFullU|ComputeFullV);
auto sum = svd.singularValues().colwise().sum().cast<float>();
cout << "Here is the type of :" << endl << typeid(sum).name() << endl;
sum 的类型显示N5Eigen12CwiseUnaryOpINS_8internal14scalar_cast_opIdfEEKNS_16PartialReduxExprIKNS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEENS1_10member_sumIdEELi0EEEEE
而不是 float 。我如何将总和转换/转换为浮点数?
解决方案
推荐阅读
- web-crawler - Tika Parser 减慢 StormCrawler
- php - WordPress 插件 - 页面 URL 列表的表格输出
- angular - 如何在 Karma for Angular 中使用 Froala 编辑器测试组件?
- slf4j - 多个 SLF4J 绑定,如何找到有问题的依赖项
- xcode - 如何成功地将我的默认合并工具实用程序更改为 opendiff
- javascript - 是否可以将 Java 脚本文件排列到“名称空间”中以避免冲突?
- azure - 当链接模板存储在本地而不是在云端时如何创建ARM链接模板
- sas - SAS---采用滞后功能
- amazon-web-services - Cloudbreak 的优势和局限性
- excel - VBA 更新链接的 Excel 工作簿的文件路径