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

UMFPACK not working in Eigen?

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

UMFPACK not working in Eigen?

Wed Aug 05, 2015 3:23 pm
Hi, everyone, I have a problem when using UMFPACK in Eigen (with visual studio)
Code: Select all
 Eigen::UmfPackLU<SpMat> solver;
Eigen::SparseMatrix<double> I(num_U,num_U);
I.setIdentity();
A11.makeCompressed();
solver.compute(A11);
A11_inver=solver.solve(I); //A11 is a SPD matrix ,compressed,column-major


It can complie, but get error in the last line of
Code: Select all
   template<typename InputMatrixType>
    void compute(const InputMatrixType& matrix)
    {
      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar());
      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar());
      grab(matrix.derived());
      analyzePattern_impl();
      factorize_impl();
    }

in UmfPackSupport.h


If I common the code "factorize_impl() " which becomes
Code: Select all
   template<typename InputMatrixType>
    void compute(const InputMatrixType& matrix)
    {
      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar());
      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar());
      grab(matrix.derived());
      analyzePattern_impl();
        }

no errors , but the solution are all zeros. Maybe there are something wrong with the memory.
Please help me, thanks a lot!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: UMFPACK not working in Eigen?

Wed Aug 05, 2015 5:17 pm
Works for me on Linux and OSX. Can you be more specific about the error you get in factorize_impl?
cglwdm
Registered Member
Posts
18
Karma
0

Re: UMFPACK not working in Eigen?

Thu Aug 06, 2015 1:24 am
ggael wrote:Works for me on Linux and OSX. Can you be more specific about the error you get in factorize_impl?



More details, very strange, this code works
Code: Select all
Eigen::UmfPackLU<SpMat> solver
A11.setZero();
for(int i=0;i<A11.cols();i++)
    A11.coeffRef(i,i)=1;
A11.makeCompressed();
solver.compute(A11);
A11_inver=solver.solve(I);

But I replace "A11.setZero();" such as
Code: Select all
Eigen::UmfPackLU<SpMat> solver
for(int i=0;i<A11.cols();i++)
{
   for(int j=0;j<A11.rows();j++)
      A11.coeffRef(i,j)=0;
   A11.coeffRef(i,i)=1;
}
for(int i=0;i<A11.cols();i++)
    A11.coeffRef(i,i)=1;
A11.makeCompressed();
solver.compute(A11);
A11_inver=solver.solve(I);

It can also compile, but get stuck at (in debug)

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);
}


It said

When the location "0x0000000000000024" is written to access the conflict


So I really have no idea what happens.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
ah, that's probably an issue of umfpack. explicit zeros are pretty bad for sparse solvers.
cglwdm
Registered Member
Posts
18
Karma
0

Re: UMFPACK not working in Eigen?

Thu Aug 06, 2015 2:33 pm
ggael wrote:ah, that's probably an issue of umfpack. explicit zeros are pretty bad for sparse solvers.



Yes, it should be my mistakes in compile UMFPACK.

I have found an old compiled version of UMFPACK, every thing works well. It must be that I made some mistakes in building UMFPACK.

Again, thank you for your help!


Bookmarks



Who is online

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