SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::helper::Decompose< Real > Class Template Reference

#include <decompose.h>

Public Member Functions

SOFA_HELPER_API float zeroTolerance ()
 
SOFA_HELPER_API double zeroTolerance ()
 

Static Public Member Functions

static Real zeroTolerance ()
 threshold for zero comparison (1e-6 for float and 1e-8 for double) More...
 
QR
static void getRotation (type::Mat< 3, 3, Real > &r, type::Vec< 3, Real > &edgex, type::Vec< 3, Real > &edgey)
 
static void QRDecomposition (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &R)
 
static void QRDecomposition (const type::Mat< 3, 2, Real > &M, type::Mat< 3, 2, Real > &R)
 
static void QRDecomposition (const type::Mat< 2, 2, Real > &M, type::Mat< 2, 2, Real > &R)
 
static bool QRDecomposition_stable (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &R)
 
static bool QRDecomposition_stable (const type::Mat< 3, 2, Real > &M, type::Mat< 3, 2, Real > &R)
 
static bool QRDecomposition_stable (const type::Mat< 2, 2, Real > &M, type::Mat< 2, 2, Real > &R)
 
template<Size spatial_dimension, Size material_dimension>
static void QRDecompositionGradient_dQ (const type::Mat< spatial_dimension, material_dimension, Real > &Q, const type::Mat< material_dimension, material_dimension, Real > &invR, const type::Mat< spatial_dimension, material_dimension, Real > &dM, type::Mat< spatial_dimension, material_dimension, Real > &dQ)
 
Polar
static Real polarDecomposition (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &Q, type::Mat< 3, 3, Real > &S)
 
static Real polarDecomposition (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &Q)
 
static void polarDecomposition (const type::Mat< 2, 2, Real > &M, type::Mat< 2, 2, Real > &Q)
 
static bool polarDecomposition_stable (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &Q, type::Mat< 3, 3, Real > &S)
 
static bool polarDecomposition_stable (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &Q)
 
static bool polarDecomposition_stable (const type::Mat< 2, 2, Real > &M, type::Mat< 2, 2, Real > &Q, type::Mat< 2, 2, Real > &S)
 
static bool polarDecomposition_stable (const type::Mat< 2, 2, Real > &M, type::Mat< 2, 2, Real > &Q)
 
static void polarDecomposition (const type::Mat< 3, 2, Real > &M, type::Mat< 3, 2, Real > &Q, type::Mat< 2, 2, Real > &S)
 
static void polarDecompositionGradient_G (const type::Mat< 3, 3, Real > &Q, const type::Mat< 3, 3, Real > &S, type::Mat< 3, 3, Real > &invG)
 
static void polarDecompositionGradient_dQ (const type::Mat< 3, 3, Real > &invG, const type::Mat< 3, 3, Real > &Q, const type::Mat< 3, 3, Real > &dM, type::Mat< 3, 3, Real > &dQ)
 
static void polarDecompositionGradient_dQOverdM (const type::Mat< 3, 3, Real > &Q, const type::Mat< 3, 3, Real > &invG, type::Mat< 9, 9, Real > &J)
 
static void polarDecompositionGradient_dQOverdM (const type::Mat< 3, 3, Real > &Q, const type::Mat< 3, 3, Real > &Sinv, const type::Mat< 9, 9, Real > &dSOverdM, type::Mat< 9, 9, Real > &J)
 
static void polarDecompositionGradient_dS (const type::Mat< 3, 3, Real > &Q, const type::Mat< 3, 3, Real > &S, const type::Mat< 3, 3, Real > &dQ, const type::Mat< 3, 3, Real > &dM, type::Mat< 3, 3, Real > &dS)
 
static void polarDecompositionGradient_dSOverdM (const type::Mat< 3, 3, Real > &Q, const type::Mat< 3, 3, Real > &M, const type::Mat< 3, 3, Real > &invG, type::Mat< 9, 9, Real > &J)
 
static void polarDecompositionGradient_dSOverdM (const type::Mat< 3, 3, Real > &M, const type::Mat< 3, 3, Real > &S, type::Mat< 9, 9, Real > &J)
 
