MiniTensor Version of the Day
Loading...
Searching...
No Matches
Inverse and Linear Solves

Tensor inversion, row/column manipulation, rank-one updates, preconditioners and small dense linear solves. More...

Enumerations

enum class  minitensor::PreconditionerType { minitensor::PreconditionerType::UNDEFINED = 0 , minitensor::PreconditionerType::IDENTITY = 1 , minitensor::PreconditionerType::DIAGONAL = 2 , minitensor::PreconditionerType::MAX_ABS_ROW = 3 }
 

Functions

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::inverse (Tensor< T, N > const &A)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::inverse_fast23 (Tensor< T, N > const &A)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::inverse_full_pivot (Tensor< T, N > const &A)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::swap_row (Tensor< T, N > &A, Index const i, Index const j)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::swap_col (Tensor< T, N > &A, Index const i, Index const j)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::rank_one_left (T const &beta, Vector< T, N > const &v, Tensor< T, N > &A)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::rank_one_right (T const &beta, Vector< T, N > const &v, Tensor< T, N > &A)
 
template<typename T , Index N, typename RHS >
std::pair< Tensor< T, N >, RHS > minitensor::precon (PreconditionerType const pt, Tensor< T, N > const &A, RHS const &B)
 
template<typename T , Index N, typename RHS >
RHS minitensor::solve (Tensor< T, N > const &A, RHS const &b, PreconditionerType const pt=PreconditionerType::IDENTITY)
 
template<typename T , Index N, typename RHS >
KOKKOS_INLINE_FUNCTION RHS minitensor::solve_full_pivot (Tensor< T, N > const &A, RHS const &b)
 

Detailed Description

Tensor inversion, row/column manipulation, rank-one updates, preconditioners and small dense linear solves.

Enumeration Type Documentation

◆ PreconditionerType

enum class minitensor::PreconditionerType
strong

Preconditioner types

Enumerator
UNDEFINED 
IDENTITY 
DIAGONAL 
MAX_ABS_ROW 

Definition at line 94 of file MiniTensor_Inverse.h.

Function Documentation

◆ inverse()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::inverse ( Tensor< T, N > const &  A)

2nd-order tensor inverse

Parameters
Anonsingular tensor
Returns
\( A^{-1} \)

Definition at line 182 of file MiniTensor_Inverse.h.

◆ inverse_fast23()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::inverse_fast23 ( Tensor< T, N > const &  A)

2nd-order tensor inverse using analitical expression for 2 and 3 dimensions

Parameters
Anonsingular tensor
Returns
\( A^{-1} \)

Definition at line 217 of file MiniTensor_Inverse.h.

◆ inverse_full_pivot()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::inverse_full_pivot ( Tensor< T, N > const &  A)

2nd-order tensor inverse using full pivoting, very accurate

Parameters
Anonsingular tensor
Returns
\( A^{-1} \)

Definition at line 197 of file MiniTensor_Inverse.h.

◆ swap_row()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::swap_row ( Tensor< T, N > &  A,
Index const  i,
Index const  j 
)

Swap row. Echange rows i and j in place

Parameters
Atensor
iindex
jindex

Definition at line 140 of file MiniTensor_Inverse.h.

◆ swap_col()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::swap_col ( Tensor< T, N > &  A,
Index const  i,
Index const  j 
)

Swap column. Echange columns i and j in place

Parameters
Atensor
iindex
jindex

Definition at line 162 of file MiniTensor_Inverse.h.

◆ rank_one_left()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::rank_one_left ( T const &  beta,
Vector< T, N > const &  v,
Tensor< T, N > &  A 
)

Apply rank-one update on the left in place \( A = (I - beta v v^T) A \)

Definition at line 399 of file MiniTensor_Inverse.h.

◆ rank_one_right()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::rank_one_right ( T const &  beta,
Vector< T, N > const &  v,
Tensor< T, N > &  A 
)

Apply rank-one update on the right in place \( A = A (I - beta v v^T) \)

Definition at line 411 of file MiniTensor_Inverse.h.

◆ precon()

template<typename T , Index N, typename RHS >
std::pair< Tensor< T, N >, RHS > minitensor::precon ( PreconditionerType const  pt,
Tensor< T, N > const &  A,
RHS const &  B 
)

Compute a preconditioner for improving the conditioning of a linear system.

Definition at line 471 of file MiniTensor_Inverse.h.

◆ solve()

template<typename T , Index N, typename RHS >
RHS minitensor::solve ( Tensor< T, N > const &  A,
RHS const &  b,
PreconditionerType const  pt = PreconditionerType::IDENTITY 
)

Solve linear system of equations. This is meant for the solution of small linear systems of equations typically found in constitutive updates. Right now the implementation is very inefficient (but accurate) as it just uses the inverse function. It is intended to be used in conjunction with Kokkos to take advantage of thread parallelism.

Parameters
Aassumed non-singular tensor
brhs of the system Ax=b
ptpreconditioner type
Returns
x solution(s) to the system Ax=b

Definition at line 500 of file MiniTensor_Inverse.h.

◆ solve_full_pivot()

template<typename T , Index N, typename RHS >
KOKKOS_INLINE_FUNCTION RHS minitensor::solve_full_pivot ( Tensor< T, N > const &  A,
RHS const &  b 
)

Solve linear system A x = b via Gauss-Jordan elimination with full pivoting.

Definition at line 274 of file MiniTensor_Inverse.h.