tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
Namespaces | Functions
inverse.h File Reference

Matrix inverse with compile-time dispatch. More...

#include "config.h"
#include "utilities/expected.h"
#include "matrix_traits.h"
#include "algorithms/decomposition/lu.h"
#include "algorithms/solvers/triangular_solve.h"
#include "math/math_utils.h"
Include dependency graph for inverse.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  matrix_algorithms
 

Functions

template<typename T , my_size_t N>
Expected< FusedMatrix< T, N, N >, MatrixStatus > matrix_algorithms::inverse (const FusedMatrix< T, N, N > &A)
 Compute the inverse of a square matrix.
 
template<typename T , my_size_t N>
FusedMatrix< T, N, N > matrix_algorithms::inverse_or_die (const FusedMatrix< T, N, N > &A)
 Matrix inverse — abort on failure.
 

Detailed Description

Matrix inverse with compile-time dispatch.

Small sizes (1×1, 2×2, 3×3, 4×4) use direct adjugate/det formulas — O(1), fully unrolled, no LU overhead.


ALGORITHM

Generic path (N>4) uses LU decomposition:

  1. Decompose P·A = L·U via lu(A)
  2. Solve L·Y = P·I, then U·X = Y

Complexity: O(1) for N≤4, O(5N³/3) for N>4.


FAILURE MODES