NumPy 1.13.0 Release Notes
New np.divmod ufunc provides more efficient divmod.
New np.isnat ufunc tests for NaT special values.
New np.heaviside ufunc computes the Heaviside function.
New np.isin function, improves on in1d.
New np.block function for creating blocked arrays.
New PyArray_MapIterArrayCopyIfOverlap added to NumPy C-API.
np.equal,
np.not_equal
Deprecated boolean indexing behavior dropped. See Changes below for details.
Deprecated np.alterdot() and np.restoredot() removed.
x
>
0.
np
.
eye
(
3
)
*
3
np
.
block
([
[
A
,
np
.
zeros
((
2
,
3
))],
[
np
.
ones
((
3
,
2
)),
B
]
])
array([[ 2., 0., 0., 0., 0.],
[ 0., 2., 0., 0., 0.],
[ 1., 1., 3., 0., 0.],
[ 1., 1., 0., 3., 0.],
[ 1., 1., 0., 0., 3.]])
While primarily useful for block matrices, this works for arbitrary dimensions
of arrays.
It is similar to Matlab’s square bracket notation for creating block matrices.
.
array
([[
1
,
2
,
6
],
[
3
,
4
,
5
]],
dtype
=
np
.
float_
)
dx
=
2.
y
=
[
1.
,
1.5
,
3.5
]
np
.
gradient
(
f
,
dx
,
y
)
[array([[ 1. , 1. , -0.5], [ 1. , 1. , -0.5]]),
array([[ 2. , 2. , 2. ], [ 2. , 1.7, 0.5]])]