inv#

Matrix inverse#

Compute the inverse of a square matrix.

Note

This function is currently not supported with host-based executors (CPU)

template<typename OpA, MatInverseAlgo_t ALGO = MAT_INVERSE_ALGO_LU>
__MATX_INLINE__ auto matx::inv(const OpA &a)#

Performs a matrix inverse on a square matrix. The inverse API currently uses cuBLAS as a backend with the cublas<t>matinvBatched() family of functions for N <= 32 and getri/getrf functions otherwise.

If rank > 2, operations are batched.

Template Parameters:
  • OpA – Data type of input a tensor or operator

  • ALGO – Algorithm to use for matrix inversion. Currently only suport MAT_INVERSE_ALGO_LU

Parameters:

a – Input tensor or operator of shape ... x n x n

Returns:

Operator that produces the inverse tensor of shape ... x n x n.

Examples#

// Perform an inverse on matrix "A" and store the output in "Ainv"
(Ainv = inv(A)).run(this->exec);