[SciPy-dev] new sparsetools + umfpack

Robert Cimrman cimrman3 at ntc.zcu.cz
Wed Jan 10 07:20:57 CST 2007


Travis Oliphant wrote:
> Robert Cimrman wrote:
>> New sparsetools implementation does not require CSR/CSC column/row
>> indices to be sorted in ascending order, while UMFPACK does. Currently,
>> every call to umfpack module (e.g. via linsolve.solve) implicitly calls
>> ensure_sorted_indices(inplace=True) method of CSR/CSC matrix, which is
>> rather fast, but in many cases is not necessary and the overhead can
>> become significant when solving lots of linear systems (e.g.
>> FE-discretized evolutionary nonlinear PDEs) - in this case, only one
>> call to ensure_sorted_indices() is necessary, then only values change,
>> not the structure.
>>
>> Therefore, if there are no objections, I would like to remove the
>> implicit call to ensure_sorted_indices() from umfpack and require user
>> to call it explicitly (only if necessary) - an exception will be raised
>> by umfpack if the matrix is not in correct form, so it cannot lead to
>> hidden bugs. I will document this in linsolve, of course.
>>   
> 
> Perhaps it would be useful to put a flag on sparse matrices 
> (sorted_indices) or something like that which is true if the indices are 
> sorted and updated when operations that could change it are encountered.
> 
> We place flags on nd arrays for exactly this purpose (certain algorithms 
> require properties of the arrays which are not always guaranteed but 
> which we don't want to force nor explicitly check all the time).

I have proposed this to Nathan (see previous discussion), but then
agreed that such a flag could become easily invalid by direct user
manipulation of the sparse matrix data - sparse matrices differ in this
aspect from nd arrays, since people often use (and must use) the
internal representation to get speed.

r.


More information about the Scipy-dev mailing list