本征矩阵中的元素智能求逆

问题描述 投票:0回答:1

是否存在用于对本征矩阵进行元素求逆的函数

#include <eigen3/Eigen/Dense>

const auto mat = Eigen::MatrixXd::Constant(3, 3, 5);
std::cout << mat;

5 5 5
5 5 5
5 5 5

我的预期结果是:

1/5 1/5 1/5
1/5 1/5 1/5
1/5 1/5 1/5

除了使用for循环以外,还有其他方法吗? (此外,与矩阵运算相比,将本征矩阵上的for循环用于标量运算会更慢)

c++ matrix eigen eigen3
1个回答
0
投票

已解决此问题。只是放在这里以防其他人遇到此问题

mat.cwiseInverse()

Link to all co-efficient wise functions for eigen

© www.soinside.com 2019 - 2024. All rights reserved.