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.
matrix_norm
(x, p=2, axes=None, keepdims=False, f=None)[source]¶ Compute the matrix pnorm.
 Parameters
x (array) – Input array.
p (int or str, optional) – Order of the norm. Default is 2.
axes (sequence of ints, optional) – The axes of x along which to compute the matrix norms. Default is None, in which case the last two dimensions are used.
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
Matrix norm of the array at specified axes.

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_norm
(x, p=2, axis=None, keepdims=False)[source]¶ Compute the vector pnorm.
 Parameters
x (array) – Input array.
p (int or str, optional) – Order of the norm. Default is 2.
axis (int or sequence of ints, optional) – If axis is an integer, it specifies the axis of x along which to compute the vector norms. Default is None, in which case the flattened array is considered.
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.
 Returns
Vector norm of the array at specified axes.

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].