我已经使用Eigen作为矩阵库。如何将矩阵变量分配给NULL。我试图MatrixXd mat = NULL;
但有一个错误:使用Eigen作为Omnetpp中的矩阵库
conversion from 'int' to non-scalar type 'Eigen::MatrixXd {aka Eigen::Matrix}' requested MatrixXd mat = NULL;
如何开始到矩阵分配空值? 谢谢
我已经使用Eigen作为矩阵库。如何将矩阵变量分配给NULL。我试图MatrixXd mat = NULL;
但有一个错误:使用Eigen作为Omnetpp中的矩阵库
conversion from 'int' to non-scalar type 'Eigen::MatrixXd {aka Eigen::Matrix}' requested MatrixXd mat = NULL;
如何开始到矩阵分配空值? 谢谢
矩阵类有像Zero()这样的静态方法,它可以用来将所有系数初始化为零。尝试MatrixXd mat = MatrixXd::Zero(row, col);
。
你可以阅读这个在这里:http://eigen.tuxfamily.org/dox/classEigen_1_1DenseBase.html#a724349af3e253b69a54d503931b52ec3
只有指针可以NULL
:
MatrixXd* mat = NULL;
双关口; 双排; MatrixXd mat = MatrixXd :: Zero(row,col);我尝试了你的建议,但我得到了矩阵中的随机值而不是零。有没有其他方法可以将矩阵初始化为零。我也浏览了该网站,但无法获得任何提示。谢谢 – Zecar