Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用 C++ 线性代数库 eigen 制作一个对角矩阵,但我不知道编译时矩阵的大小。因此,
DiagonalMatrix<Scalar, SizeAtCompileTime> diag1(size);
不管用。沿对角线的值也不同。帮助?
您需要使用与您相关的内容来实例化模板参数:
DiagonalMatrix<double,Eigen::Dynamic> diag1(size);