static bool polarDecomposition_stable_Gradient_dQ (const type::Mat< 3, 3, Real > &U, const type::Vec< 3, Real > &Sdiag, const type::Mat< 3, 3, Real > &V, const type::Mat< 3, 3, Real > &dM, type::Mat< 3, 3, Real > &dQ)
 
static bool polarDecomposition_stable_Gradient_dQOverdM (const type::Mat< 3, 3, Real > &U, const type::Vec< 3, Real > &Sdiag, const type::Mat< 3, 3, Real > &V, type::Mat< 9, 9, Real > &dQOverdM)
 
static bool polarDecompositionGradient_dQ (const type::Mat< 3, 2, Real > &U, const type::Vec< 2, Real > &Sdiag, const type::Mat< 2, 2, Real > &V, const type::Mat< 3, 2, Real > &dM, type::Mat< 3, 2, Real > &dQ)
 
static bool polarDecompositionGradient_dQOverdM (const type::Mat< 3, 2, Real > &U, const type::Vec< 2, Real > &Sdiag, const type::Mat< 2, 2, Real > &V, type::Mat< 6, 6, Real > &dQOverdM)
 
Eigen Decomposition
static void eigenDecomposition (const type::Mat< 3, 3, Real > &A, type::Mat< 3, 3, Real > &V, type::Vec< 3, Real > &diag)
 
static void eigenDecomposition (const type::Mat< 2, 2, Real > &A, type::Mat< 2, 2, Real > &V, type::Vec< 2, Real > &diag)
 
static void eigenDecomposition_iterative (const type::Mat< 3, 3, Real > &M, type::Mat< 3, 3, Real > &V, type::Vec< 3, Real > &diag)
 
static void eigenDecomposition_iterative (const type::Mat< 2, 2, Real > &M, type::Mat< 2, 2, Real > &V, type::Vec< 2, Real > &diag)
 
SVD
static void SVD (const type::Mat< 3, 3, Real > &F, type::Mat< 3, 3, Real > &U, type::Vec< 3, Real > &S, type::Mat< 3, 3, Real > &V)
 
static bool SVD_stable (const type::Mat< 3, 3, Real > &F, type::Mat< 3, 3, Real > &U, type::Vec< 3, Real > &S, type::Mat< 3, 3, Real > &V)
 
static bool SVD_stable (const type::Mat< 2, 2, Real > &F, type::Mat< 2, 2, Real > &U, type::Vec< 2, Real > &S, type::Mat< 2, 2, Real > &V)
 
static void SVD (const type::Mat< 3, 2, Real > &F, type::Mat< 3, 2, Real > &U, type::Vec< 2, Real > &S, type::Mat< 2, 2, Real > &V)
 
static bool SVD_stable (const type::Mat< 3, 2, Real > &F, type::Mat< 3, 2, Real > &U, type::Vec< 2, Real > &S, type::Mat< 2, 2, Real > &V)
 
static bool SVDGradient_dUdV (const type::Mat< 3, 3, Real > &U, const type::Vec< 3, Real > &S, const type::Mat< 3, 3, Real > &V, const type::Mat< 3, 3, Real > &dM, type::Mat< 3, 3, Real > &dU, type::Mat< 3, 3, Real > &dV)
 
static bool SVDGradient_dUdVOverdM (const type::Mat< 3, 3, Real > &U, const type::Vec< 3, Real > &S, const type::Mat< 3, 3, Real > &V, type::Mat< 9, 9, Real > &dUOverdM, type::Mat< 9, 9, Real > &dVOverdM)
 
static bool SVDGradient_dUdV (const type::Mat< 3, 2, Real > &U, const type::Vec< 2, Real > &S, const type::Mat< 2, 2, Real > &V, const type::Mat< 3, 2, Real > &dM, type::Mat< 3, 2, Real > &dU, type::Mat< 2, 2, Real > &dV)
 
static bool SVDGradient_dUdVOverdM (const type::Mat< 3, 2, Real > &U, const type::Vec< 2, Real > &S, const type::Mat< 2, 2, Real > &V, type::Mat< 6, 6, Real > &dUOverdM, type::Mat< 4, 6, Real > &dVOverdM)
 
