Boost logo

Ublas :

Subject: Re: [ublas] Extending Numeric Bindings: UMFPACK
From: Bruno Abreu Calfa (bacalfa_at_[hidden])
Date: 2011-11-09 13:36:29


Hello,

I still don't understand why working through bindings doesn't give me the
right result. I compared what I did before with what is in one of the demo
files from UMFPACK and only the latter works (in the attachment, the matrix
Lx, obtained through my extension in bindings, is all zeros while the
matrix Lxx, obtained by directly calling UMFPACK's function, is correct).
Any ideas why?

I'm using the following:

OS: Ubuntu 11.10 64-bit
Compiler: g++-4.6.1
Boost version: just updated from http://svn.boost.org/svn/boost/trunk
Bindings version: just updated from
http://svn.boost.org/svn/boost/sandbox/numeric_bindings/ (with the
enhancements described the previous e-mail)

Thank you,

Bruno

On Mon, Nov 7, 2011 at 9:38 AM, Bruno Abreu Calfa <bacalfa_at_[hidden]> wrote:

> Hi, Rutger,
>
> Thank you for your prompt response!
>
> I checked out the library in that link and appended the previous methods
> to the respective files. I had to make the following modifications in one
> of them:
>
> // File: umfpack.hpp
>
> template <typename T, typename VecI, typename VecR, typename MatrA>
> inline
> int getNumeric (MatrA& Lx, MatrA& Ux, VecI& P, VecI& Q,
> VecR& Dx, int* do_recip, VecR& Rs,
> numeric_type<T> const& Numeric)
> {
> return detail::getNumeric(bindings::begin_compressed_index_major(Lx),
> bindings::begin_index_minor(Lx),
> bindings::begin_value(Lx),
> bindings::begin_compressed_index_major(Ux),
> bindings::begin_index_minor(Ux),
> bindings::begin_value(Ux),
> bindings::begin_value(P),
> bindings::begin_value(Q),
> bindings::begin_value(Dx),
> do_recip,
> bindings::begin_value(Rs),
> Numeric.ptr
> );
> }
>
>
> But my L matrix is still full of zeros when I run the same test.cpp file I
> attached before. What am I missing?
>
> Regards,
>
>
> Bruno
>
>
>
> On Mon, Nov 7, 2011 at 3:45 AM, Rutger ter Borg <rutger_at_[hidden]>wrote:
>
>> On 2011-11-07 03:33, Bruno Abreu Calfa wrote:
>>
>>> Hello everyone,
>>>
>>> I wanted to call the UMFPACK function "get_di_numeric" and I realized it
>>> is not implemented in the numeric bindings package. So I appended the
>>> following methods to the respective files:
>>>
>>> // File: umfpack.hpp
>>>
>>> template <typename T>
>>> inline
>>> int getLunz (int* lnz, int* unz, int* n_row, int* n_col,
>>> int* nz_udiag, numeric_type<T> const& Numeric)
>>> {
>>> return detail::getLunz(lnz, unz, n_row, n_col, nz_udiag,
>>> Numeric.ptr);
>>> }
>>>
>>> template <typename T, typename VecI, typename VecR, typename MatrA>
>>> inline
>>> int getNumeric (MatrA& Lx, MatrA& Ux, VecI& P, VecI& Q,
>>> VecR& Dx, int* do_recip, VecR& Rs,
>>> numeric_type<T> const& Numeric)
>>> {
>>> return detail::getNumeric(traits::**spmatrix_index1_storage(Lx),
>>> traits::spmatrix_index2_**storage(Lx),
>>> traits::spmatrix_value_**storage(Lx),
>>> traits::spmatrix_index1_**storage(Ux),
>>> traits::spmatrix_index2_**storage(Ux),
>>> traits::spmatrix_value_**storage(Ux),
>>> traits::vector_storage(P),
>>> traits::vector_storage(Q),
>>> traits::vector_storage(Dx),
>>> do_recip,
>>> traits::vector_storage(Rs),
>>> Numeric.ptr
>>> );
>>> }
>>>
>>>
>>> // File: umfpack_overloads.hpp
>>>
>>> inline
>>> int getLunz (int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag,
>>> void *Numeric)
>>> {
>>> return umfpack_di_get_lunz (lnz, unz, n_row, n_col, nz_udiag,
>>> Numeric);
>>> }
>>>
>>> inline
>>> int getNumeric (int* Lp, int* Lj, double* Lx,
>>> int* Up, int* Ui, double* Ux, int* P,
>>> int* Q, double* Dx, int *do_recip,
>>> double* Rs, void *Numeric)
>>> {
>>> return umfpack_di_get_numeric (Lp, Lj, Lx, Up, Ui, Ux,
>>> P, Q, Dx, do_recip, Rs, Numeric);
>>> }
>>>
>>>
>>> Then, I ran the code in the attachment. The L matrix is all zeros, but
>>> if I print the report from UMFPACK it works and obviously shows L and U
>>> not all zeros. I am suspecting that the values are not being copied
>>> correctly to my matrices. Does anyone have any idea why?
>>>
>>> Thank you very much.
>>>
>>>
>>> Bruno
>>>
>>>
>>>
>> Hello Bruno,
>>
>> I see you're using bindings version 1. Have you tried those at
>>
>> http://svn.boost.org/svn/**boost/sandbox/numeric_**bindings/>
>>
>> ?
>>
>> Regards,
>>
>> Rutger
>>
>>
>> ______________________________**_________________
>> ublas mailing list
>> ublas_at_[hidden]
>>
http://lists.boost.org/**mailman/listinfo.cgi/ublas>
>> Sent to: bacalfa_at_[hidden]
>>
>
>