signm#
- scipy.linalg.signm(A)[source]#
Matrix sign function.
Extension of the scalar sign(x) to matrices.
The documentation is written assuming array arguments are of specified “core” shapes. However, array argument(s) of this function may have additional “batch” dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see Batched Linear Operations for details. The NEP 5 signature of this function is (i,i)->(i,i).
- Parameters:
- A(N, N) array_like
Matrix at which to evaluate the sign function
- Returns:
- signm(N, N) ndarray
Value of the sign function at A
Notes
Array API Standard Support
signmhas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
⛔
PyTorch
✅
⛔
JAX
⚠️ no JIT
⛔
Dask
⚠️ computes graph
n/a
See Array API coverage for more information.
Examples
>>> from scipy.linalg import signm, eigvals >>> a = [[1,2,3], [1,2,1], [1,1,1]] >>> eigvals(a) array([ 4.12488542+0.j, -0.76155718+0.j, 0.63667176+0.j]) >>> eigvals(signm(a)) array([-1.+0.j, 1.+0.j, 1.+0.j])