MiniTensor Version of the Day
Loading...
Searching...
No Matches
Factorizations

Givens rotations, Cholesky, symmetric eigendecomposition, SVD, polar decompositions and condition numbers. More...

Functions

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::givens_left (T const &c, T const &s, Index i, Index k, Tensor< T, N > &A)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::givens_right (T const &c, T const &s, Index i, Index k, Tensor< T, N > &A)
 
template<typename T , Index N>
std::pair< Vector< T, N >, Tensor< T, N > > minitensor::sort_permutation (Vector< T, N > const &u)
 
template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::svd (Tensor< T, N > const &A)
 
template<typename T , Index N>
KOKKOS_INLINE_FUNCTION Tensor< T, N > minitensor::polar_rotation (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_left (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_right (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_eig (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_right_eig (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_logV (Tensor< T, N > const &F)
 
template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_logV_eig (Tensor< T, N > const &F)
 
template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_logV_lame (Tensor< T, N > const &F)
 
template<typename T >
std::pair< T, T > minitensor::schur_sym (const T f, const T g, const T h)
 
template<typename T >
std::pair< T, T > minitensor::givens (T const &a, T const &b)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::eig_sym (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::eig_spd (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::eig_spd_cos (Tensor< T, N > const &A)
 
template<typename T , Index N>
std::pair< Tensor< T, N >, bool > minitensor::cholesky (Tensor< T, N > const &A)
 
template<typename T , Index N>
minitensor::cond (Tensor< T, N > const &A)
 
template<typename T , Index N>
minitensor::inv_cond (Tensor< T, N > const &A)
 

Detailed Description

Givens rotations, Cholesky, symmetric eigendecomposition, SVD, polar decompositions and condition numbers.

Function Documentation

◆ givens_left()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::givens_left ( T const &  c,
T const &  s,
Index  i,
Index  k,
Tensor< T, N > &  A 
)

Apply Givens-Jacobi rotation on the left in place.

Parameters
ccosine defining the rotation G in form [c, s; -s, c]
ssine defining the rotation G in form [c, s; -s, c]
irow index where the rotation is applied
kcolumn index where the rotation is applied
Atensor to rotate

Definition at line 261 of file MiniTensor_Factorizations.h.

◆ givens_right()

template<typename T , Index N>
KOKKOS_INLINE_FUNCTION void minitensor::givens_right ( T const &  c,
T const &  s,
Index  i,
Index  k,
Tensor< T, N > &  A 
)

Apply Givens-Jacobi rotation on the right in place.

Parameters
ccosine defining the rotation G in form [c, s; -s, c]
ssine defining the rotation G in form [c, s; -s, c]
irow index where the rotation is applied
kcolumn index where the rotation is applied
Atensor to rotate

Definition at line 281 of file MiniTensor_Factorizations.h.

◆ sort_permutation()

template<typename T , Index N>
std::pair< Vector< T, N >, Tensor< T, N > > minitensor::sort_permutation ( Vector< T, N > const &  u)

Sort and index. Useful for ordering singular values and eigenvalues and corresponding vectors in the respective decompositions.

Parameters
uvector to sort
Returns
v P sorted vector, permutation matrix such that v = P^T u

Definition at line 227 of file MiniTensor_Factorizations.h.

◆ svd()

template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::svd ( Tensor< T, N > const &  A)

Singular value decomposition (SVD)

Returns
\( A = USV^T\)

Definition at line 546 of file MiniTensor_Factorizations.h.

◆ polar_rotation()

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

Project to O(N) (Orthogonal Group) using a Newton-type algorithm. See Higham's Functions of Matrices p210 [2008]

Parameters
Atensor (often a deformation-gradient-like tensor)
Returns
\( R = \arg min_Q \|A - Q\|\) This algorithm projects a given tensor in GL(N) to O(N). The rotation/reflection obtained through this projection is the orthogonal component of the real polar decomposition

Definition at line 606 of file MiniTensor_Factorizations.h.

◆ polar_left()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_left ( Tensor< T, N > const &  A)

Left polar decomposition

Parameters
Atensor (often a deformation-gradient-like tensor)
Returns
\( VR = A \) with \( R \in SO(N) \) and \( V \in SPD(N) \)

Definition at line 688 of file MiniTensor_Factorizations.h.

◆ polar_right()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_right ( Tensor< T, N > const &  A)

Right polar decomposition

Parameters
Atensor (often a deformation-gradient-like tensor)
Returns
\( RU = A \) with \( R \in SO(N) \) and \( U \in SPD(N) \)

Definition at line 704 of file MiniTensor_Factorizations.h.

◆ polar_left_eig()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_eig ( Tensor< T, N > const &  A)

Left polar decomposition computed with eigenvalue decomposition

Parameters
Atensor (often a deformation-gradient-like tensor)
Returns
\( VR = A \) with \( R \in SO(N) \) and \( V \in SPD(N) \)

Definition at line 720 of file MiniTensor_Factorizations.h.

◆ polar_right_eig()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::polar_right_eig ( Tensor< T, N > const &  A)

R^3 right polar decomposition

Parameters
Atensor (often a deformation-gradient-like tensor)
Returns
\( RU = F \) with \( R \in SO(N) \) and \( U \in SPD(N) \)

Definition at line 780 of file MiniTensor_Factorizations.h.

◆ polar_left_logV()

template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_logV ( Tensor< T, N > const &  F)

Left polar decomposition with matrix logarithm for V

Parameters
Ftensor (often a deformation-gradient-like tensor)
Returns
\( VR = F \) with \( R \in SO(N) \) and V SPD, and log V

Definition at line 845 of file MiniTensor_Factorizations.h.

◆ polar_left_logV_eig()

template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_logV_eig ( Tensor< T, N > const &  F)

R^N left polar decomposition with eigenvalue decomposition, returning also \( \log V \).

Definition at line 879 of file MiniTensor_Factorizations.h.

◆ polar_left_logV_lame()

template<typename T , Index N>
std::tuple< Tensor< T, N >, Tensor< T, N >, Tensor< T, N > > minitensor::polar_left_logV_lame ( Tensor< T, N > const &  F)

Left polar decomposition with matrix logarithm for V using eig_spd_cos

Parameters
Ftensor (often a deformation-gradient-like tensor)
Returns
\( VR = F \) with \( R \in SO(N) \) and V SPD, and log V

Definition at line 922 of file MiniTensor_Factorizations.h.

◆ schur_sym()

template<typename T >
std::pair< T, T > minitensor::schur_sym ( const T  f,
const T  g,
const T  h 
)

Symmetric Schur algorithm for R^2.

Parameters
fcomponent of \( A = [f, g; g, h] \in S(2) \)
gcomponent of \( A = [f, g; g, h] \in S(2) \)
hcomponent of \( A = [f, g; g, h] \in S(2) \)
Returns
\( c, s \) such that \( [c, -s; s, c] \) diagonalizes A

Definition at line 970 of file MiniTensor_Factorizations.h.

◆ givens()

template<typename T >
std::pair< T, T > minitensor::givens ( T const &  a,
T const &  b 
)

Givens rotation. [c, -s; s, c] [a; b] = [r; 0]

Returns
c and s

Definition at line 994 of file MiniTensor_Factorizations.h.

◆ eig_sym()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::eig_sym ( Tensor< T, N > const &  A)

Eigenvalue decomposition for symmetric 2nd-order tensor

Returns
V eigenvectors, D eigenvalues in diagonal Matlab-style

Definition at line 1211 of file MiniTensor_Factorizations.h.

◆ eig_spd()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::eig_spd ( Tensor< T, N > const &  A)

Eigenvalue decomposition for SPD 2nd-order tensor

Returns
V eigenvectors, D eigenvalues in diagonal Matlab-style

Definition at line 1239 of file MiniTensor_Factorizations.h.

◆ eig_spd_cos()

template<typename T , Index N>
std::pair< Tensor< T, N >, Tensor< T, N > > minitensor::eig_spd_cos ( Tensor< T, N > const &  A)

Eigenvalue decomposition for SPD 2nd-order tensor

Returns
V eigenvectors, D eigenvalues in diagonal Matlab-style This algorithm comes from the journal article Scherzinger and Dohrmann, CMAME 197 (2008) 4007-4015

Definition at line 1249 of file MiniTensor_Factorizations.h.

◆ cholesky()

template<typename T , Index N>
std::pair< Tensor< T, N >, bool > minitensor::cholesky ( Tensor< T, N > const &  A)

Cholesky decomposition, rank-1 update algorithm (Matrix Computations 3rd ed., Golub & Van Loan, p145)

Parameters
Aassumed symmetric tensor
Returns
G Cholesky factor A = GG^T and completed (bool) algorithm ran to completion

Definition at line 1503 of file MiniTensor_Factorizations.h.

◆ cond()

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

Condition number: ratio of largest to smalest singular values.

Definition at line 195 of file MiniTensor_Factorizations.h.

◆ inv_cond()

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

Reciprocal condition number: ratio of smallest to largest singular values.

Definition at line 210 of file MiniTensor_Factorizations.h.