[SciPy-dev] sparsetools - new and (hopefully) improved!
wnbell at gmail.com
Sat Jan 6 02:29:12 CST 2007
On 1/5/07, Robert Cimrman <cimrman3 at ntc.zcu.cz> wrote:
> Here by 'conversion' you mean CSR->CSC->CSR and ensure_sorted_indices()
> will be based on that? If yes, and assuming that a temporary copy is
> made (am I right?) what about ensure_sorted_indices() working inplace
> (just (quick,arg)sorting row by row)?
> I would like both
> mtx2 = mtx.ensure_sorted_indices()
> mtx.ensure_sorted_indices( inplace = True ) (returning None?)
I wrote an implementation of ensure_sorted_indices() with an inplace
option and updated umfpack.py accordingly (please double check this).
For csr_matrix I have:
"""Return a copy of this matrix where the column indices are sorted
temp = self.tocsc().tocsr()
self.colind = temp.colind
self.indptr = temp.indptr
self.data = temp.data
Of course this does not actually perform an inplace sort :) However
it is sufficient to make your umfpack.py work as expected.
Give this implementation a try and let me know if it's still too slow.
If it is, then we can think about how to perform a true inplace sort.
I suspect argsorting row by row will be significantly slower than
this method (due to the python overhead).
Nathan Bell wnbell at gmail.com
More information about the Scipy-dev