Diagonalization
static int symmetricDiagonalization (const type::Mat< 3, 3, Real > &A, type::Mat< 3, 3, Real > &Q, type::Vec< 3, Real > &w)
 
static void PSDProjection (type::Mat< 3, 3, Real > &A)
 project a symmetric 3x3 matrix to a PSD (symmetric, positive semi-definite) More...
 
static void PSDProjection (type::Mat< 2, 2, Real > &A)
 project a symmetric 2x2 matrix to a PSD (symmetric, positive semi-definite) More...
 
static void PSDProjection (Real &A00, Real &A01, Real &A10, Real &A11)
 
static void PSDProjection (type::Mat< 1, 1, Real > &)
 
static void NSDProjection (type::Mat< 3, 3, Real > &A)
 project a symmetric 3x3 matrix to a NSD (symmetric, negative semi-definite) More...
 
static void NSDProjection (type::Mat< 2, 2, Real > &A)
 project a symmetric 2x2 matrix to a NSD (symmetric, negative semi-definite) More...
 
static void NSDProjection (Real &A00, Real &A01, Real &A10, Real &A11)
 
static void NSDProjection (type::Mat< 1, 1, Real > &)
 

Function details

◆ eigenDecomposition() [1/2]

template<typename Real >
void sofa::helper::Decompose< Real >::eigenDecomposition ( const type::Mat< 2, 2, Real > &  A,
type::Mat< 2, 2, Real > &  V,
type::Vec< 2, Real > &  diag 
)
static

Non-iterative Eigensystem decomposition: eigenvalues

Parameters
diagand eigenvectors (columns of
V)of the 2x2 Real Matrix
A
Warning
this method is instable in specific configurations TODO

◆ eigenDecomposition() [2/2]

template<typename Real >
void sofa::helper::Decompose< Real >::eigenDecomposition ( const type::Mat< 3, 3, Real > &  A,
type::Mat< 3, 3, Real > &  V,
type::Vec< 3, Real > &  diag 
)
static

Non-iterative & faster Eigensystem decomposition: eigenvalues

Parameters
diagand eigenvectors (columns of
V)of the 3x3 Real Matrix
ADerived from Wild Magic Library

◆ eigenDecomposition_iterative() [1/2]

template<class Real >
void sofa::helper::Decompose< Real >::eigenDecomposition_iterative ( const type::Mat< 2, 2, Real > &  M,
type::Mat< 2, 2, Real > &  V,
type::Vec< 2, Real > &  diag 
)
static

Eigensystem decomposition: eigenvalues

Parameters
diagand eigenvectors (columns of
V)of the 2x2 Real Matrix
MDerived from Wild Magic Library

◆ eigenDecomposition_iterative() [2/2]

template<class Real >
void sofa::helper::Decompose< Real >::eigenDecomposition_iterative ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  V,
type::Vec< 3, Real > &  diag 
)
static

Eigensystem decomposition: eigenvalues

Parameters
diagand eigenvectors (columns of
V)of the 3x3 Real Matrix
MDerived from Wild Magic Library

◆ getRotation()

template<class Real >
void sofa::helper::Decompose< Real >::getRotation ( type::Mat< 3, 3, Real > &  r,
type::Vec< 3, Real > &  edgex,
type::Vec< 3, Real > &  edgey 
)
static

QR decomposition Compute an orthonormal right-handed 3x3 basis based on two vectors using Gram-Schmidt orthogonalization. The basis vectors are the columns of the matrix R. The matrix represents the rotation of the local frame with respect to the reference frame. The first basis vector is aligned to the first given vector, the second basis vector is in the plane of the two first given vectors, and the third basis vector is orthogonal to the two others. Undefined result if one of the vectors is null, or if the two vectors are parallel.

◆ NSDProjection() [1/4]

template<class Real >
void sofa::helper::Decompose< Real >::NSDProjection ( Real &  A00,
Real &  A01,
Real &  A10,
Real &  A11 
)
static

◆ NSDProjection() [2/4]

template<class Real >
static void sofa::helper::Decompose< Real >::NSDProjection ( type::Mat< 1, 1, Real > &  )
inlinestatic

◆ NSDProjection() [3/4]

