[SciPy-user] problem using umfpack.lu()

Robert Cimrman cimrman3 at ntc.zcu.cz
Mon Dec 22 09:10:11 EST 2008


Giampaolo Cuoghi wrote:
> Nathan Bell <wnbell <at> gmail.com> writes:
> 
>> On Sat, Dec 20, 2008 at 1:03 PM, Giampaolo Cuoghi <jpaul74 
> <at> gmail.com> wrote:
>>> I'm trying to solve the problem of compute the determinant of a sparse
>>> matrix, as I've written in the previous mail.
>>>
>>> I find that the LU decomposition can be useful for this task but when I
>>> use umfpack.lu(A) for A complex sparse matrix, this error appears:
>>>
>>> "matrix must have float64 values"
>>>
>>> If A is a real matrix no error appears.
>>>
>>> Can someone help me?
>>>
>> Giampaolo, you should convert A to the float64 type first:
>>
>> umfpack.lu(A.astype('float64'))
>>
> 
> Thanks Nathan, but my matrix A is complex so with A.astype('float64') the
> imaginary part disappear and if I use A.astype('complex64') or
> A.astype('complex128') the previous error appears: "matrix must have 
> float64 values". It seems that the lu decomposition doesn't work for 
> complex matrix.

Hi Giampaolo,

Umfpack has several families of routines for single, double precisions 
and real or complex matrices - these can be set upon constuction of the 
umfpack context. Try something like:

_family = {dtype( 'float64' ) : 'di',
            dtype( 'complex128' ) : 'zi'}

family = _family[A.dtype]
umfpack = UmfpackContext( family = family )
umfpack.numeric( self.A )
...

r.



More information about the SciPy-User mailing list