[Scipy-svn] r6996 - in trunk: doc/release scipy/sparse

scipy-svn@scip... scipy-svn@scip...
Sat Dec 4 23:54:14 CST 2010


Author: rgommers
Date: 2010-12-04 23:54:13 -0600 (Sat, 04 Dec 2010)
New Revision: 6996

Modified:
   trunk/doc/release/0.9.0-notes.rst
   trunk/scipy/sparse/base.py
   trunk/scipy/sparse/compressed.py
   trunk/scipy/sparse/coo.py
   trunk/scipy/sparse/csc.py
   trunk/scipy/sparse/csr.py
Log:
DEP: remove deprecated methods and keywords from sparse matrices.

Modified: trunk/doc/release/0.9.0-notes.rst
===================================================================
--- trunk/doc/release/0.9.0-notes.rst	2010-12-04 21:04:44 UTC (rev 6995)
+++ trunk/doc/release/0.9.0-notes.rst	2010-12-05 05:54:13 UTC (rev 6996)
@@ -158,8 +158,9 @@
 ``scipy.sparse``
 ----------------
 
-The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has
-been deprecated since version 0.7, was removed.
+Several methods of the sparse matrix classes in ``scipy.sparse`` which had
+been deprecated since version 0.7 were removed: `save`, `rowcol`, `getdata`,
+`listprint`, `ensure_sorted_indices`, `matvec`, `matmat` and `rmatvec`. 
 
 The functions ``spkron``, ``speye``, ``spidentity``, ``lil_eye`` and
 ``lil_diags`` were removed from ``scipy.sparse``.  The first three functions
@@ -167,7 +168,8 @@
 ``scipy.sparse.identity``.
 
 The `dims` and `nzmax` keywords were removed from the sparse matrix
-constructor.
+constructor. The `colind` and `rowind` attributes were removed from CSR and CSC
+matrices respectively.
 
 ``scipy.sparse.linalg.arpack.speigs``
 -------------------------------------

Modified: trunk/scipy/sparse/base.py
===================================================================
--- trunk/scipy/sparse/base.py	2010-12-04 21:04:44 UTC (rev 6995)
+++ trunk/scipy/sparse/base.py	2010-12-05 05:54:13 UTC (rev 6996)
@@ -135,21 +135,6 @@
             format = 'und'
         return format
 
-    @np.deprecate
-    def rowcol(self, num):
-        return (None, None)
-
-    @np.deprecate
-    def getdata(self, num):
-        return None
-
-    @np.deprecate
-    def listprint(self, start, stop):
-        """Provides a way to print over a single index.
-        """
-        return '\n'.join(['  %s\t%s' % (self.rowcol(ind), self.getdata(ind))
-                         for ind in xrange(start,stop)]) + '\n'
-
     def __repr__(self):
         nnz = self.getnnz()
         format = self.getformat()
@@ -222,6 +207,9 @@
         """
         return self.tocsr().multiply(other)
 
+    def dot(self, other):
+        return self * other
+
     def __abs__(self):
         return abs(self.tocsr())
 
@@ -238,34 +226,6 @@
     def __rsub__(self, other):  # other - self
         return self.tocsr().__rsub__(other)
 
-    # old __mul__ interfaces
-    @np.deprecate
-    def matvec(self,other):
-        return self * other
-
-    @np.deprecate
-    def matmat(self,other):
-        return self * other
-
-    def dot(self, other):
-        return self * other
-
-    @np.deprecate
-    def rmatvec(self, other, conjugate=True):
-        """Multiplies the vector 'other' by the sparse matrix, returning a
-        dense vector as a result.
-
-        If 'conjugate' is True:
-            - returns A.transpose().conj() * other
-        Otherwise:
-            - returns A.transpose() * other.
-
-        """
-        if conjugate:
-            return self.conj().transpose() * other
-        else:
-            return self.transpose() * other
-
     def __mul__(self, other):
         """interpret other and call one of the following
 
@@ -403,10 +363,6 @@
                 return result
         elif isscalarlike(other):
             raise ValueError('exponent must be an integer')
-        elif isspmatrix(other):
-            warn('Using ** for elementwise multiplication is deprecated.'\
-                    'Use .multiply() instead', DeprecationWarning)
-            return self.multiply(other)
         else:
             raise NotImplementedError
 

Modified: trunk/scipy/sparse/compressed.py
===================================================================
--- trunk/scipy/sparse/compressed.py	2010-12-04 21:04:44 UTC (rev 6995)
+++ trunk/scipy/sparse/compressed.py	2010-12-05 05:54:13 UTC (rev 6996)
@@ -298,10 +298,6 @@
         return self.__class__((data,indices,indptr),shape=(M,N))
 
 