template<class Real >
void sofa::helper::Decompose< Real >::NSDProjection ( type::Mat< 2, 2, Real > &  A)
static

project a symmetric 2x2 matrix to a NSD (symmetric, negative semi-definite)

◆ NSDProjection() [4/4]

template<class Real >
void sofa::helper::Decompose< Real >::NSDProjection ( type::Mat< 3, 3, Real > &  A)
static

project a symmetric 3x3 matrix to a NSD (symmetric, negative semi-definite)

◆ polarDecomposition() [1/4]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecomposition ( const type::Mat< 2, 2, Real > &  M,
type::Mat< 2, 2, Real > &  Q 
)
static

Polar decomposition of a 2x2 matrix M = QS Analytic formulation given in "Matrix Animation and Polar Decomposition" Ken Shoemake, Computer Graphics Laboratory, University of Pennsylvania Tom Duff, AT&T Bell Laboratories, Murray Hill

◆ polarDecomposition() [2/4]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecomposition ( const type::Mat< 3, 2, Real > &  M,
type::Mat< 3, 2, Real > &  Q,
type::Mat< 2, 2, Real > &  S 
)
static

Stable Polar Decomposition of 3x2 matrix based on a SVD using Q=UVt where M=UsV

◆ polarDecomposition() [3/4]

template<class Real >
Real sofa::helper::Decompose< Real >::polarDecomposition ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  Q 
)
static

The same as previous except we do not care about S

◆ polarDecomposition() [4/4]

template<class Real >
Real sofa::helper::Decompose< Real >::polarDecomposition ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  Q,
type::Mat< 3, 3, Real > &  S 
)
static

Polar Decomposition of 3x3 matrix, M = QS. See Nicholas Higham and Robert S. Schreiber, Fast Polar Decomposition of An Arbitrary Matrix, Technical Report 88-942, October 1988, Department of Computer Science, Cornell University.

original code by Ken Shoemake, 1993 version simplified by Jernej Barbič imported from Vega

◆ polarDecomposition_stable() [1/4]

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const type::Mat< 2, 2, Real > &  M,
type::Mat< 2, 2, Real > &  Q 
)
static

◆ polarDecomposition_stable() [2/4]

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const type::Mat< 2, 2, Real > &  M,
type::Mat< 2, 2, Real > &  Q,
type::Mat< 2, 2, Real > &  S 
)
static

◆ polarDecomposition_stable() [3/4]

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  Q 
)
static

◆ polarDecomposition_stable() [4/4]

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  Q,
type::Mat< 3, 3, Real > &  S 
)
static

Stable Polar Decomposition of 3x3 matrix based on a stable SVD using Q=UVt where M=UsV

Returns
true iff the stabilization processed an inverted rotation or a degenerate case

◆ polarDecomposition_stable_Gradient_dQ()

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable_Gradient_dQ ( const type::Mat< 3, 3, Real > &  U,
const type::Vec< 3, Real > &  Sdiag,
const type::Mat< 3, 3, Real > &  V,
const type::Mat< 3, 3, Real > &  dM,
type::Mat< 3, 3, Real > &  dQ 
)
static

Polar decomposition rotation gradient, computes the strain gradient dS of a given polar decomposition computed by a SVD such as M = U*Sdiag*V Christopher Twigg, Zoran Kacic-Alesic, "Point Cloud Glue: Constraining simulations using the Procrustes transform", SCA'10

◆ polarDecomposition_stable_Gradient_dQOverdM()

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable_Gradient_dQOverdM ( const type::Mat< 3, 3, Real > &  U,
const type::Vec< 3, Real > &  Sdiag,
const type::Mat< 3, 3, Real > &  V,
type::Mat< 9, 9, Real > &  dQOverdM 
)
static

◆ polarDecompositionGradient_dQ() [1/2]

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecompositionGradient_dQ ( const type::Mat< 3, 2, Real > &  U,
const type::Vec< 2, Real > &  Sdiag,
const type::Mat< 2, 2, Real > &  V,
const type::Mat< 3, 2, Real > &  dM,
type::Mat< 3, 2, Real > &  dQ 
)
static

