SPH
Classes | Functions
SymmetricTensor.h File Reference

Basic algebra for symmetric 2nd order tensors. More...

#include "math/AffineMatrix.h"
#include "objects/containers/StaticArray.h"

Go to the source code of this file.

Classes

class  SymmetricTensor
 Symmetric tensor of 2nd order. More...
 
struct  Eigen
 
struct  Svd
 

Functions

INLINE SymmetricTensor transform (const SymmetricTensor &t, const AffineMatrix &transform)
 
template<typename T1 , typename T2 >
T1 convert (const T2 &matrix)
 
template<>
INLINE SymmetricTensor convert (const AffineMatrix &matrix)
 
template<>
INLINE AffineMatrix convert (const SymmetricTensor &t)
 
INLINE bool almostEqual (const SymmetricTensor &t1, const SymmetricTensor &t2, const Float eps=EPS)
 Tensor utils. More...
 
template<>
INLINE Float norm (const SymmetricTensor &t)
 
template<>
INLINE Float normSqr (const SymmetricTensor &t)
 Arbitrary squared norm of the tensor. More...
 
template<>
INLINE auto abs (const SymmetricTensor &t)
 Returns the tensor of absolute values. More...
 
template<>
INLINE Float minElement (const SymmetricTensor &t)
 Returns the minimal element of the tensor. More...
 
template<>
INLINE Float maxElement (const SymmetricTensor &t)
 Returns the maximal element of the tensor. More...
 
template<>
INLINE SymmetricTensor min (const SymmetricTensor &t1, const SymmetricTensor &t2)
 Component-wise minimum of two tensors. More...
 
template<>
INLINE SymmetricTensor max (const SymmetricTensor &t1, const SymmetricTensor &t2)
 Component-wise maximum of two tensors. More...
 
template<>
INLINE SymmetricTensor clamp (const SymmetricTensor &t, const Interval &range)
 Clamping all components by range. More...
 
template<>
INLINE bool isReal (const SymmetricTensor &t)
 
template<>
INLINE auto less (const SymmetricTensor &t1, const SymmetricTensor &t2)
 
template<>
INLINE StaticArray< Float, 6 > getComponents (const SymmetricTensor &t)
 
INLINE Float ddot (const SymmetricTensor &t1, const SymmetricTensor &t2)
 Double-dot product t1 : t2 = sum_ij t1_ij t2_ij. More...
 
INLINE SymmetricTensor symmetricOuter (const Vector &v1, const Vector &v2)
 SYMMETRIZED outer product of two vectors. More...
 
INLINE StaticArray< Float, 3 > findEigenvalues (const SymmetricTensor &t)
 Returns three eigenvalue of symmetric matrix. More...
 
Eigen eigenDecomposition (const SymmetricTensor &t)
 Computes eigenvectors and corresponding eigenvalues of symmetric matrix. More...
 
Svd singularValueDecomposition (const SymmetricTensor &t)
 Computes the singular value decomposition of symmetric matrix. More...
 

Detailed Description

Basic algebra for symmetric 2nd order tensors.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)
Date
2016-2021

Definition in file SymmetricTensor.h.

Function Documentation

◆ abs()

template<>
INLINE auto abs ( const SymmetricTensor t)

Returns the tensor of absolute values.

Definition at line 304 of file SymmetricTensor.h.

◆ almostEqual()

INLINE bool almostEqual ( const SymmetricTensor t1,
const SymmetricTensor t2,
const Float  eps = EPS 
)

Tensor utils.

Checks if two tensors are equal to some given accuracy.

Definition at line 279 of file SymmetricTensor.h.

◆ clamp()

template<>
INLINE SymmetricTensor clamp ( const SymmetricTensor t,
const Interval range 
)

Clamping all components by range.

Definition at line 334 of file SymmetricTensor.h.

◆ convert() [1/3]

template<>
INLINE SymmetricTensor convert ( const AffineMatrix matrix)

Definition at line 257 of file SymmetricTensor.h.

◆ convert() [2/3]

template<>
INLINE AffineMatrix convert ( const SymmetricTensor t)

Definition at line 266 of file SymmetricTensor.h.

◆ convert() [3/3]

template<typename T1 , typename T2 >
T1 convert ( const T2 &  matrix)

◆ ddot()

INLINE Float ddot ( const SymmetricTensor t1,
const SymmetricTensor t2 
)

Double-dot product t1 : t2 = sum_ij t1_ij t2_ij.

Definition at line 354 of file SymmetricTensor.h.

◆ eigenDecomposition()

Eigen eigenDecomposition ( const SymmetricTensor t)

Computes eigenvectors and corresponding eigenvalues of symmetric matrix.

Definition at line 249 of file SymmetricTensor.cpp.

◆ findEigenvalues()

INLINE StaticArray<Float, 3> findEigenvalues ( const SymmetricTensor t)

Returns three eigenvalue of symmetric matrix.

Definition at line 370 of file SymmetricTensor.h.

◆ getComponents()

template<>
INLINE StaticArray<Float, 6> getComponents ( const SymmetricTensor t)

Definition at line 349 of file SymmetricTensor.h.

◆ isReal()

template<>
INLINE bool isReal ( const SymmetricTensor t)

Definition at line 339 of file SymmetricTensor.h.

◆ less()

template<>
INLINE auto less ( const SymmetricTensor t1,
const SymmetricTensor t2 
)

Definition at line 344 of file SymmetricTensor.h.

◆ max()

template<>
INLINE SymmetricTensor max ( const SymmetricTensor t1,
const SymmetricTensor t2 
)

Component-wise maximum of two tensors.

Definition at line 328 of file SymmetricTensor.h.

◆ maxElement()

template<>
INLINE Float maxElement ( const SymmetricTensor t)

Returns the maximal element of the tensor.

Definition at line 316 of file SymmetricTensor.h.

◆ min()

template<>
INLINE SymmetricTensor min ( const SymmetricTensor t1,
const SymmetricTensor t2 
)

Component-wise minimum of two tensors.

Definition at line 322 of file SymmetricTensor.h.

◆ minElement()

template<>
INLINE Float minElement ( const SymmetricTensor t)

Returns the minimal element of the tensor.

Definition at line 310 of file SymmetricTensor.h.

◆ norm()

template<>
INLINE Float norm ( const SymmetricTensor t)

Arbitrary norm of the tensor.

Note
This norm is NOT an invariant.
Todo:
Use some well-defined norm instead? (spectral norm, L1 or L2 norm, ...)

Definition at line 289 of file SymmetricTensor.h.

◆ normSqr()

template<>
INLINE Float normSqr ( const SymmetricTensor t)

Arbitrary squared norm of the tensor.

Definition at line 297 of file SymmetricTensor.h.

◆ singularValueDecomposition()

Svd singularValueDecomposition ( const SymmetricTensor t)

Computes the singular value decomposition of symmetric matrix.

Definition at line 526 of file SymmetricTensor.cpp.

◆ symmetricOuter()

INLINE SymmetricTensor symmetricOuter ( const Vector v1,
const Vector v2 
)

SYMMETRIZED outer product of two vectors.

Note that simple outer product is not necessarily symmetric matrix.

Todo:
optimize

Definition at line 361 of file SymmetricTensor.h.

◆ transform()

INLINE SymmetricTensor transform ( const SymmetricTensor t,
const AffineMatrix transform 
)

Transforms given symmetric tensor by matrix.

Todo:
optimize

Definition at line 244 of file SymmetricTensor.h.