#include <iomanip> #include <iostream> #include "Eigen/Core" int main() { using v = Eigen::Matrix<double, 3, 1>; // rows 3; cols 1 using T = Eigen::Matrix<double, 3, 3>; // rows 3; cols 3 T a { {1.0000877, 0.0001989, 0.0000000}, {-0.0048369, 1.0005524, 0.0000000 }, {0.0000000, 0.0000000, 1.0000000 } }; v b { 0.0, 51254.180, 1.0}; v c { 36242.178, 36242.178, 1.0 }; std::cout << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::right) << std::setprecision(3); v r; //a*b 结果应为 10.194,51282.491 r = a * b; std::cout << r << std::endl; std::cout << std::endl; //a*c 结果应为 36252.566, 36086.896 r = a * c; std::cout << r(0) << std::endl; std::cout << r(1) << std::endl; return 0; }
输出
标签:1.0,Eigen,矩阵,cols,乘以,0.0000000,include,Matrix From: https://www.cnblogs.com/5free/p/16846719.html