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

#include <decompose.h>

Public Member Functions

template<>
SOFA_HELPER_API float zeroTolerance ()
 
template<>
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 (defaulttype::Mat< 3, 3, Real > &r, defaulttype::Vec< 3, Real > &edgex, defaulttype::Vec< 3, Real > &edgey)
 
static void QRDecomposition (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &R)
 
static void QRDecomposition (const defaulttype::Mat< 3, 2, Real > &M, defaulttype::Mat< 3, 2, Real > &R)
 
static void QRDecomposition (const defaulttype::Mat< 2, 2, Real > &M, defaulttype::Mat< 2, 2, Real > &R)
 
static bool QRDecomposition_stable (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &R)
 
static bool QRDecomposition_stable (const defaulttype::Mat< 3, 2, Real > &M, defaulttype::Mat< 3, 2, Real > &R)
 
static bool QRDecomposition_stable (const defaulttype::Mat< 2, 2, Real > &M, defaulttype::Mat< 2, 2, Real > &R)
 
template<std::size_t spatial_dimension, std::size_t material_dimension>
static void QRDecompositionGradient_dQ (const defaulttype::Mat< spatial_dimension, material_dimension, Real > &Q, const defaulttype::Mat< material_dimension, material_dimension, Real > &invR, const defaulttype::Mat< spatial_dimension, material_dimension, Real > &dM, defaulttype::Mat< spatial_dimension, material_dimension, Real > &dQ)
 
Polar
static Real polarDecomposition (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &Q, defaulttype::Mat< 3, 3, Real > &S)
 
static Real polarDecomposition (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &Q)
 
static void polarDecomposition (const defaulttype::Mat< 2, 2, Real > &M, defaulttype::Mat< 2, 2, Real > &Q)
 
static bool polarDecomposition_stable (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &Q, defaulttype::Mat< 3, 3, Real > &S)
 
static bool polarDecomposition_stable (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &Q)
 
static bool polarDecomposition_stable (const defaulttype::Mat< 2, 2, Real > &M, defaulttype::Mat< 2, 2, Real > &Q, defaulttype::Mat< 2, 2, Real > &S)
 
static bool polarDecomposition_stable (const defaulttype::Mat< 2, 2, Real > &M, defaulttype::Mat< 2, 2, Real > &Q)
 
static void polarDecomposition (const defaulttype::Mat< 3, 2, Real > &M, defaulttype::Mat< 3, 2, Real > &Q, defaulttype::Mat< 2, 2, Real > &S)
 
static void polarDecompositionGradient_G (const defaulttype::Mat< 3, 3, Real > &Q, const defaulttype::Mat< 3, 3, Real > &S, defaulttype::Mat< 3, 3, Real > &invG)
 
static void polarDecompositionGradient_dQ (const defaulttype::Mat< 3, 3, Real > &invG, const defaulttype::Mat< 3, 3, Real > &Q, const defaulttype::Mat< 3, 3, Real > &dM, defaulttype::Mat< 3, 3, Real > &dQ)
 
static void polarDecompositionGradient_dQOverdM (const defaulttype::Mat< 3, 3, Real > &Q, const defaulttype::Mat< 3, 3, Real > &invG, defaulttype::Mat< 9, 9, Real > &J)
 
static void polarDecompositionGradient_dQOverdM (const defaulttype::Mat< 3, 3, Real > &Q, const defaulttype::Mat< 3, 3, Real > &Sinv, const defaulttype::Mat< 9, 9, Real > &dSOverdM, defaulttype::Mat< 9, 9, Real > &J)
 
static void polarDecompositionGradient_dS (const defaulttype::Mat< 3, 3, Real > &Q, const defaulttype::Mat< 3, 3, Real > &S, const defaulttype::Mat< 3, 3, Real > &dQ, const defaulttype::Mat< 3, 3, Real > &dM, defaulttype::Mat< 3, 3, Real > &dS)
 
static void polarDecompositionGradient_dSOverdM (const defaulttype::Mat< 3, 3, Real > &Q, const defaulttype::Mat< 3, 3, Real > &M, const defaulttype::Mat< 3, 3, Real > &invG, defaulttype::Mat< 9, 9, Real > &J)
 
