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

UMFPACK not working??

Tags: None
(comma "," separated)
cglwdm
Registered Member
Posts
18
Karma
0

UMFPACK not working??

Wed May 27, 2015 4:46 pm
Dear experts
My code is not working: it is

Code: Select all
Eigen::SparseMatrix<double,Eigen::ColMajor> AA(num_A,num_A);
Eigen::UmfPackLU<SpMat> solver;
AA=A;
AA.makeCompressed();
solver.compute(AA);
unknow = solver.solve(F);



It can complie, but it get error in "UmfPackSuppr.h" at

Code: Select all
inline int umfpack_numeric( const int Ap[], const int Ai[], const double Ax[],
                            void *Symbolic, void **Numeric,
                            const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO])
{
  return umfpack_di_numeric(Ap,Ai,Ax,Symbolic,Numeric,Control,Info);
}


and a simple test shows that the UMFPACK itself can work
Code: Select all
int n = 5 ; 
int Ap [ ] = {0, 2, 5, 9, 10, 12} ; 
int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ; 
double Ax [ ] = {2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0} ; 
double b [ ] = {8.0, 45.0, -3.0, 3.0, 19.0} ; 
double x [5] ; 
int suanli() 

    double *null = (double *) NULL ; 
    int i ; 
    void *Symbolic, *Numeric ; 
    (void) umfpack_di_symbolic (n, n, Ap, Ai, Ax, &Symbolic, null, null) ; 
    (void) umfpack_di_numeric (Ap, Ai, Ax, Symbolic, &Numeric, null, null) ; 
    umfpack_di_free_symbolic (&Symbolic) ; 
    (void) umfpack_di_solve (UMFPACK_A, Ap, Ai, Ax, x, b, Numeric, null, null) ; 
    umfpack_di_free_numeric (&Numeric) ; 
    return (0) ; 



And the SuperLU works, which shows there is no error with the matrix AA

Code: Select all
Eigen::SparseMatrix<double,Eigen::ColMajor> AA(num_A,num_A);
Eigen::SuperLU<SpMat> solver;
AA=A;
AA.makeCompressed();
solver.compute(AA);
unknow = solver.solve(F);





What is the matter? Many thnaks!!!

Last edited by cglwdm on Thu Jun 04, 2015 1:18 am, edited 2 times in total.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: UMFPACK not working??

Wed Jun 03, 2015 9:11 am
Hm, I've no clue as it is working for me. What are your Eigen and Umfpack versions? Also, is the following working for you:
Code: Select all
int n = 5 ;
int Ap [ ] = {0, 2, 5, 9, 10, 12} ;
int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ;
double Ax [ ] = {2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0} ;
SpMat AA;
AA = MappedSparseMatrix<double>(5,5,12,Ap,Ai,Ax);
VectorXd b(5);
b << 8.0, 45.0, -3.0, 3.0, 19.0};
Eigen::UmfPackLU<SpMat> solver(A);
x = solver.solve(b);
cglwdm
Registered Member
Posts
18
Karma
0

Re: UMFPACK not working??

Thu Jun 04, 2015 1:13 am
ggael wrote:Hm, I've no clue as it is working for me. What are your Eigen and Umfpack versions? Also, is the following working for you:
Code: Select all
int n = 5 ;
int Ap [ ] = {0, 2, 5, 9, 10, 12} ;
int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ;
double Ax [ ] = {2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0} ;
SpMat AA;
AA = MappedSparseMatrix<double>(5,5,12,Ap,Ai,Ax);
VectorXd b(5);
b << 8.0, 45.0, -3.0, 3.0, 19.0};
Eigen::UmfPackLU<SpMat> solver(A);
x = solver.solve(b);


I'm using

Eigen: Dev branch
SuiteSparse: VERSION 4.4.4


This code works for me
Code: Select all
int n = 5 ;
int Ap [ ] = {0, 2, 5, 9, 10, 12} ;
int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ;
double Ax [ ] = {2.0, 3.0, 3.0, -1.0, 4.0, 4.0, -3.0, 1.0, 2.0, 2.0, 6.0, 1.0} ;
SpMat AA;
AA = Eigen::MappedSparseMatrix<double>(5,5,12,Ap,Ai,Ax);
Eigen::VectorXd b(5);
b << 8.0, 45.0, -3.0, 3.0, 19.0;
Eigen::UmfPackLU<SpMat> solver(AA);
Eigen::VectorXd x = solver.solve(b);

But my problem still exists!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: UMFPACK not working??

Thu Jun 04, 2015 7:04 am
Then the problem comes from your matrix ;) Could you export it so that we can have a look: http://eigen.tuxfamily.org/dox-devel/gr ... tml#title3


Bookmarks



Who is online

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