[Scipy-svn] r6981 - in trunk: doc/release scipy/sparse scipy/sparse/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Nov 29 09:57:55 EST 2010
Author: rgommers
Date: 2010-11-29 08:57:55 -0600 (Mon, 29 Nov 2010)
New Revision: 6981
Modified:
trunk/doc/release/0.9.0-notes.rst
trunk/scipy/sparse/compressed.py
trunk/scipy/sparse/construct.py
trunk/scipy/sparse/tests/test_construct.py
Log:
DEP: remove deprecated functions and keywords from sparse module.
Modified: trunk/doc/release/0.9.0-notes.rst
===================================================================
--- trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:57:24 UTC (rev 6980)
+++ trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:57:55 UTC (rev 6981)
@@ -138,9 +138,6 @@
The deprecated modules ``helpmod``, ``pexec`` and ``ppimport`` were removed
from ``scipy.misc``.
-The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has
-been deprecated since version 0.7, was removed.
-
The ``output_type`` keyword in many ``scipy.ndimage`` interpolation functions
has been removed.
@@ -156,3 +153,18 @@
`std`, `var`, `mean`, `median`, `cov`, `corrcoef`, `z`, `zs`, `stderr`,
`samplestd`, `samplevar`, `pdfapprox`, `pdf_moments` and `erfc`. These changes
are mirrored in ``scipy.stats.mstats``.
+
+
+``scipy.sparse``
+----------------
+
+The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has
+been deprecated since version 0.7, was removed.
+
+The functions ``spkron``, ``speye``, ``spidentity``, ``lil_eye`` and
+``lil_diags`` were removed from ``scipy.sparse``. The first three functions
+are still available as ``scipy.sparse.kron``, ``scipy.sparse.eye`` and
+``scipy.sparse.identity``.
+
+The `dims` and `nzmax` keywords were removed from the sparse matrix
+constructor.
Modified: trunk/scipy/sparse/compressed.py
===================================================================
--- trunk/scipy/sparse/compressed.py 2010-11-29 14:57:24 UTC (rev 6980)
+++ trunk/scipy/sparse/compressed.py 2010-11-29 14:57:55 UTC (rev 6981)
@@ -17,17 +17,10 @@
class _cs_matrix(_data_matrix):
"""base matrix class for compressed row and column oriented matrices"""
- def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None, nzmax=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 nzmax is not None:
- warn("nzmax= is deprecated", DeprecationWarning)
-
-
if isspmatrix(arg1):
if arg1.format == self.format and copy:
arg1 = arg1.copy()
@@ -483,12 +476,12 @@
indxs = np.where(minor_index == self.indices[start:end])[0]
num_matches = len(indxs)
-
-
+
+
if not np.isscalar(val):
raise ValueError('setting an array element with a sequence')
- val = self.dtype.type(val)
+ val = self.dtype.type(val)
if num_matches == 0:
#entry not already present
Modified: trunk/scipy/sparse/construct.py
===================================================================
--- trunk/scipy/sparse/construct.py 2010-11-29 14:57:24 UTC (rev 6980)
+++ trunk/scipy/sparse/construct.py 2010-11-29 14:57:55 UTC (rev 6981)
@@ -449,86 +449,3 @@
vals = np.random.rand(k).astype(dtype)
return coo_matrix((vals, (i, j)), shape=(m, n)).asformat(format)
-#################################
-# Deprecated functions
-################################
-
-__all__ += [ 'speye','spidentity', 'spkron', 'lil_eye', 'lil_diags' ]
-
-spkron = np.deprecate(kron, old_name='spkron', new_name='scipy.sparse.kron')
-speye = np.deprecate(eye, old_name='speye', new_name='scipy.sparse.eye')
-spidentity = np.deprecate(identity, old_name='spidentity',
- new_name='scipy.sparse.identity')
-
-
-def lil_eye((r,c), k=0, dtype='d'):
- """Generate a lil_matrix of dimensions (r,c) with the k-th
- diagonal set to 1.
-
- Parameters
- ----------
-
- r,c : int
- row and column-dimensions of the output.
- k : int
- - diagonal offset. In the output matrix,
- - out[m,m+k] == 1 for all m.
- dtype : dtype
- data-type of the output array.
-
- """
- warn("lil_eye is deprecated." \
- "use scipy.sparse.eye(r, c, k, format='lil') instead", \
- DeprecationWarning)
- return eye(r, c, k, dtype=dtype, format='lil')
-
-
-#TODO remove this function
-def lil_diags(diags, offsets, (m,n), dtype='d'):
- """
- Generate a lil_matrix with the given diagonals.
-
- Parameters
- ----------
- diags : list of list of values e.g. [[1,2,3],[4,5]]
- values to be placed on each indicated diagonal.
- offsets : list of ints
- diagonal offsets. This indicates the diagonal on which
- the given values should be placed.
- (r,c) : tuple of ints
- row and column dimensions of the output.
- dtype : dtype
- output data-type.
-
- Examples
- --------
-
- >>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense()
- matrix([[ 1., 4., 6.],
- [ 0., 2., 5.],
- [ 0., 0., 3.]])
-
- """
- offsets_unsorted = list(offsets)
- diags_unsorted = list(diags)
- if len(diags) != len(offsets):
- raise ValueError("Number of diagonals provided should "
- "agree with offsets.")
-
- sort_indices = np.argsort(offsets_unsorted)
- diags = [diags_unsorted[k] for k in sort_indices]
- offsets = [offsets_unsorted[k] for k in sort_indices]
-
- for i,k in enumerate(offsets):
- if len(diags[i]) < m-abs(k):
- raise ValueError("Not enough values specified to fill "
- "diagonal %s." % k)
-
- out = lil_matrix((m,n),dtype=dtype)
-
- from itertools import izip
- for k,diag in izip(offsets,diags):
- for ix,c in enumerate(xrange(np.clip(k,0,n),np.clip(m+k,0,n))):
- out.rows[c-k].append(c)
- out.data[c-k].append(diag[ix])
- return out
Modified: trunk/scipy/sparse/tests/test_construct.py
===================================================================
--- trunk/scipy/sparse/tests/test_construct.py 2010-11-29 14:57:24 UTC (rev 6980)
+++ trunk/scipy/sparse/tests/test_construct.py 2010-11-29 14:57:55 UTC (rev 6981)
@@ -175,37 +175,6 @@
#TODO test failure cases
- def test_lil_diags(self):
- assert_array_equal(construct.lil_diags([[1,2,3],[4,5],[6]],
- [0,1,2],(3,3)).todense(),
- [[1,4,6],
- [0,2,5],
- [0,0,3]])
-
- assert_array_equal(construct.lil_diags([[6],[4,5],[1,2,3]],
- [2,1,0],(3,3)).todense(),
- [[1,4,6],
- [0,2,5],
- [0,0,3]])
-
- assert_array_equal(construct.lil_diags([[6,7,8],[4,5],[1,2,3]],
- [2,1,0],(3,3)).todense(),
- [[1,4,6],
- [0,2,5],
- [0,0,3]])
-
- assert_array_equal(construct.lil_diags([[1,2,3],[4,5],[6]],
- [0,-1,-2],(3,3)).todense(),
- [[1,0,0],
- [4,2,0],
- [6,5,3]])
-
- assert_array_equal(construct.lil_diags([[6,7,8],[4,5]],
- [-2,-1],(3,3)).todense(),
- [[0,0,0],
- [4,0,0],
- [6,5,0]])
-
def test_rand(self):
# Simple sanity checks for sparse.rand
for t in [np.float32, np.float64, np.longdouble]:
@@ -224,5 +193,6 @@
assert_raises(ValueError, lambda: sprand(5, 10, 1.1))
assert_raises(ValueError, lambda: sprand(5, 10, -0.1))
+
if __name__ == "__main__":
run_module_suite()
More information about the Scipy-svn
mailing list