static void polarDecompositionGradient_dSOverdM (const defaulttype::Mat< 3, 3, Real > &M, const defaulttype::Mat< 3, 3, Real > &S, defaulttype::Mat< 9, 9, Real > &J)
 
static bool polarDecomposition_stable_Gradient_dQ (const defaulttype::Mat< 3, 3, Real > &U, const defaulttype::Vec< 3, Real > &Sdiag, const defaulttype::Mat< 3, 3, Real > &V, const defaulttype::Mat< 3, 3, Real > &dM, defaulttype::Mat< 3, 3, Real > &dQ)
 
static bool polarDecomposition_stable_Gradient_dQOverdM (const defaulttype::Mat< 3, 3, Real > &U, const defaulttype::Vec< 3, Real > &Sdiag, const defaulttype::Mat< 3, 3, Real > &V, defaulttype::Mat< 9, 9, Real > &dQOverdM)
 
static bool polarDecompositionGradient_dQ (const defaulttype::Mat< 3, 2, Real > &U, const defaulttype::Vec< 2, Real > &Sdiag, const defaulttype::Mat< 2, 2, Real > &V, const defaulttype::Mat< 3, 2, Real > &dM, defaulttype::Mat< 3, 2, Real > &dQ)
 
static bool polarDecompositionGradient_dQOverdM (const defaulttype::Mat< 3, 2, Real > &U, const defaulttype::Vec< 2, Real > &Sdiag, const defaulttype::Mat< 2, 2, Real > &V, defaulttype::Mat< 6, 6, Real > &dQOverdM)
 
Eigen Decomposition
static void eigenDecomposition (const defaulttype::Mat< 3, 3, Real > &A, defaulttype::Mat< 3, 3, Real > &V, defaulttype::Vec< 3, Real > &diag)
 
static void eigenDecomposition (const defaulttype::Mat< 2, 2, Real > &A, defaulttype::Mat< 2, 2, Real > &V, defaulttype::Vec< 2, Real > &diag)
 
static void eigenDecomposition_iterative (const defaulttype::Mat< 3, 3, Real > &M, defaulttype::Mat< 3, 3, Real > &V, defaulttype::Vec< 3, Real > &diag)
 
static void eigenDecomposition_iterative (const defaulttype::Mat< 2, 2, Real > &M, defaulttype::Mat< 2, 2, Real > &V, defaulttype::Vec< 2, Real > &diag)
 
SVD
static void SVD (const defaulttype::Mat< 3, 3, Real > &F, defaulttype::Mat< 3, 3, Real > &U, defaulttype::Vec< 3, Real > &S, defaulttype::Mat< 3, 3, Real > &V)
 
static bool SVD_stable (const defaulttype::Mat< 3, 3, Real > &F, defaulttype::Mat< 3, 3, Real > &U, defaulttype::Vec< 3, Real > &S, defaulttype::Mat< 3, 3, Real > &V)
 
static bool SVD_stable (const defaulttype::Mat< 2, 2, Real > &F, defaulttype::Mat< 2, 2, Real > &U, defaulttype::Vec< 2, Real > &S, defaulttype::Mat< 2, 2, Real > &V)
 
static void SVD (const defaulttype::Mat< 3, 2, Real > &F, defaulttype::Mat< 3, 2, Real > &U, defaulttype::Vec< 2, Real > &S, defaulttype::Mat< 2, 2, Real > &V)
 
static bool SVD_stable (const defaulttype::Mat< 3, 2, Real > &F, defaulttype::Mat< 3, 2, Real > &U, defaulttype::Vec< 2, Real > &S, defaulttype::Mat< 2, 2, Real > &V)
 
static bool SVDGradient_dUdV (const defaulttype::Mat< 3, 3, Real > &U, const defaulttype::Vec< 3, Real > &S, const defaulttype::Mat< 3, 3, Real > &V, const defaulttype::Mat< 3, 3, Real > &dM, defaulttype::Mat< 3, 3, Real > &dU, defaulttype::Mat< 3, 3, Real > &dV)
 
