[Scipy-svn] r3757 - trunk/scipy/sparse
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Dec 31 21:55:24 EST 2007
Author: wnbell
Date: 2007-12-31 20:55:20 -0600 (Mon, 31 Dec 2007)
New Revision: 3757
Modified:
trunk/scipy/sparse/bsr.py
trunk/scipy/sparse/csc.py
trunk/scipy/sparse/csr.py
Log:
set _has_sorted_indices after CSR<->CSC
Modified: trunk/scipy/sparse/bsr.py
===================================================================
--- trunk/scipy/sparse/bsr.py 2008-01-01 02:27:50 UTC (rev 3756)
+++ trunk/scipy/sparse/bsr.py 2008-01-01 02:55:20 UTC (rev 3757)
@@ -438,10 +438,10 @@
def sum_duplicates(self):
raise NotImplementedError
- def sort_indices(self, check_first=True):
+ def sort_indices(self):
"""Sort the indices of this matrix *in place*
"""
- if check_first and self.has_sorted_indices():
+ if self.has_sorted_indices():
return
from csr import csr_matrix
@@ -460,6 +460,8 @@
self.data[:] = self.data[proxy.data]
self.indices[:] = proxy.indices
+ self._has_sorted_indices = True
+
def prune(self):
""" Remove empty space after all non-zero elements.
"""
Modified: trunk/scipy/sparse/csc.py
===================================================================
--- trunk/scipy/sparse/csc.py 2008-01-01 02:27:50 UTC (rev 3756)
+++ trunk/scipy/sparse/csc.py 2008-01-01 02:55:20 UTC (rev 3757)
@@ -127,7 +127,9 @@
indptr, indices, data)
from csr import csr_matrix
- return csr_matrix((data, indices, indptr), self.shape)
+ A = csr_matrix((data, indices, indptr), self.shape)
+ A._has_sorted_indices = True
+ return A
def tobsr(self, blocksize=None):
if blocksize == (1,1):
Modified: trunk/scipy/sparse/csr.py
===================================================================
--- trunk/scipy/sparse/csr.py 2008-01-01 02:27:50 UTC (rev 3756)
+++ trunk/scipy/sparse/csr.py 2008-01-01 02:55:20 UTC (rev 3757)
@@ -143,7 +143,9 @@
indptr, indices, data)
from csc import csc_matrix
- return csc_matrix((data, indices, indptr), self.shape)
+ A = csc_matrix((data, indices, indptr), self.shape)
+ A._has_sorted_indices = True
+ return A
def tobsr(self,blocksize=None,copy=True):
if blocksize == (1,1):
More information about the Scipy-svn
mailing list