eig#

Perform an eigenvalue decomposition for Hermitian or real symmetric matrices.

Added in version 0.6.0.

Note

The mtie assignment form of eig uses the normal non-JIT solver path. CUDA JIT fusion is available through lazy projection members such as eig(A).Vectors and eig(A).Values when -DMATX_EN_MATHDX=ON is enabled and the runtime shape/type is supported by cuSolverDx. Projection JIT currently supports rank 2 through 4 square Hermitian or real symmetric matrices with float, double, complex<float>, and complex<double> inputs. Expressions that only reference Values use the cuSolverDx no-vectors job.

template<typename OpA>
__MATX_INLINE__ auto matx::eig(const OpA &a, EigenMode jobz = EigenMode::VECTOR, SolverFillMode uplo = SolverFillMode::UPPER)#

Performs an eigenvalue decomposition, computing the eigenvalues, and optionally the eigenvectors, for a Hermitian or real symmetric matrix.

If rank > 2, operations are batched.

Template Parameters:

OpA – Data type of input a tensor or operator

Parameters:
  • a – Input Hermitian/symmetric tensor or operator of shape ... x n x n

  • jobz – Whether to compute eigenvectors.

  • uplo – Part of matrix to fill

Returns:

Operator that produces eigenvectors and eigenvalues tensors. Regardless of jobz, both tensors must be correctly setup for the operation and used with mtie().

  • Eigenvectors - The eigenvectors tensor of shape ... x n x n where each column contains the normalized eigenvectors.

  • Eigenvalues - The eigenvalues tensor of shape ... x n. This must be real and match the inner type of the input/output tensors.

Enums#

The following enums are used for configuring the behavior of Eig operations.

enum class matx::EigenMode#

Specifies whether or not eigenvectors should be computed.

Values:

enumerator NO_VECTOR#

Only eigenvalues are computed

enumerator VECTOR#

Both eigenvalues and eigenvectors are computed

Examples#

// Note that eigenvalue/vector solutions are not necessarily ordered in the same way other libraries
// may order them. When comparing against other libraries it's best to check A*v = lambda * v
(mtie(Evv, Wov) = eig(Bv)).run(this->exec);

Projection Examples#

The Vectors and Values projections can be used directly in expressions. This example checks the A * V == V * diag(lambda) relationship and is included from the ProjectionAPI unit test.

auto op = eig(Bv);
(residual = matmul(Bv, op.Vectors) - matmul(op.Vectors, diag(as_type<TestType>(op.Values)))).run(exec);