[SciPy-User] loadmat/savemat sparse with umfpack problem

Robin robince at gmail.com
Mon Dec 14 11:54:06 EST 2009


On Mon, Dec 14, 2009 at 4:17 PM, Matthew Brett <matthew.brett at gmail.com> wrote:
> Hi,
>
>> Still not sure why though - in this simple example the indices do seem
>> to be sorted - the only change I can find from calling the
>> sorted_indices function is that after the WRITEABLE flag of .indices
>> is True (as it is originally) but on the loadmat'ed array WRITEABLE is
>> False.
>>
>> Could this be causing it? Is it a bug in loadmat - should the flag be
>> set differently? (I'm not sure what it does).
>
> Yes, that's strange.  Do you see the same behavior for loadmat from scipy 0.7.1?

No, Python 2.6 with scipy 0.7.1 (through macports) doesn't seem to
have WRITEABLE False. I don't have umfpack in that installation to
check but I would guess it would work.
In [3]: scipy.__version__
Out[3]: '0.7.1'
In [4]: a.indices.flags
Out[4]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : False
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False
In [6]: a2.indices.flags
Out[6]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : False
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False

The environment where is happens is python 2.5.4, scipy '0.8.0.dev6136'
But it is not limited to sparse, everything seems to be loaded with
writeable false (I'm not sure if this would be causing the problem
with umfpack or if it could cause other problems):

In [61]: a = eye(3)
In [62]: a.flags
Out[62]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : False
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  UPDATEIFCOPY : False
In [63]: savemat('test',{'a':a})
In [64]: a2 = loadmat('test')['a']
In [65]: a2.flags
Out[65]:
  C_CONTIGUOUS : False
  F_CONTIGUOUS : True
  OWNDATA : False
  WRITEABLE : False
  ALIGNED : False
  UPDATEIFCOPY : False

Cheers

Robin



More information about the SciPy-User mailing list