Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b81fd2

Browse files
committed
Remove mlab.identity
1 parent 00cace4 commit 9b81fd2

3 files changed

Lines changed: 2 additions & 28 deletions

File tree

doc/api/next_api_changes/2018-09-18-DS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ in Matplotlib 2.2 has been removed. See below for a list:
1212
- `mlab.l2norm` (use ``numpy.linalg.norm(a, ord=2)`` instead)
1313
- `mlab.norm_flat` (use ``numpy.linalg.norm(a.flat, ord=2)`` instead)
1414
- `mlab.frange` (use numpy.arange instead)
15+
- `mlab.identity` (use numpy.identity instead)
1516
- `mlab.cohere_pairs` (use scipy.signal.coherence instead)
1617
- `mlab.entropy` (use scipy.stats.entropy instead)
1718
- `mlab.normpdf` (use scipy.stats.norm.pdf instead)

lib/matplotlib/mlab.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,33 +1247,6 @@ def movavg(x, n):
12471247
"""
12481248

12491249

1250-
@cbook.deprecated("2.2", 'numpy.identity')
1251-
def identity(n, rank=2, dtype='l', typecode=None):
1252-
"""
1253-
Returns the identity matrix of shape (*n*, *n*, ..., *n*) (rank *r*).
1254-
1255-
For ranks higher than 2, this object is simply a multi-index Kronecker
1256-
delta::
1257-
1258-
/ 1 if i0=i1=...=iR,
1259-
id[i0,i1,...,iR] = -|
1260-
\\ 0 otherwise.
1261-
1262-
Optionally a *dtype* (or typecode) may be given (it defaults to 'l').
1263-
1264-
Since rank defaults to 2, this function behaves in the default case (when
1265-
only *n* is given) like ``numpy.identity(n)`` -- but surprisingly, it is
1266-
much faster.
1267-
"""
1268-
if typecode is not None:
1269-
dtype = typecode
1270-
iden = np.zeros((n,)*rank, dtype)
1271-
for i in range(n):
1272-
idx = (i,)*rank
1273-
iden[idx] = 1
1274-
return iden
1275-
1276-
12771250
@cbook.deprecated("2.2")
12781251
def base_repr(number, base=2, padding=0):
12791252
"""

lib/matplotlib/pylab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
from matplotlib.mlab import (
232232
base_repr, binary_repr, csv2rec,
233233
demean, detrend, detrend_linear, detrend_mean, detrend_none,
234-
identity, ispower2, isvector,
234+
ispower2, isvector,
235235
log2, movavg,
236236
window_hanning, window_none)
237237

0 commit comments

Comments
 (0)