如何解决Eigen SimplicialLLT 内存违规
我想通过使用特征库获得 cholesky L 矩阵 (LLT)。 我需要它来重新计算一些矩阵。
所以我的问题是,我必须将它分配给一个稀疏矩阵变量。但我不能。
我已经考虑过以下论坛。但它不适合我。 https://forum.kde.org/viewtopic.php?f=74&t=129655
SparseMatrix<float> G_T_G = piece_of_reducedG.transpose() * piece_of_reducedG;
SimplicialLLT<SparseMatrix<float>> svlr;
svlr.compute(G_T_G);
SparseMatrix<float> R = svlr.matrixU();
G_T_G 矩阵是稀疏矩阵和大尺寸。(64845 X 64845)
这段代码违反了内存。
这张照片是发生错误时的照片。 enter image description here(不关心韩语..)
在 SparseMatrix 的 operator= 方法中发生错误。
所以我测试小矩阵。但它正在运行。
#include <Eigen/Core>
#include <iostream>
#include <Eigen/Sparse>
#include <Eigen/SparseCore>
#include <vector>
#include <vector>
#include <Eigen/SparseCholesky>
using namespace Eigen;
using namespace std;
using T = Triplet<float>;
int main() {
vector<T> elem;
elem.push_back(T(0,10));
elem.push_back(T(1,2,10));
elem.push_back(T(2,30));
elem.push_back(T(3,3,20));
SparseMatrix<float> A;
A.resize(4,4);
A.setFromTriplets(elem.begin(),elem.end());
SimplicialLLT<SparseMatrix<float>> slvr;
slvr.compute(A);
auto x = slvr.matrixL();
SparseMatrix<float> T = slvr.matrixU();
cout << T * T.transpose();
}
所以我想知道为什么会发生这种情况。 小矩阵问题的代入没有问题。
SparseMatrix<float> T = slvr.matrixU();
感谢您的阅读。 :)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。