-    @np.deprecate
-    def getdata(self, ind):
-        return self.data[ind]
-
     def diagonal(self):
         """Returns the main diagonal of the matrix
         """
@@ -623,19 +619,6 @@
             fn( len(self.indptr) - 1, self.indptr, self.indices, self.data)
             self.has_sorted_indices = True
 
-    #TODO remove after 0.7
-    def ensure_sorted_indices(self, inplace=False):
-        """Return a copy of this matrix where the column indices are sorted
-        """
-        warn('ensure_sorted_indices is deprecated, ' \
-                'use sorted_indices() or sort_indices() instead', \
-                DeprecationWarning)
-
-        if inplace:
-            self.sort_indices()
-        else:
-            return self.sorted_indices()
-
     def prune(self):
         """Remove empty space after all non-zero elements.
         """

Modified: trunk/scipy/sparse/coo.py
===================================================================
--- trunk/scipy/sparse/coo.py	2010-12-04 21:04:44 UTC (rev 6995)
+++ trunk/scipy/sparse/coo.py	2010-12-05 05:54:13 UTC (rev 6996)
@@ -93,13 +93,9 @@
 
     """
 
-    def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None):
+    def __init__(self, arg1, shape=None, dtype=None, copy=False):
         _data_matrix.__init__(self)
 
-        if dims is not None:
-            warn("dims is deprecated, use shape instead", DeprecationWarning)
-            shape=dims
-
         if isinstance(arg1, tuple):
             if isshape(arg1):
                 M, N = arg1
@@ -215,14 +211,6 @@
                 raise ValueError('negative column index found')
 
 
-    @np.deprecate
-    def rowcol(self, num):
-        return (self.row[num], self.col[num])
-
-    @np.deprecate
-    def getdata(self, num):
-        return self.data[num]
-
     def transpose(self, copy=False):
         M,N = self.shape
         return coo_matrix((self.data, (self.col, self.row)), shape=(N,M), copy=copy)

Modified: trunk/scipy/sparse/csc.py
===================================================================
--- trunk/scipy/sparse/csc.py	2010-12-04 21:04:44 UTC (rev 6995)
+++ trunk/scipy/sparse/csc.py	2010-12-05 05:54:13 UTC (rev 6996)
@@ -81,14 +81,6 @@
 
     """
 
-    def __getattr__(self, attr):
-        if attr == 'rowind':
-            warn("rowind attribute no longer in use. Use .indices instead",
-                    DeprecationWarning)
-            return self.indices
-        else:
-            return _cs_matrix.__getattr__(self, attr)
-
     def transpose(self, copy=False):
         from csr import csr_matrix
         M,N = self.shape
@@ -99,13 +91,6 @@
         for r in xrange(self.shape[0]):
             yield csr[r,:]
 
-    @np.deprecate
-    def rowcol(self, ind):
-        #TODO remove after 0.7
-        row = self.indices[ind]
-        col = np.searchsorted(self.indptr, ind+1) - 1
-        return (row, col)
-
     def tocsc(self, copy=False):
         if copy:
             return self.copy()

Modified: trunk/scipy/sparse/csr.py
===================================================================
--- trunk/scipy/sparse/csr.py	2010-12-04 21:04:44 UTC (rev 6995)
+++ trunk/scipy/sparse/csr.py	2010-12-05 05:54:13 UTC (rev 6996)
@@ -81,27 +81,11 @@
 
     """
 
-    def __getattr__(self, attr):
-        if attr == 'colind':
-            warn("colind attribute no longer in use. Use .indices instead",
-                    DeprecationWarning)
-            return self.indices
-        else:
-            return _cs_matrix.__getattr__(self, attr)
-
     def transpose(self, copy=False):
         from csc import csc_matrix
         M,N = self.shape
         return csc_matrix((self.data,self.indices,self.indptr), shape=(N,M), copy=copy)
 
-    @np.deprecate
-    def rowcol(self, ind):
-        #TODO remove after 0.7
-        col = self.indices[ind]
-        row = np.searchsorted(self.indptr, ind+1)-1
-        return (row, col)
-
-
     def tolil(self):
         from lil import lil_matrix
         lil = lil_matrix(self.shape,dtype=self.dtype)
@@ -200,7 +184,7 @@
             slicing of the form self[[1,2,3],:]
             """
             indices = asindices(indices)
-    
+
             (min_indx,max_indx) = check_bounds(indices,N)
 
             if min_indx < 0:



More information about the Scipy-svn mailing list