This forum has been archived. All content is frozen. Please use KDE Discuss instead.

GeneralizedSelfAdjointEigenSolver on SparseMatrix

Tags: None
(comma "," separated)
arturponiedzialek
Registered Member
Posts
1
Karma
0
Hi,

I'm would like to work on big matrixes.
I would like to use GeneralizedSelfAdjointEigenSolver on SparseMatrix, is it possible ?

Below code does not work:

Code: Select all
#include "stdafx.h"
#include <Eigen/Dense>
#include <Eigen/Cholesky>
#include <Eigen/Eigenvalues>
#include <Eigen/Sparse>

#define BUFSIZE 256

using Eigen::MatrixXd;
using Eigen::MatrixXcf;
using Eigen::MatrixXf;
using Eigen::LLT;
using Eigen::GeneralizedSelfAdjointEigenSolver;

typedef Eigen::SparseMatrix<double> SpMat;

int _tmain(int argc, _TCHAR* argv[])
{

SpMat MM(4,4);
SpMat KK(4,4);

std::vector<Eigen::Triplet<double>> tripletList;
tripletList.reserve(4);

tripletList.push_back(Eigen::Triplet<double>(0,0,1));
tripletList.push_back(Eigen::Triplet<double>(1,1,1));
tripletList.push_back(Eigen::Triplet<double>(2,2,1));
tripletList.push_back(Eigen::Triplet<double>(3,3,1));

MM.setFromTriplets(tripletList.begin(), tripletList.end());
KK.setFromTriplets(tripletList.begin(), tripletList.end());

GeneralizedSelfAdjointEigenSolver<SpMat> ess;
ess.compute(KK,MM);
}


During building the project in Visual Studio 2010 (VC++ 9.0) I have such an error:

Code: Select all
1>c:\project\matrixsolution\matrixsolution\eigentest\eigen\eigen\src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h(206): error C2784: 'void Eigen::TriangularView<_MatrixType,_Mode>::solveInPlace(const Eigen::MatrixBase<OtherDerived> &) const' : could not deduce template argument for 'const Eigen::MatrixBase<OtherDerived> &' from 'Eigen::SparseMatrix<_Scalar>'


and compiler stops in the line:

Code: Select all
cholB.matrixU().solveInPlace(Base::m_eivec);


in file 'GeneralizedSelfAdjointEigenSolver.h'.

Have you got any idea why I cannot compile the code ?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
That's not possible. eigenvalue algorithms for dense and large sparse matrices are completely different. I guess that you are interested in the few largest or smallest ones? Then see https://github.com/yixuan/spectra which is 100% based on Eigen.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]