Registered Member
|
I'm starting to love Eigen, and quite new to this, but suppose I find eigenvectors of a matrix type MatrixXd
using SelfAdjointEigenSolver<MatrixXd> eigensolver ..... and I get eigenvectors via eigensolver.eigenvectors(); then how can I turn that into standard c++ matrix form? i.e. how can I push back each eigenvector into vector<double> ? |
Moderator
|
You can map both data structures as a linear 1D array:
vector<double> vec(n*n); VectorXd::Map(vec.data(), n*n) = VectorXd::Map(eigensolver.eigenvectors().data(), n*n); or use memcpy... |
Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]