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

How to use SimplicialLDLT solver?

Tags: None
(comma "," separated)
flyfan
Registered Member
Posts
15
Karma
0

How to use SimplicialLDLT solver?

Fri Apr 14, 2017 6:04 am
Recently, I tried to use Eigen 3.3.3 to calculate acoustic finite element problem, but I have a problem to use SimplicialLDLT solver to solve sparse matrix.
For the equation Ax=v, A is the sparse matrix, v is the sparse vector.
1. The code of LU solver is:
Code: Select all
 Eigen::SparseLU<Eigen::SparseMatrix<std::complex<double>>> solverLU;
                  solverLU.compute(matA);
                  vecX = solverLU.solve(vecY);

The value of LU solver info is zero, the results of LU agree well with results of SkyLine solver coded by Fortran.

2. The code of SimplicialLDLT solver is:
Code: Select all
 Eigen::SimplicialLDLT<Eigen::SparseMatrix<std::complex<double>>> solverLDLT;
                  solverLDLT.compute(matA);
                  vecX = solverLDLT.solve(vecY);

LDLT solver info is zero, but the results of the LDLT solver is inconsistent with expectations.

3. Then I try to use LDLT with upper triangular matrix, and the code is:
Code: Select all
 Eigen::SimplicialLDLT<Eigen::SparseMatrix<std::complex<double>>, Eigen::Upper > solverLDLT;
                  solverLDLT.compute(matA);
                  vecX = solverLDLT.solve(vecY);

LDLT solver info is zero and the results of method 2 and 3 are the same.

Ps: Sparse Matrix A is symmetrical can be identified.
By the way, how to inquire the number of nonezero elements in a sparse matrix? how to install suitesparse with Qt in windows?
Thanks
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Your code looks fine, but LDLT or LLT assumes that your matrix is self-adjoint (aka hermitian), that is not the same as symmetric for complexes:

symmetric: A == A.transpose()
selfadjoint: A == A.transpose().conjugate() == A.adjoint()


For the number of non zeros: A.nonZeros()
flyfan
Registered Member
Posts
15
Karma
0
ggael wrote:Your code looks fine, but LDLT or LLT assumes that your matrix is self-adjoint (aka hermitian), that is not the same as symmetric for complexes:

symmetric: A == A.transpose()
selfadjoint: A == A.transpose().conjugate() == A.adjoint()


For the number of non zeros: A.nonZeros()


Get it, thanks
flyfan
Registered Member
Posts
15
Karma
0

Re: How to use SimplicialLDLT solver?

Fri Apr 14, 2017 10:03 am
ggael wrote:Your code looks fine, but LDLT or LLT assumes that your matrix is self-adjoint (aka hermitian), that is not the same as symmetric for complexes:

symmetric: A == A.transpose()
selfadjoint: A == A.transpose().conjugate() == A.adjoint()


For the number of non zeros: A.nonZeros()


Is there a way to copy the upper triangular part of a sparse martix to the lower part by calling function?


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]