Polar decomposition rotation gradient, computes the strain gradient dS of a given polar decomposition computed by a SVD such as M = U*Sdiag*V Christopher Twigg, Zoran Kacic-Alesic, "Point Cloud Glue: Constraining simulations using the Procrustes transform", SCA'10

◆ polarDecompositionGradient_dQ() [2/2]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dQ ( const type::Mat< 3, 3, Real > &  invG,
const type::Mat< 3, 3, Real > &  Q,
const type::Mat< 3, 3, Real > &  dM,
type::Mat< 3, 3, Real > &  dQ 
)
static

Polar decomposition rotation gradient, computes the rotation gradient dQ of a given polar decomposition First, invG needs to be computed with function polarDecompositionGradient_G

◆ polarDecompositionGradient_dQOverdM() [1/3]

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecompositionGradient_dQOverdM ( const type::Mat< 3, 2, Real > &  U,
const type::Vec< 2, Real > &  Sdiag,
const type::Mat< 2, 2, Real > &  V,
type::Mat< 6, 6, Real > &  dQOverdM 
)
static

◆ polarDecompositionGradient_dQOverdM() [2/3]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dQOverdM ( const type::Mat< 3, 3, Real > &  Q,
const type::Mat< 3, 3, Real > &  invG,
type::Mat< 9, 9, Real > &  J 
)
static

◆ polarDecompositionGradient_dQOverdM() [3/3]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dQOverdM ( const type::Mat< 3, 3, Real > &  Q,
const type::Mat< 3, 3, Real > &  Sinv,
const type::Mat< 9, 9, Real > &  dSOverdM,
type::Mat< 9, 9, Real > &  J 
)
static

◆ polarDecompositionGradient_dS()

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dS ( const type::Mat< 3, 3, Real > &  Q,
const type::Mat< 3, 3, Real > &  S,
const type::Mat< 3, 3, Real > &  dQ,
const type::Mat< 3, 3, Real > &  dM,
type::Mat< 3, 3, Real > &  dS 
)
static

Polar decomposition rotation gradient, computes the strain gradient dS of a given polar decomposition qQ needs to be computed with function polarDecompositionGradient_dQ

◆ polarDecompositionGradient_dSOverdM() [1/2]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dSOverdM ( const type::Mat< 3, 3, Real > &  M,
const type::Mat< 3, 3, Real > &  S,
type::Mat< 9, 9, Real > &  J 
)
static

◆ polarDecompositionGradient_dSOverdM() [2/2]

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dSOverdM ( const type::Mat< 3, 3, Real > &  Q,
const type::Mat< 3, 3, Real > &  M,
const type::Mat< 3, 3, Real > &  invG,
type::Mat< 9, 9, Real > &  J 
)
static

◆ polarDecompositionGradient_G()

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_G ( const type::Mat< 3, 3, Real > &  Q,
const type::Mat< 3, 3, Real > &  S,
type::Mat< 3, 3, Real > &  invG 
)
static

Polar decomposition gradient, preliminary step: computation of invG = ((tr(S)*I-S)*Qt)^-1 Inspired by Jernej Barbic, Yili Zhao, "Real-time Large-deformation Substructuring" SIGGRAPH 2011 Note that second derivatives are also given in this paper Another way to compute the first derivatives are given in Yi-Chao Chen, Lewis Wheeler, "Derivatives of the stretch and rotation tensors", Journal of elasticity in 1993

◆ PSDProjection() [1/4]

template<class Real >
void sofa::helper::Decompose< Real >::PSDProjection ( Real &  A00,
Real &  A01,
Real &  A10,
Real &  A11 
)
static

◆ PSDProjection() [2/4]

template<class Real >
static void sofa::helper::Decompose< Real >::PSDProjection ( type::Mat< 1, 1, Real > &  )
inlinestatic

◆ PSDProjection() [3/4]

template<class Real >
void sofa::helper::Decompose< Real >::PSDProjection ( type::Mat< 2, 2, Real > &  A)
static

project a symmetric 2x2 matrix to a PSD (symmetric, positive semi-definite)

◆ PSDProjection() [4/4]

template<class Real >
void sofa::helper::Decompose< Real >::PSDProjection ( type::Mat< 3, 3, Real > &  A)
static