static bool SVDGradient_dUdVOverdM (const defaulttype::Mat< 3, 3, Real > &U, const defaulttype::Vec< 3, Real > &S, const defaulttype::Mat< 3, 3, Real > &V, defaulttype::Mat< 9, 9, Real > &dUOverdM, defaulttype::Mat< 9, 9, Real > &dVOverdM)
 
static bool SVDGradient_dUdV (const defaulttype::Mat< 3, 2, Real > &U, const defaulttype::Vec< 2, Real > &S, const defaulttype::Mat< 2, 2, Real > &V, const defaulttype::Mat< 3, 2, Real > &dM, defaulttype::Mat< 3, 2, Real > &dU, defaulttype::Mat< 2, 2, Real > &dV)
 
static bool SVDGradient_dUdVOverdM (const defaulttype::Mat< 3, 2, Real > &U, const defaulttype::Vec< 2, Real > &S, const defaulttype::Mat< 2, 2, Real > &V, defaulttype::Mat< 6, 6, Real > &dUOverdM, defaulttype::Mat< 4, 6, Real > &dVOverdM)
 
Diagonalization
static int symmetricDiagonalization (const defaulttype::Mat< 3, 3, Real > &A, defaulttype::Mat< 3, 3, Real > &Q, defaulttype::Vec< 3, Real > &w)
 
static void PSDProjection (defaulttype::Mat< 3, 3, Real > &A)
 project a symmetric 3x3 matrix to a PSD (symmetric, positive semi-definite) More...
 
