[SciPy-user] strange ValueError in scipy_core

Travis Oliphant oliphant at ee.byu.edu
Thu Nov 10 17:33:09 CST 2005


Chris Fonnesbeck wrote:

>I am converting some code over to scipy_core which involves populating
>a relatively sparse matrix, so I am generating an array of zeros, and
>substituting the non-zero elements. However, this substitution does
>not seem to be allowed. Here is the relevant section of code.
>  
>
I think I've recreated what you are doing.  Matrix is a Numeric array 
and apparently the other items are scipy core arrays.  The 
multiplication result actually produces an array scalar.  The problem 
was with the __array_struct__ interface for the array scalar. 

Array scalars are only readable so the WRITEABLE flag was getting reset 
thus raising the error in Numeric.  (But, setting the flag was 
unnecessary because the data from the scalar was copied anyway).  

Thanks for bringing this one to light.   It's fixed in SVN scipy core.

-Travis



More information about the SciPy-user mailing list