project a symmetric 3x3 matrix to a PSD (symmetric, positive semi-definite)

◆ QRDecomposition() [1/3]

template<class Real >
void sofa::helper::Decompose< Real >::QRDecomposition ( const type::Mat< 2, 2, Real > &  M,
type::Mat< 2, 2, Real > &  R 
)
static

◆ QRDecomposition() [2/3]

template<class Real >
void sofa::helper::Decompose< Real >::QRDecomposition ( const type::Mat< 3, 2, Real > &  M,
type::Mat< 3, 2, Real > &  R 
)
static

◆ QRDecomposition() [3/3]

template<class Real >
void sofa::helper::Decompose< Real >::QRDecomposition ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  R 
)
static

QR decomposition Compute an orthonormal right-handed 3x3 basis based on a matrix using Gram-Schmidt orthogonalization. The basis vectors are the columns of the matrix R. The matrix represents the rotation of the local frame with respect to the reference frame. The first basis vector is aligned to the first given vector, the second basis vector is in the plane of the two first given vectors, and the third basis vector is orthogonal to the two others. Undefined result if one of the vectors is null, or if the two vectors are parallel.

◆ QRDecomposition_stable() [1/3]

template<class Real >
bool sofa::helper::Decompose< Real >::QRDecomposition_stable ( const type::Mat< 2, 2, Real > &  M,
type::Mat< 2, 2, Real > &  R 
)
static

◆ QRDecomposition_stable() [2/3]

template<class Real >
bool sofa::helper::Decompose< Real >::QRDecomposition_stable ( const type::Mat< 3, 2, Real > &  M,
type::Mat< 3, 2, Real > &  R 
)
static

◆ QRDecomposition_stable() [3/3]

template<class Real >
bool sofa::helper::Decompose< Real >::QRDecomposition_stable ( const type::Mat< 3, 3, Real > &  M,
type::Mat< 3, 3, Real > &  R 
)
static

QR decomposition stable to null columns. Result is still undefined if two columns are parallel. In the clean case (not degenerated), there are only two additional 'if(x<e)' but no additional computations.

Returns
true in a degenerated configuration

◆ QRDecompositionGradient_dQ()

template<class Real >
template<Size spatial_dimension, Size material_dimension>
static void sofa::helper::Decompose< Real >::QRDecompositionGradient_dQ ( const type::Mat< spatial_dimension, material_dimension, Real > &  Q,
const type::Mat< material_dimension, material_dimension, Real > &  invR,
const type::Mat< spatial_dimension, material_dimension, Real > &  dM,
type::Mat< spatial_dimension, material_dimension, Real > &  dQ 
)
inlinestatic

QR decomposition (M=QR) rotation gradient dQ (invR = R^-1) Formula given in "Finite Random Matrix Theory, Jacobians of Matrix Transforms (without wedge products)", Alan Edelman, 2005, http://web.mit.edu/18.325/www/handouts/handout2.pdf Note that dR is also easy to compute.

◆ SVD() [1/2]

template<class Real >
void sofa::helper::Decompose< Real >::SVD ( const type::Mat< 3, 2, Real > &  F,
type::Mat< 3, 2, Real > &  U,
type::Vec< 2, Real > &  S,
type::Mat< 2, 2, Real > &  V 
)
static

SVD F = U*F_diagonal*V based on the Eigensystem decomposition of FtF all eigenvalues are positive Warning U & V are not guarantee to be rotations (they can be reflexions), eigenvalues are not sorted

◆ SVD() [2/2]

template<class Real >
void sofa::helper::Decompose< Real >::SVD ( const type::Mat< 3, 3, Real > &  F,
type::Mat< 3, 3, Real > &  U,
type::Vec< 3, Real > &  S,
type::Mat< 3, 3, Real > &  V 
)
static

SVD F = U*F_diagonal*V based on the Eigensystem decomposition of FtF all eigenvalues are positive Warning U & V are not guarantee to be rotations (they can be reflexions), eigenvalues are not sorted

◆ SVD_stable() [1/3]

template<class Real >
bool sofa::helper::Decompose< Real >::SVD_stable ( const type::Mat< 2, 2, Real > &  F,
type::Mat< 2, 2, Real > &  U,
type::Vec< 2, Real > &  S,
type::Mat< 2, 2, Real > &  V 
)
static

