[SciPy-dev] problem with linalg.cholesky?

Andrew Jaffe a.h.jaffe at gmail.com
Fri Dec 2 17:11:13 EST 2005


Andrew Jaffe wrote:
> Travis Oliphant wrote:
> 
>>Andrew Jaffe wrote:
>>
>>
>>>If there's no problem there, I guess the questions are: does 
>>>_castCopyAndTranspose result in a non-contiguous array on all platforms? 
>>>And does lapack_lite.dpotrf() balk at that, and why?
>>>
>>>
>>
>>No, it doesn't, that's what has me stumped.  It should be returning a 
>>contiguous array (because of the .astype method).
>>
>>So, figuring out why the .astype() method is not returning a contiguous 
>>array is the key to understanding this, I think.
>>
>>If you could determine what the parameters being passed to the .astype() 
>>method are and try to reproduce the problem of not getting a contiguous 
>>parameter on output, that would be very helpful.
>>
>>Sorry for your trouble.
>> 

  OK, on my machine, the astype() method only gives a non-contiguous array
  when the old and new types are different:

  In [33]: a = identity(4, Float64)

  In [34]: print transpose(a).astype(Float64).flags
  {'WRITEABLE': True, 'UPDATEIFCOPY': False, 'NOTSWAPPED': True,
  'CONTIGUOUS': False, 'FORTRAN': True, 'ALIGNED': True, 'OWNDATA': True}

  In [35]: print transpose(a).astype(Float32).flags
  {'WRITEABLE': True, 'UPDATEIFCOPY': False, 'NOTSWAPPED': True,
  'CONTIGUOUS': True, 'FORTRAN': False, 'ALIGNED': True, 'OWNDATA': True}

And so, if I change my original code to start with a float32 matrix, the 
cholesky works fine, since the astype converts it to float64 internally.

A




More information about the SciPy-Dev mailing list