static void PSDProjection (defaulttype::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 (defaulttype::Mat< 1, 1, Real > &)
 
static void NSDProjection (defaulttype::Mat< 3, 3, Real > &A)
 project a symmetric 3x3 matrix to a NSD (symmetric, negative semi-definite) More...
 
static void NSDProjection (defaulttype::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 (defaulttype::Mat< 1, 1, Real > &)
 

Function details

template<typename Real >
void sofa::helper::Decompose< Real >::eigenDecomposition ( const defaulttype::Mat< 3, 3, Real > &  A,
defaulttype::Mat< 3, 3, Real > &  V,
defaulttype::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
template<typename Real >
void sofa::helper::Decompose< Real >::eigenDecomposition ( const defaulttype::Mat< 2, 2, Real > &  A,
defaulttype::Mat< 2, 2, Real > &  V,
defaulttype::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
template<class Real >
void sofa::helper::Decompose< Real >::eigenDecomposition_iterative ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  V,
defaulttype::Vec< 3, Real > &  diag 
)
static

Eigensystem decomposition: eigenvalues

Parameters
diagand eigenvectors (columns of
V)of the 3x3 Real Matrix
MDerived from Wild Magic Library
template<class Real >
void sofa::helper::Decompose< Real >::eigenDecomposition_iterative ( const defaulttype::Mat< 2, 2, Real > &  M,
defaulttype::Mat< 2, 2, Real > &  V,
defaulttype::Vec< 2, Real > &  diag 
)
static

Eigensystem decomposition: eigenvalues

Parameters
diagand eigenvectors (columns of
V)of the 2x2 Real Matrix
MDerived from Wild Magic Library
template<class Real >
void sofa::helper::Decompose< Real >::getRotation ( defaulttype::Mat< 3, 3, Real > &  r,
defaulttype::Vec< 3, Real > &  edgex,
defaulttype::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.

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

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

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

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

template<class Real >
void sofa::helper::Decompose< Real >::NSDProjection ( Real A00,
Real A01,
Real A10,
Real A11 
)
static
template<class Real >
static void sofa::helper::Decompose< Real >::NSDProjection ( defaulttype::Mat< 1, 1, Real > &  )
inlinestatic
template<class Real >
Real sofa::helper::Decompose< Real >::polarDecomposition ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  Q,
defaulttype::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

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

The same as previous except we do not care about S

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

Polar decomposition of a 2x2 matix 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

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

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

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  Q,
defaulttype::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
template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::Mat< 3, 3, Real > &  Q 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const defaulttype::Mat< 2, 2, Real > &  M,
defaulttype::Mat< 2, 2, Real > &  Q,
defaulttype::Mat< 2, 2, Real > &  S 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable ( const defaulttype::Mat< 2, 2, Real > &  M,
defaulttype::Mat< 2, 2, Real > &  Q 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable_Gradient_dQ ( const defaulttype::Mat< 3, 3, Real > &  U,
const defaulttype::Vec< 3, Real > &  Sdiag,
const defaulttype::Mat< 3, 3, Real > &  V,
const defaulttype::Mat< 3, 3, Real > &  dM,
defaulttype::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

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecomposition_stable_Gradient_dQOverdM ( const defaulttype::Mat< 3, 3, Real > &  U,
const defaulttype::Vec< 3, Real > &  Sdiag,
const defaulttype::Mat< 3, 3, Real > &  V,
defaulttype::Mat< 9, 9, Real > &  dQOverdM 
)
static
template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dQ ( const defaulttype::Mat< 3, 3, Real > &  invG,
const defaulttype::Mat< 3, 3, Real > &  Q,
const defaulttype::Mat< 3, 3, Real > &  dM,
defaulttype::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

template<class Real >
bool sofa::helper::Decompose< Real >::polarDecompositionGradient_dQ ( const defaulttype::Mat< 3, 2, Real > &  U,
const defaulttype::Vec< 2, Real > &  Sdiag,
const defaulttype::Mat< 2, 2, Real > &  V,
const defaulttype::Mat< 3, 2, Real > &  dM,
defaulttype::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

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dQOverdM ( const defaulttype::Mat< 3, 3, Real > &  Q,
const defaulttype::Mat< 3, 3, Real > &  invG,
defaulttype::Mat< 9, 9, Real > &  J 
)
static
template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dQOverdM ( const defaulttype::Mat< 3, 3, Real > &  Q,
const defaulttype::Mat< 3, 3, Real > &  Sinv,
const defaulttype::Mat< 9, 9, Real > &  dSOverdM,
defaulttype::Mat< 9, 9, Real > &  J 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::polarDecompositionGradient_dQOverdM ( const defaulttype::Mat< 3, 2, Real > &  U,
const defaulttype::Vec< 2, Real > &  Sdiag,
const defaulttype::Mat< 2, 2, Real > &  V,
defaulttype::Mat< 6, 6, Real > &  dQOverdM 
)
static
template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dS ( const defaulttype::Mat< 3, 3, Real > &  Q,
const defaulttype::Mat< 3, 3, Real > &  S,
const defaulttype::Mat< 3, 3, Real > &  dQ,
const defaulttype::Mat< 3, 3, Real > &  dM,
defaulttype::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

template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dSOverdM ( const defaulttype::Mat< 3, 3, Real > &  Q,
const defaulttype::Mat< 3, 3, Real > &  M,
const defaulttype::Mat< 3, 3, Real > &  invG,
defaulttype::Mat< 9, 9, Real > &  J 
)
static
template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_dSOverdM ( const defaulttype::Mat< 3, 3, Real > &  M,
const defaulttype::Mat< 3, 3, Real > &  S,
defaulttype::Mat< 9, 9, Real > &  J 
)
static
template<class Real >
void sofa::helper::Decompose< Real >::polarDecompositionGradient_G ( const defaulttype::Mat< 3, 3, Real > &  Q,
const defaulttype::Mat< 3, 3, Real > &  S,
defaulttype::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

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

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

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

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

template<class Real >
void sofa::helper::Decompose< Real >::PSDProjection ( Real A00,
Real A01,
Real A10,
Real A11 
)
static
template<class Real >
static void sofa::helper::Decompose< Real >::PSDProjection ( defaulttype::Mat< 1, 1, Real > &  )
inlinestatic
template<class Real >
void sofa::helper::Decompose< Real >::QRDecomposition ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::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.

template<class Real >
void sofa::helper::Decompose< Real >::QRDecomposition ( const defaulttype::Mat< 3, 2, Real > &  M,
defaulttype::Mat< 3, 2, Real > &  R 
)
static
template<class Real >
void sofa::helper::Decompose< Real >::QRDecomposition ( const defaulttype::Mat< 2, 2, Real > &  M,
defaulttype::Mat< 2, 2, Real > &  R 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::QRDecomposition_stable ( const defaulttype::Mat< 3, 3, Real > &  M,
defaulttype::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
template<class Real >
bool sofa::helper::Decompose< Real >::QRDecomposition_stable ( const defaulttype::Mat< 3, 2, Real > &  M,
defaulttype::Mat< 3, 2, Real > &  R 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::QRDecomposition_stable ( const defaulttype::Mat< 2, 2, Real > &  M,
defaulttype::Mat< 2, 2, Real > &  R 
)
static
template<class Real >
template<std::size_t spatial_dimension, std::size_t material_dimension>
static void sofa::helper::Decompose< Real >::QRDecompositionGradient_dQ ( const defaulttype::Mat< spatial_dimension, material_dimension, Real > &  Q,
const defaulttype::Mat< material_dimension, material_dimension, Real > &  invR,
const defaulttype::Mat< spatial_dimension, material_dimension, Real > &  dM,
defaulttype::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.

template<class Real >
void sofa::helper::Decompose< Real >::SVD ( const defaulttype::Mat< 3, 3, Real > &  F,
defaulttype::Mat< 3, 3, Real > &  U,
defaulttype::Vec< 3, Real > &  S,
defaulttype::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

template<class Real >
void sofa::helper::Decompose< Real >::SVD ( const defaulttype::Mat< 3, 2, Real > &  F,
defaulttype::Mat< 3, 2, Real > &  U,
defaulttype::Vec< 2, Real > &  S,
defaulttype::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

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

SVD based on the Eigensystem decomposition of FtF with robustness against invertion 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
template<class Real >
bool sofa::helper::Decompose< Real >::SVD_stable ( const defaulttype::Mat< 2, 2, Real > &  F,
defaulttype::Mat< 2, 2, Real > &  U,
defaulttype::Vec< 2, Real > &  S,
defaulttype::Mat< 2, 2, Real > &  V 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::SVD_stable ( const defaulttype::Mat< 3, 2, Real > &  F,
defaulttype::Mat< 3, 2, Real > &  U,
defaulttype::Vec< 2, Real > &  S,
defaulttype::Mat< 2, 2, Real > &  V 
)
static

SVD based on the Eigensystem decomposition of FtF with robustness against invertion 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
template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdV ( const defaulttype::Mat< 3, 3, Real > &  U,
const defaulttype::Vec< 3, Real > &  S,
const defaulttype::Mat< 3, 3, Real > &  V,
const defaulttype::Mat< 3, 3, Real > &  dM,
defaulttype::Mat< 3, 3, Real > &  dU,
defaulttype::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

template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdV ( const defaulttype::Mat< 3, 2, Real > &  U,
const defaulttype::Vec< 2, Real > &  S,
const defaulttype::Mat< 2, 2, Real > &  V,
const defaulttype::Mat< 3, 2, Real > &  dM,
defaulttype::Mat< 3, 2, Real > &  dU,
defaulttype::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

template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdVOverdM ( const defaulttype::Mat< 3, 3, Real > &  U,
const defaulttype::Vec< 3, Real > &  S,
const defaulttype::Mat< 3, 3, Real > &  V,
defaulttype::Mat< 9, 9, Real > &  dUOverdM,
defaulttype::Mat< 9, 9, Real > &  dVOverdM 
)
static
template<class Real >
bool sofa::helper::Decompose< Real >::SVDGradient_dUdVOverdM ( const defaulttype::Mat< 3, 2, Real > &  U,
const defaulttype::Vec< 2, Real > &  S,
const defaulttype::Mat< 2, 2, Real > &  V,
defaulttype::Mat< 6, 6, Real > &  dUOverdM,
defaulttype::Mat< 4, 6, Real > &  dVOverdM 
)
static
template<class Real >
int sofa::helper::Decompose< Real >::symmetricDiagonalization ( const defaulttype::Mat< 3, 3, Real > &  A,
defaulttype::Mat< 3, 3, Real > &  Q,
defaulttype::Vec< 3, Real > &  w 
)
static

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

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

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

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