◆ SVD_stable() [2/3]

template<class Real >
bool sofa::helper::Decompose< Real >::SVD_stable ( const type::Mat< 3, 2, Real > &  F,
type::Mat< 3, 2, Real > &  U,
type::Vec< 2, Real > &  S,
type::Mat< 2, 2, Real > &  V 
)
static

SVD based on the Eigensystem decomposition of FtF with robustness against inversion and degenerate configurations

Returns
true in a degenerate case U & V are rotations Warning eigenvalues are not guaranteed to be positive, eigenvalues are not sorted

◆ SVD_stable() [3/3]

template<class Real >
bool sofa::helper::Decompose< Real >::SVD_stable ( const type::Mat< 3, 3, Real > &  F,
type::Mat< 3, 3, Real > &  U,
type::Vec< 3, Real > &  S,
type::Mat< 3, 3, Real > &  V 
)
static

SVD based on the Eigensystem decomposition of FtF with robustness against inversion and degenerate configurations

Returns
true iff the stabilization processed an inverted rotation or a degenerate case U & V are rotations Warning eigenvalues are not guaranteed to be positive, eigenvalues are not sorted

◆ SVDGradient_dUdV() [1/2]

template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdV ( const type::Mat< 3, 2, Real > &  U,
const type::Vec< 2, Real > &  S,
const type::Mat< 2, 2, Real > &  V,
const type::Mat< 3, 2, Real > &  dM,
type::Mat< 3, 2, Real > &  dU,
type::Mat< 2, 2, Real > &  dV 
)
static

SVD rotation gradients, computes the rotation gradients dU & dV T. Papadopoulo, M.I.A. Lourakis, "Estimating the Jacobian of the Singular Value Decomposition: Theory and Applications", European Conference on Computer Vision, 2000

◆ SVDGradient_dUdV() [2/2]

template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdV ( const type::Mat< 3, 3, Real > &  U,
const type::Vec< 3, Real > &  S,
const type::Mat< 3, 3, Real > &  V,
const type::Mat< 3, 3, Real > &  dM,
type::Mat< 3, 3, Real > &  dU,
type::Mat< 3, 3, Real > &  dV 
)
static

SVD rotation gradients, computes the rotation gradients dU & dV T. Papadopoulo, M.I.A. Lourakis, "Estimating the Jacobian of the Singular Value Decomposition: Theory and Applications", European Conference on Computer Vision, 2000

◆ SVDGradient_dUdVOverdM() [1/2]

template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdVOverdM ( const type::Mat< 3, 2, Real > &  U,
const type::Vec< 2, Real > &  S,
const type::Mat< 2, 2, Real > &  V,
type::Mat< 6, 6, Real > &  dUOverdM,
type::Mat< 4, 6, Real > &  dVOverdM 
)
static

◆ SVDGradient_dUdVOverdM() [2/2]

template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdVOverdM ( const type::Mat< 3, 3, Real > &  U,
const type::Vec< 3, Real > &  S,
const type::Mat< 3, 3, Real > &  V,
type::Mat< 9, 9, Real > &  dUOverdM,
type::Mat< 9, 9, Real > &  dVOverdM 
)
static

◆ symmetricDiagonalization()

template<class Real >
int sofa::helper::Decompose< Real >::symmetricDiagonalization ( const type::Mat< 3, 3, Real > &  A,
type::Mat< 3, 3, Real > &  Q,
type::Vec< 3, Real > &  w 
)
static

Diagonalization of a symmetric 3x3 matrix A = Q.w.Q^{-1} with w the eigenvalues and Q the eigenvectors

◆ zeroTolerance() [1/3]

template<class Real >
static Real sofa::helper::Decompose< Real >::zeroTolerance ( )
static

threshold for zero comparison (1e-6 for float and 1e-8 for double)

◆ zeroTolerance() [2/3]

SOFA_HELPER_API float sofa::helper::Decompose< float >::zeroTolerance ( )
inline

◆ zeroTolerance() [3/3]

SOFA_HELPER_API double sofa::helper::Decompose< double >::zeroTolerance ( )
inline