pinv

Contents

pinv#

Compute the Moore-Penrose pseudo-inverse of a matrix.

template<typename OpA>
__MATX_INLINE__ auto matx::pinv(const OpA &a, float rcond = get_default_rcond<typename OpA::value_type>())#

Perfom a generalized inverse of a matrix using its singular-value decomposition (SVD). It automatically removes small singular values for stability.

If rank > 2, operations are batched.

Template Parameters:

OpA – Tensor or operator type of input A

Parameters:
  • a – Input tensor or operator of shape ... x m x n

  • rcond – Cutoff for small singular values. For stability, singular values smaller than rcond * largest_singular_value are set to 0 for each matrix in the batch. By default, rcond is approximately the machine epsilon of the tensor dtype (1e-6for float types and 1e-15 for double types).

Returns:

Operator that produces a tensor of size ... x n x m representing the pseudo-inverse of the input

Examples#

(A_pinv = pinv(A)).run(this->exec);