Matrix 如何从Eigen解决这个编译时错误?

Matrix 如何从Eigen解决这个编译时错误?,matrix,vector,eigen,eigen3,Matrix,Vector,Eigen,Eigen3,我正在使用特征库,在我的课堂上,我试图实现一个卡尔曼滤波器,所以有很多向量操作矩阵。但是,在实际创建对象时,在进行任何数学操作之前,我会遇到一个编译时错误 在任何初始化之前,程序中止,我得到这个错误 eigen3/Eigen/src/Core/PlainObjectBase.h:285: void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index, Eigen::Index) [with Derived = Eigen::M

我正在使用特征库,在我的课堂上,我试图实现一个卡尔曼滤波器,所以有很多向量操作矩阵。但是,在实际创建对象时,在进行任何数学操作之前,我会遇到一个编译时错误

在任何初始化之前,程序中止,我得到这个错误

eigen3/Eigen/src/Core/PlainObjectBase.h:285: 
void Eigen::PlainObjectBase<Derived>::resize(Eigen::Index, Eigen::Index) 
[with Derived = Eigen::Matrix<double, 4, 4>; Eigen::Index = long int]: Assertion `(!(RowsAtCompileTime!=Dynamic) || (rows==RowsAtCompileTime)) && (!(ColsAtCompileTime!=Dynamic) || (cols==ColsAtCompileTime)) && (!(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic) || (rows<=MaxRowsAtCompileTime)) && (!(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic) || (cols<=MaxColsAtCompileTime)) && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array."' failed.
eigen3/Eigen/src/Core/PlainObjectBase.h:285:
void Eigen::PlainObjectBase::resize(Eigen::Index,Eigen::Index)
[使用派生=特征::矩阵;特征::索引=长int]:断言“(!(rowstatcompiletime!=动态)|(rows==rowstatcompiletime))&&(!(colsatciletime!=动态)|(cols==colsatciletime))&(!(rowstatcompiletime==动态和maxrowstatcompiletime!=动态)|(rows=0&“调整矩阵或数组大小时大小无效”。”失败。
这是一个常见的已知错误吗?或者我现在正试图调试它几个小时,但不知怎么的,因为我确信我的矩阵维度(到目前为止)是模糊的


提前感谢

您正在尝试将
Matrix4d
调整为4x4以外的大小。如果您在编译时不知道矩阵的大小,请使用
MatrixXd
。另外,最好提供一个。我已经找到了它!感谢您的帮助!