Linalg¶
Collection of linear algebra Ivy functions.

ivy.
inv
(x, f=None)[source]¶ Computes the (multiplicative) inverse of x matrix. Given a square matrix x, returns the matrix x_inv satisfying dot(x, x_inv) = dot(x_inv, x) = eye(x.shape[0]).
 Parameters
x (array) – Matrix to be inverted.
f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.
 Returns
(Multiplicative) inverse of the matrix x.

ivy.
norm
(x, ord=2, axis= 1, keepdims=False, f=None)[source]¶ Matrix or vector norm. This function is able to return ord1 and ord2 vectornorms and matrixnorms.
 Parameters
x (array) – Input array. If axis is None, x must be 1D or 2D.
ord (int) – Order of the norm.
axis ({int, 2sequence of ints}, optional) – If axis is an integer, it specifies the axis of x along which to compute the vector norms. If axis is a 2tuple, it specifies the axes that hold 2D matrices, and the matrix norms of these matrices are computed.
keepdims (bool, optional) – If this is set to True, the axes which are normed over are left in the result as dimensions with size one. With this option the result will broadcast correctly against the original x. Default is False.
f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.
 Returns
Norm of the matrix or vector(s).

ivy.
pinv
(x, f=None)[source]¶ Computes the pseudo inverse of x matrix.
 Parameters
x (array) – Matrix to be pseudo inverted.
f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.
 Returns
pseudo inverse of the matrix x.

ivy.
svd
(x, f=None)[source]¶ Singular Value Decomposition. When x is a 2D array, it is factorized as u @ numpy.diag(s) @ vh = (u * s) @ vh, where u and vh are 2D unitary arrays and s is a 1D array of a’s singular values. When x is higherdimensional, SVD is applied in batched mode.
 Parameters
x (array) – Input array with number of dimensions >= 2.
f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.
 Returns
u > { (…, M, M), (…, M, K) } array
Unitary array(s). The first (number of dims  2) dimensions have the same size as those of the input a. The size of the last two dimensions depends on the value of full_matrices.
s > (…, K) array
Vector(s) with the singular values, within each vector sorted in descending ord. The first (number of dims  2) dimensions have the same size as those of the input a.
vh > { (…, N, N), (…, K, N) } array
Unitary array(s). The first (number of dims  2) dimensions have the same size as those of the input a. The size of the last two dimensions depends on the value of full_matrices.

ivy.
vector_to_skew_symmetric_matrix
(vector, f=None)[source]¶ Given vector \(\mathbf{a}\in\mathbb{R}^3\), return associated skewsymmetric matrix \([\mathbf{a}]_×\in\mathbb{R}^{3×3}\) satisfying \(\mathbf{a}×\mathbf{b}=[\mathbf{a}]_×\mathbf{b}\).
 Parameters
vector (array) – Vector to convert [batch_shape,3].
f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.
 Returns
Skewsymmetric matrix [batch_shape,3,3].