GEOSX
Variables
LvArray::tensorOps Namespace Reference

Contains operations for operating on compile time sized vectors and matrices. More...

Functions

Fixed size square matrix operations

Functions that are overloaded to operate square matrices of a fixed size.

Note
Currently all functions only support matrices of sizes 2x2 and 3x3.
template<std::ptrdiff_t M, typename MATRIX >
constexpr auto determinant (MATRIX const &matrix)
 
template<std::ptrdiff_t M, typename DST_MATRIX , typename SRC_MATRIX >
constexpr auto invert (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, SRC_MATRIX const &LVARRAY_RESTRICT_REF srcMatrix)
 Invert the source matrix srcMatrix and store the result in dstMatrix. More...
 
template<std::ptrdiff_t M, typename MATRIX >
constexpr auto invert (MATRIX &&matrix)
 Invert the matrix matrix overwritting it. More...
 
Fixed size symmetric matrix operations

Functions that are overloaded to operate symmetric matrices of a fixed size.

Note
Currently all functions only support matrices of sizes 2x2 and 3x3.
template<std::ptrdiff_t M, typename DST_VECTOR , typename SYM_MATRIX_A , typename VECTOR_B >
constexpr void Ri_eq_symAijBj (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SYM_MATRIX_A const &LVARRAY_RESTRICT_REF symMatrixA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Multiply the vector vectorB by the symmetric matrix symMatrixA and store the result in dstVector. More...
 
template<std::ptrdiff_t M, typename DST_VECTOR , typename SYM_MATRIX_A , typename VECTOR_B >
constexpr void Ri_add_symAijBj (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SYM_MATRIX_A const &LVARRAY_RESTRICT_REF symMatrixA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Multiply the vector vectorB by the symmetric matrix symMatrixA and add the result to dstVector. More...
 
template<std::ptrdiff_t M, typename DST_MATRIX , typename SYM_MATRIX_A , typename MATRIX_B >
constexpr void Rij_eq_symAikBjk (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, SYM_MATRIX_A const &LVARRAY_RESTRICT_REF symMatrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply the transpose of matrix matrixB by the symmetric matrix symMatrixA and store the result in dstMatrix. More...
 
template<std::ptrdiff_t M, typename DST_SYM_MATRIX , typename MATRIX_A , typename SYM_MATRIX_B >
constexpr void Rij_eq_AikSymBklAjl (DST_SYM_MATRIX &&LVARRAY_RESTRICT_REF dstSymMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, SYM_MATRIX_B const &LVARRAY_RESTRICT_REF symMatrixB)
 Multiply the transpose of matrix matrixA by the symmetric matrix symMatrixB then by matrixA and store the result in dstSymMatrix. More...
 
template<std::ptrdiff_t M, typename SYM_MATRIX >
constexpr auto symDeterminant (SYM_MATRIX const &symMatrix)
 
template<std::ptrdiff_t M, typename DST_SYM_MATRIX , typename SRC_SYM_MATRIX >
constexpr auto symInvert (DST_SYM_MATRIX &&LVARRAY_RESTRICT_REF dstSymMatrix, SRC_SYM_MATRIX const &LVARRAY_RESTRICT_REF srcSymMatrix)
 Invert the symmetric matrix srcSymMatrix and store the result in dstSymMatrix. More...
 
template<std::ptrdiff_t M, typename SYM_MATRIX >
constexpr auto symInvert (SYM_MATRIX &&symMatrix)
 Invert the symmetric matrix symMatrix overwritting it. More...
 
template<std::ptrdiff_t M, typename DST_VECTOR , typename SYM_MATRIX >
constexpr void symEigenvalues (DST_VECTOR &&LVARRAY_RESTRICT_REF eigenvalues, SYM_MATRIX const &LVARRAY_RESTRICT_REF symMatrix)
 Compute the eigenvalues of the symmetric matrix symMatrix. More...
 
template<std::ptrdiff_t M, typename DST_VECTOR , typename DST_MATRIX , typename SYM_MATRIX >
constexpr void symEigenvectors (DST_VECTOR &&LVARRAY_RESTRICT_REF eigenvalues, DST_MATRIX &&LVARRAY_RESTRICT_REF eigenvectors, SYM_MATRIX const &LVARRAY_RESTRICT_REF symMatrix)
 Compute the eigenvalues and eigenvectors of the symmetric matrix symMatrix. More...
 
template<std::ptrdiff_t M, typename DST_SYM_MATRIX , typename SRC_MATRIX >
constexpr void denseToSymmetric (DST_SYM_MATRIX &&dstSymMatrix, SRC_MATRIX const &srcMatrix)
 Convert the upper triangular part of srcMatrix to a symmetric matrix. More...
 
template<std::ptrdiff_t M, typename DST_MATRIX , typename SRC_SYM_MATRIX >
constexpr void symmetricToDense (DST_MATRIX &&dstMatrix, SRC_SYM_MATRIX const &srcSymMatrix)
 Convert the srcSymMatrix into a dense matrix. More...
 
Generic operations

Functions that are overloaded to operate on both vectors and matrices.

Note
Not all of the functions have been overloaded to operate on both vectors and matrices.
template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto maxAbsoluteEntry (VECTOR &&vector)
 
template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr void fill (VECTOR &&vector, std::remove_reference_t< decltype(vector[0]) > const value)
 Set the entries of vector to value. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename MATRIX >
constexpr void fill (MATRIX &&matrix, std::remove_reference_t< decltype(matrix[0][0]) > const value)
 Set the entries of matrix to value. More...
 
template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void copy (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SRC_VECTOR const &LVARRAY_RESTRICT_REF srcVector)
 Copy srcVector into dstVector. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void copy (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, SRC_MATRIX const &LVARRAY_RESTRICT_REF srcMatrix)
 Copy srcMatrix into dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr void scale (VECTOR &&vector, std::remove_reference_t< decltype(vector[0]) > const scale)
 Multiply the entries of vector by scale. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename MATRIX >
constexpr void scale (MATRIX &&matrix, std::remove_reference_t< decltype(matrix[0][0]) > const scale)
 Multiply the entries of matrix by scale. More...
 
template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void scaledCopy (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SRC_VECTOR const &LVARRAY_RESTRICT_REF srcVector, std::remove_reference_t< decltype(srcVector[0]) > const scale)
 Copy srcVector scaled by scale into dstVector. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void scaledCopy (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, SRC_MATRIX const &LVARRAY_RESTRICT_REF srcMatrix, std::remove_reference_t< decltype(srcMatrix[0][0]) > const scale)
 Copy srcMatrix scaled by scale into dstMatrix. More...
 
template<std::ptrdiff_t M, typename DST_VECTOR >
constexpr void addScalar (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, std::remove_reference_t< decltype(dstVector[0]) > const value)
 Add value to dstVector. More...
 
template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void add (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SRC_VECTOR const &LVARRAY_RESTRICT_REF srcVector)
 Add srcVector to dstVector. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void add (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, SRC_MATRIX const &LVARRAY_RESTRICT_REF srcMatrix)
 Add srcMatrix to dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void subtract (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SRC_VECTOR const &LVARRAY_RESTRICT_REF srcVector)
 Subtract srcVector from dstVector. More...
 
template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void scaledAdd (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, SRC_VECTOR const &LVARRAY_RESTRICT_REF srcVector, std::remove_reference_t< decltype(srcVector[0]) > const scale)
 Add srcVector scaled by scale to dstVector. More...
 
template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename VECTOR_A , typename VECTOR_B >
constexpr void hadamardProduct (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, VECTOR_A const &LVARRAY_RESTRICT_REF vectorA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Multiply the elements of vectorA and vectorB putting the result into dstVector. More...
 
Vector operations

Functions that operate on vectors.

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto l2NormSquared (VECTOR const &vector)
 
template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto l2Norm (VECTOR const &vector)
 
template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto normalize (VECTOR &&vector)
 Scale vector to a unit vector. More...
 
template<std::ptrdiff_t JSIZE, typename VECTOR_A , typename VECTOR_B >
constexpr auto AiBi (VECTOR_A const &LVARRAY_RESTRICT_REF vectorA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 
template<typename DST_VECTOR , typename VECTOR_A , typename VECTOR_B >
constexpr void crossProduct (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, VECTOR_A const &LVARRAY_RESTRICT_REF vectorA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Compute the cross product of vectorA and vectorB and put it in dstVector. More...
 
Matrix-vector operations

Functions that operate on matrices and vectors.

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename VECTOR_A , typename VECTOR_B >
constexpr void Rij_eq_AiBj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, VECTOR_A const &LVARRAY_RESTRICT_REF vectorA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Perform the outer product of vectorA and vectorB writing the result to dstMatrix. More...
 
template<std::ptrdiff_t M, typename DST_MATRIX , typename VECTOR_A >
constexpr void Rij_eq_AiAj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, VECTOR_A const &LVARRAY_RESTRICT_REF vectorA)
 Perform the outer product of vectorA with itself writing the result to dstMatrix. More...
 
template<std::ptrdiff_t JSIZE, std::ptrdiff_t ISIZE, typename DST_MATRIX , typename VECTOR_A , typename VECTOR_B >
constexpr void Rij_add_AiBj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, VECTOR_A const &LVARRAY_RESTRICT_REF vectorA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Perform the outer product of vectorA and vectorB adding the result to dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void Ri_eq_AijBj (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Perform the matrix vector multiplication of matrixA and vectorB writing the result to dstVector. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void Ri_add_AijBj (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Perform the matrix vector multiplication of matrixA and vectorB adding the result to dstVector. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void Ri_eq_AjiBj (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Perform the matrix vector multiplication of the transpose of matrixA and vectorB writing the result to dstVector. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void Ri_add_AjiBj (DST_VECTOR &&LVARRAY_RESTRICT_REF dstVector, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, VECTOR_B const &LVARRAY_RESTRICT_REF vectorB)
 Perform the matrix vector multiplication of the transpose of matrixA and vectorB adding the result to dstVector. More...
 
Matrix operations

Functions that operate matrices of any shape.

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void transpose (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, SRC_MATRIX const &LVARRAY_RESTRICT_REF srcMatrix)
 Store the transpose of the NxM matrix srcMatrix in dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void Rij_eq_AikBkj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply matrixA with matrixB and put the result into dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void Rij_add_AikBkj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply matrixA with matrixB and add the result to dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void Rij_eq_AikBjk (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply matrixA with the transpose of matrixB and put the result into dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void Rij_add_AikBjk (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply matrixA with the transpose of matrixB and put the result into dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename MATRIX_A >
constexpr void Rij_add_AikAjk (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA)
 Multiply matrixA with the transpose of itself and put the result into dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void Rij_eq_AkiBkj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply the transpose of matrixA with matrixB and put the result into dstMatrix. More...
 
template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void Rij_add_AkiBkj (DST_MATRIX &&LVARRAY_RESTRICT_REF dstMatrix, MATRIX_A const &LVARRAY_RESTRICT_REF matrixA, MATRIX_B const &LVARRAY_RESTRICT_REF matrixB)
 Multiply the transpose of matrixA with matrixB and add the result into dstMatrix. More...
 
Square matrix operations

Functions that operate on square matrices of any size.

template<std::ptrdiff_t ISIZE, typename MATRIX >
constexpr void transpose (MATRIX &&LVARRAY_RESTRICT_REF matrix)
 Transpose the MxM matrix matrix. More...
 
template<std::ptrdiff_t ISIZE, typename MATRIX >
constexpr void addIdentity (MATRIX &&matrix, std::remove_reference_t< decltype(matrix[0][0]) > const scale)
 Add scale times the identity matrix to matrix. More...
 
template<std::ptrdiff_t ISIZE, typename MATRIX >
constexpr auto trace (MATRIX const &matrix)
 
Symmetric matrix operations

Functions that operate on symmetric matrices of any size.

template<std::ptrdiff_t ISIZE, typename SYM_MATRIX >
constexpr void symAddIdentity (SYM_MATRIX &&symMatrix, std::remove_reference_t< decltype(symMatrix[0]) > const scale)
 Add scale times the identity matrix to symMatrix. More...
 
template<std::ptrdiff_t ISIZE, typename SYM_MATRIX >
constexpr auto symTrace (SYM_MATRIX const &symMatrix)
 

Variables

template<std::ptrdiff_t ISIZE>
constexpr std::ptrdiff_t SYM_SIZE = ( ISIZE * ( ISIZE + 1 ) ) / 2
 The size of a symmetric MxM matrix in Voigt notation.
 

Detailed Description

Contains operations for operating on compile time sized vectors and matrices.

LvArray::tensorOps functions accept four differnet types of arguments

  1. Scalars
  2. Vectors: These can either be a one dimensional c-array such as double[ 3 ] or a one dimensional LvArray::Array, LvArray::ArrayView, or LvArray::ArraySlice.
  3. Matrices: These can either be a two dimensional c-array such as int[ 5 ][ 2 ] or a two dimensional LvArray::Array, LvArray::ArrayView, or LvArray::ArraySlice.
  4. Symmetric matrices: These are represented in Voigt notation as a vector.

Each function takes in the size of the objects as template parameters. As an example to take the dot product of two vectors of length 3 you'd call

LvArray::tensorOps::AiBi< 3 >( x, y )

Function Documentation

◆ add() [1/2]

template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void LvArray::tensorOps::add ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SRC_VECTOR const &LVARRAY_RESTRICT_REF  srcVector 
)
inline

Add srcVector to dstVector.

Template Parameters
ISIZEThe length of dstVector and srcVector.
DST_VECTORThe type of dstVector.
SRC_VECTORThe type of srcVector.
Parameters
dstVectorThe destination vector, of length M.
srcVectorThe source vector, of length M.

Performs the operation

dstVector[ i ] += srcVector[ i ]

Definition at line 524 of file genericTensorOps.hpp.

◆ add() [2/2]

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void LvArray::tensorOps::add ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
SRC_MATRIX const &LVARRAY_RESTRICT_REF  srcMatrix 
)
inline

Add srcMatrix to dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and srcMatrix.
JSIZEThe size of the second dimension of dstMatrix and srcMatrix.
DST_MATRIXThe type of dstMatrix.
SRC_MATRIXThe type of srcMatrix.
Parameters
dstMatrixThe destination matrix, of size ISIZE x N.
srcMatrixThe source matrix, of size ISIZE x N.

Performs the operation

dstMatrix[ i ][ j ] += srcMatrix[ i ][ j ]

Definition at line 549 of file genericTensorOps.hpp.

◆ addIdentity()

template<std::ptrdiff_t ISIZE, typename MATRIX >
constexpr void LvArray::tensorOps::addIdentity ( MATRIX &&  matrix,
std::remove_reference_t< decltype(matrix[0][0]) > const  scale 
)
inline

Add scale times the identity matrix to matrix.

Template Parameters
ISIZEThe size of matrix.
MATRIXThe type of matrix.
Parameters
matrixThe ISIZE x ISIZE matrix to add the identity matrix to.
scaleThe amount to scale the identity matrix by.

Performs the operations

matrix[ i ][ i ] += scale

Definition at line 1379 of file genericTensorOps.hpp.

◆ addScalar()

template<std::ptrdiff_t M, typename DST_VECTOR >
constexpr void LvArray::tensorOps::addScalar ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
std::remove_reference_t< decltype(dstVector[0]) > const  value 
)
inline

Add value to dstVector.

Template Parameters
MThe length of dstVector.
DST_VECTORThe type of dstVector.
Parameters
dstVectorThe destination vector, of length M.
valueThe value to add.

Performs the operation

dstVector[ i ] += value

Definition at line 501 of file genericTensorOps.hpp.

◆ AiBi()

template<std::ptrdiff_t JSIZE, typename VECTOR_A , typename VECTOR_B >
constexpr auto LvArray::tensorOps::AiBi ( VECTOR_A const &LVARRAY_RESTRICT_REF  vectorA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline
Returns
Return the inner product of vectorA and vectorB.
Template Parameters
ISIZEThe length of vectorA and vectorB.
VECTOR_AThe type of vectorA.
VECTOR_BThe type of vectorB.
Parameters
vectorAThe first vector in the inner product, of length M.
vectorBThe second vector in the inner product, of length M.

Definition at line 718 of file genericTensorOps.hpp.

◆ copy() [1/2]

template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void LvArray::tensorOps::copy ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SRC_VECTOR const &LVARRAY_RESTRICT_REF  srcVector 
)
inline

Copy srcVector into dstVector.

Template Parameters
ISIZEThe length of dstVector and srcVector.
DST_VECTORThe type of dstVector.
SRC_VECTORThe type of srcVector.
Parameters
dstVectorThe destination vector, of length ISIZE.
srcVectorThe source vector, of length ISIZE.

Performs the operation

dstVector[ i ] = srcVector[ i ]

Definition at line 345 of file genericTensorOps.hpp.

◆ copy() [2/2]

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void LvArray::tensorOps::copy ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
SRC_MATRIX const &LVARRAY_RESTRICT_REF  srcMatrix 
)
inline

Copy srcMatrix into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and srcMatrix.
JSIZEThe size of the second dimension of dstMatrix and srcMatrix.
DST_MATRIXThe type of dstMatrix.
SRC_MATRIXThe type of srcMatrix.
Parameters
dstMatrixThe destination matrix, of size ISIZE x N.
srcMatrixThe source matrix, of size ISIZE x N.

Performs the operation

dstMatrix[ i ][ j ] = srcMatrix[ i ][ j ]

Definition at line 370 of file genericTensorOps.hpp.

◆ crossProduct()

template<typename DST_VECTOR , typename VECTOR_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::crossProduct ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
VECTOR_A const &LVARRAY_RESTRICT_REF  vectorA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Compute the cross product of vectorA and vectorB and put it in dstVector.

Template Parameters
DST_VECTORThe type of dstVector.
VECTOR_AThe type of vectorA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector to write the cross product to, of length 3.
vectorAThe first vector in the cross product, of length 3.
vectorBTHe second vector in the cross product, of length 3.

Definition at line 745 of file genericTensorOps.hpp.

◆ denseToSymmetric()

template<std::ptrdiff_t M, typename DST_SYM_MATRIX , typename SRC_MATRIX >
constexpr void LvArray::tensorOps::denseToSymmetric ( DST_SYM_MATRIX &&  dstSymMatrix,
SRC_MATRIX const &  srcMatrix 
)
inline

Convert the upper triangular part of srcMatrix to a symmetric matrix.

Template Parameters
MThe size of dstSymMatrix and srcMatrix.
DST_SYM_MATRIXThe type of dstSymMatrix.
SRC_MATRIXThe type of srcMatrix.
Parameters
dstSymMatrixThe resulting MxM symmetric matrix.
srcMatrixThe MxM matrix to convert to a symmetric matrix.

Definition at line 292 of file fixedSizeSquareMatrixOps.hpp.

◆ determinant()

template<std::ptrdiff_t M, typename MATRIX >
constexpr auto LvArray::tensorOps::determinant ( MATRIX const &  matrix)
inline
Returns
Return the determinant of the matrix matrix.
Template Parameters
MThe size of matrix.
MATRIXThe type of matrix.
Parameters
matrixThe M x M matrix to get the determinant of.

Definition at line 38 of file fixedSizeSquareMatrixOps.hpp.

◆ fill() [1/2]

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr void LvArray::tensorOps::fill ( VECTOR &&  vector,
std::remove_reference_t< decltype(vector[0]) > const  value 
)
inline

Set the entries of vector to value.

Template Parameters
ISIZEThe size of vector.
VECTORThe type of vector.
Parameters
vectorThe vector to set the entries of, of length M.
valueThe value to set the entries to.

Performs the operation

vector[ i ] = value

Definition at line 297 of file genericTensorOps.hpp.

◆ fill() [2/2]

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename MATRIX >
constexpr void LvArray::tensorOps::fill ( MATRIX &&  matrix,
std::remove_reference_t< decltype(matrix[0][0]) > const  value 
)
inline

Set the entries of matrix to value.

Template Parameters
ISIZEThe size of the first dimension of matrix.
JSIZEThe size of the second dimension of matrix.
MATRIXThe type of matrix.
Parameters
matrixThe matrix to set the entries of, of size ISIZE x N.
valueThe value to set the entries to.

Performs the operation

matrix[ i ][ j ] = value

Definition at line 319 of file genericTensorOps.hpp.

◆ hadamardProduct()

template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename VECTOR_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::hadamardProduct ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
VECTOR_A const &LVARRAY_RESTRICT_REF  vectorA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Multiply the elements of vectorA and vectorB putting the result into dstVector.

Template Parameters
ISIZEThe length of dstVector and srcVector.
DST_VECTORThe type of dstVector.
SRC_VECTORThe type of srcVector.
Parameters
dstVectorThe destination vector, of length M.
vectorAThe first source vector, of length M.
vectorBThe second source vector, of length M.

Performs the operation

dstVector[ i ] = vectorA[ i ] * vectorB[ i ]

Definition at line 628 of file genericTensorOps.hpp.

◆ invert() [1/2]

template<std::ptrdiff_t M, typename DST_MATRIX , typename SRC_MATRIX >
constexpr auto LvArray::tensorOps::invert ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
SRC_MATRIX const &LVARRAY_RESTRICT_REF  srcMatrix 
)
inline

Invert the source matrix srcMatrix and store the result in dstMatrix.

Template Parameters
MThe size of the matrices dstMatrix and srcMatrix.
DST_MATRIXThe type of dstMatrix.
SRC_MATRIXThe type of srcMatrix.
Parameters
dstMatrixThe M x M matrix to write the inverse to.
srcMatrixThe M x M matrix to take the inverse of.
Returns
The determinant.
Note
srcMatrix can contain integers but dstMatrix must contain floating point values.

Definition at line 53 of file fixedSizeSquareMatrixOps.hpp.

◆ invert() [2/2]

template<std::ptrdiff_t M, typename MATRIX >
constexpr auto LvArray::tensorOps::invert ( MATRIX &&  matrix)
inline

Invert the matrix matrix overwritting it.

Template Parameters
MThe size of the matrix matrix.
MATRIXThe type of matrix.
Parameters
matrixThe M x M matrix to take the inverse of and overwrite.
Returns
The determinant.
Note
matrix must contain floating point values.

Definition at line 71 of file fixedSizeSquareMatrixOps.hpp.

◆ l2Norm()

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto LvArray::tensorOps::l2Norm ( VECTOR const &  vector)
inline
Returns
The L2 norm of vector.
Template Parameters
ISIZEThe length of vector.
VECTORThe type of vector.
Parameters
vectorThe vector to get the L2 norm of, of length M.

Definition at line 680 of file genericTensorOps.hpp.

◆ l2NormSquared()

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto LvArray::tensorOps::l2NormSquared ( VECTOR const &  vector)
inline
Returns
The L2 norm squared of vector.
Template Parameters
ISIZEThe length of vector.
VECTORThe type of vector.
Parameters
vectorThe vector to get the L2 norm squared of, of length M.

Definition at line 659 of file genericTensorOps.hpp.

◆ maxAbsoluteEntry()

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto LvArray::tensorOps::maxAbsoluteEntry ( VECTOR &&  vector)
inline
Returns
Return the largest absolute entry of vector.
Template Parameters
ISIZEThe size of vector.
VECTORThe type of vector.
Parameters
vectorThe vector to get the maximum entry of, of length M.

Definition at line 273 of file genericTensorOps.hpp.

◆ normalize()

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr auto LvArray::tensorOps::normalize ( VECTOR &&  vector)
inline

Scale vector to a unit vector.

Template Parameters
ISIZEThe length of vector.
VECTORThe type of vector.
Parameters
vectorThe vector normalize, of length M.
Returns
The previous L2 norm of vector.

Definition at line 697 of file genericTensorOps.hpp.

◆ Ri_add_AijBj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Ri_add_AijBj ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Perform the matrix vector multiplication of matrixA and vectorB adding the result to dstVector.

Template Parameters
ISIZEThe length of dstVector and the size of the first dimension of matrixA.
JSIZEThe size of the second dimension of matrixA and the length of vectorBB.
DST_VECTORThe type of dstVector.
MATRIX_AThe type of matrixA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector to add the result to, of length M.
matrixAThe matrix to multiply vectorB by, of size ISIZE x N.
vectorBThe vector multiplied by matrixA, of length N.

Performs the operations

dstVector[ i ] += matrixA[ i ][ j ] * vectorB[ j ]

Definition at line 907 of file genericTensorOps.hpp.

◆ Ri_add_AjiBj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Ri_add_AjiBj ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Perform the matrix vector multiplication of the transpose of matrixA and vectorB adding the result to dstVector.

Template Parameters
ISIZEThe length of dstVector and the size of the second dimension of matrixA.
JSIZEThe size of the first dimension of matrixA and the length of vectorB.
DST_VECTORThe type of dstVector.
MATRIX_AThe type of matrixA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector to add the result to, of length M.
matrixAThe matrix to multiply vectorB by, of size JSIZE x M.
vectorBThe vector multiplied by matrixA, of length N.

Performs the operations

dstVector[ i ] += matrixA[ j ][ i ] * vectorB[ j ]

Definition at line 976 of file genericTensorOps.hpp.

◆ Ri_add_symAijBj()

template<std::ptrdiff_t M, typename DST_VECTOR , typename SYM_MATRIX_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Ri_add_symAijBj ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SYM_MATRIX_A const &LVARRAY_RESTRICT_REF  symMatrixA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Multiply the vector vectorB by the symmetric matrix symMatrixA and add the result to dstVector.

Template Parameters
MThe size of dstVector, symMatrixA, and vectorB.
DST_VECTORThe type of dstVector.
SYM_MATRIX_AThe type of symMatrixA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector of length M to add the result to.
symMatrixAThe M x M symmetric matrix to multiply vectorB by.
vectorBThe vector of length M to be multiplied by symMatrixA.

Performs the operation

dstVector[ i ] += symMatrixA[ i ][ j ] * vectorB[ j ]

Definition at line 122 of file fixedSizeSquareMatrixOps.hpp.

◆ Ri_eq_AijBj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Ri_eq_AijBj ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Perform the matrix vector multiplication of matrixA and vectorB writing the result to dstVector.

Template Parameters
ISIZEThe length of dstVector and the size of the first dimension of matrixA.
JSIZEThe size of the second dimension of matrixA and the length of vectorBB.
DST_VECTORThe type of dstVector.
MATRIX_AThe type of matrixA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector to write the result to, of length M.
matrixAThe matrix to multiply vectorB by, of size ISIZE x N.
vectorBThe vector multiplied by matrixA, of length N.

Performs the operations

dstVector[ i ] = matrixA[ i ][ j ] * vectorB[ j ]

Definition at line 873 of file genericTensorOps.hpp.

◆ Ri_eq_AjiBj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_VECTOR , typename MATRIX_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Ri_eq_AjiBj ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Perform the matrix vector multiplication of the transpose of matrixA and vectorB writing the result to dstVector.

Template Parameters
ISIZEThe length of dstVector and the size of the second dimension of matrixA.
JSIZEThe size of the first dimension of matrixA and the length of vectorB.
DST_VECTORThe type of dstVector.
MATRIX_AThe type of matrixA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector to write the result to, of length M.
matrixAThe matrix to multiply vectorB by, of size JSIZE x M.
vectorBThe vector multiplied by matrixA, of length N.

Performs the operations

dstVector[ i ] = matrixA[ j ][ i ] * vectorB[ j ]

Definition at line 941 of file genericTensorOps.hpp.

◆ Ri_eq_symAijBj()

template<std::ptrdiff_t M, typename DST_VECTOR , typename SYM_MATRIX_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Ri_eq_symAijBj ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SYM_MATRIX_A const &LVARRAY_RESTRICT_REF  symMatrixA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Multiply the vector vectorB by the symmetric matrix symMatrixA and store the result in dstVector.

Template Parameters
MThe size of dstVector, symMatrixA, and vectorB.
DST_VECTORThe type of dstVector.
SYM_MATRIX_AThe type of symMatrixA.
VECTOR_BThe type of vectorB.
Parameters
dstVectorThe vector of length M to write the result to.
symMatrixAThe M x M symmetric matrix to multiply vectorB by.
vectorBThe vector of length M to be multiplied by symMatrixA.

Performs the operation

dstVector[ i ] = symMatrixA[ i ][ j ] * vectorB[ j ]

Definition at line 100 of file fixedSizeSquareMatrixOps.hpp.

◆ Rij_add_AiBj()

template<std::ptrdiff_t JSIZE, std::ptrdiff_t ISIZE, typename DST_MATRIX , typename VECTOR_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Rij_add_AiBj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
VECTOR_A const &LVARRAY_RESTRICT_REF  vectorA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Perform the outer product of vectorA and vectorB adding the result to dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and the length of vectorA.
JSIZEThe size of the second dimension of dstMatrix and the length of vectorB.
DST_MATRIXThe type of dstMatrix.
VECTOR_AThe type of vectorA.
VECTOR_BThe type of vectorB.
Parameters
dstMatrixThe matrix the result is added to, of size ISIZE x N.
vectorAThe first vector in the outer product, of length M.
vectorBThe second vector in the outer product, of length N.

Performs the operations

dstMatrix[ i ][ j ] += vectorA[ i ] * vectorB[ j ]

Definition at line 840 of file genericTensorOps.hpp.

◆ Rij_add_AikAjk()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename MATRIX_A >
constexpr void LvArray::tensorOps::Rij_add_AikAjk ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA 
)
inline

Multiply matrixA with the transpose of itself and put the result into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of matrixA and both dimensions of dstMatrix.
JSIZEThe size of the second dimension of matrixA.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x M.
matrixAThe matrix in the multiplication, of size ISIZE x N.

Performs the operation

dstMatrix[ i ][ j ] += matrixA[ i ][ k ] * matrixA[ j ][ k ]

Definition at line 1228 of file genericTensorOps.hpp.

◆ Rij_add_AikBjk()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_add_AikBjk ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply matrixA with the transpose of matrixB and put the result into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and matrixA.
JSIZEThe size of the second dimension of dstMatrix and the first dimension of matrixB.
KSIZEThe size of the second dimension of matrixA and matrixB.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x N.
matrixAThe left matrix in the multiplication, of size ISIZE x P.
matrixBThe right matrix in the multiplication, of size JSIZE x P.

Performs the operation

dstMatrix[ i ][ j ] += matrixA[ i ][ k ] * matrixB[ j ][ k ]

Definition at line 1189 of file genericTensorOps.hpp.

◆ Rij_add_AikBkj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_add_AikBkj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply matrixA with matrixB and add the result to dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and matrixA.
JSIZEThe size of the second dimension of dstMatrix and matrixB.
KSIZEThe size of the second dimension of matrixA and first dimension of matrixB.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe matrix the result is added to, of size ISIZE x N.
matrixAThe left matrix in the multiplication, of size ISIZE x P.
matrixBThe right matrix in the multiplication, of size KSIZE x N.

Performs the operation

dstMatrix[ i ][ j ] += matrixA[ i ][ k ] * matrixB[ k ][ j ]

Definition at line 1098 of file genericTensorOps.hpp.

◆ Rij_add_AkiBkj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_add_AkiBkj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply the transpose of matrixA with matrixB and add the result into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and the second dimension of matrixA.
JSIZEThe size of the second dimension of dstMatrix and matrixB.
KSIZEThe size of the first dimension of matrixA and matrixB.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x N.
matrixAThe left matrix in the multiplication, of size KSIZE x M.
matrixBThe right matrix in the multiplication, of size KSIZE x N.

Performs the operation

dstMatrix[ i ][ j ] += matrixA[ k ][ i ] * matrixB[ k ][ j ]

Definition at line 1314 of file genericTensorOps.hpp.

◆ Rij_eq_AiAj()

template<std::ptrdiff_t M, typename DST_MATRIX , typename VECTOR_A >
constexpr void LvArray::tensorOps::Rij_eq_AiAj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
VECTOR_A const &LVARRAY_RESTRICT_REF  vectorA 
)
inline

Perform the outer product of vectorA with itself writing the result to dstMatrix.

Template Parameters
MThe size of both dimensions of dstMatrix and the length of vectorA.
DST_MATRIXThe type of dstMatrix.
VECTOR_AThe type of vectorA.
Parameters
dstMatrixThe matrix the result is written to, of size M x N.
vectorAThe first vector in the outer product, of length M.

Performs the operations

dstMatrix[ i ][ j ] = vectorA[ i ] * vectorA[ j ]

Definition at line 810 of file genericTensorOps.hpp.

◆ Rij_eq_AiBj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename VECTOR_A , typename VECTOR_B >
constexpr void LvArray::tensorOps::Rij_eq_AiBj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
VECTOR_A const &LVARRAY_RESTRICT_REF  vectorA,
VECTOR_B const &LVARRAY_RESTRICT_REF  vectorB 
)
inline

Perform the outer product of vectorA and vectorB writing the result to dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and the length of vectorA.
JSIZEThe size of the second dimension of dstMatrix and the length of vectorB.
DST_MATRIXThe type of dstMatrix.
VECTOR_AThe type of vectorA.
VECTOR_BThe type of vectorB.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x N.
vectorAThe first vector in the outer product, of length M.
vectorBThe second vector in the outer product, of length N.

Performs the operations

dstMatrix[ i ][ j ] = vectorA[ i ] * vectorB[ j ]

Definition at line 780 of file genericTensorOps.hpp.

◆ Rij_eq_AikBjk()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_eq_AikBjk ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply matrixA with the transpose of matrixB and put the result into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and matrixA.
JSIZEThe size of the second dimension of dstMatrix and the first dimension of matrixB.
KSIZEThe size of the second dimension of matrixA and matrixB.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x N.
matrixAThe left matrix in the multiplication, of size ISIZE x P.
matrixBThe right matrix in the multiplication, of size JSIZE x P.

Performs the operation

dstMatrix[ i ][ j ] = matrixA[ i ][ k ] * matrixB[ j ][ k ]

Definition at line 1143 of file genericTensorOps.hpp.

◆ Rij_eq_AikBkj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_eq_AikBkj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply matrixA with matrixB and put the result into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and matrixA.
JSIZEThe size of the second dimension of dstMatrix and matrixB.
KSIZEThe size of the second dimension of matrixA and first dimension of matrixB.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x N.
matrixAThe left matrix in the multiplication, of size ISIZE x P.
matrixBThe right matrix in the multiplication, of size KSIZE x N.

Performs the operation

dstMatrix[ i ][ j ] = matrixA[ i ][ k ] * matrixB[ k ][ j ]

Definition at line 1052 of file genericTensorOps.hpp.

◆ Rij_eq_AikSymBklAjl()

template<std::ptrdiff_t M, typename DST_SYM_MATRIX , typename MATRIX_A , typename SYM_MATRIX_B >
constexpr void LvArray::tensorOps::Rij_eq_AikSymBklAjl ( DST_SYM_MATRIX &&LVARRAY_RESTRICT_REF  dstSymMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
SYM_MATRIX_B const &LVARRAY_RESTRICT_REF  symMatrixB 
)
inline

Multiply the transpose of matrix matrixA by the symmetric matrix symMatrixB then by matrixA and store the result in dstSymMatrix.

Template Parameters
MThe size of dstSymMatrix, matrixA and symMatrixB.
DST_SYM_MATRIXThe type of dstSymMatrix.
MATRIX_AThe type of matrixA.
SYM_MATRIX_BThe type of symMatrixB.
Parameters
dstSymMatrixThe M x M symmetric matrix to write the result to.
matrixAThe M x M matrix to pre and post multiply symMatrixB by.
symMatrixBThe M x M symmetric matrix that gets pre multiplied by matrixA and post postmultiplied by the transpose of matrixA.

Performs the operation

dstSymMatrix[ i ][ j ] = matrixA[ i ][ k ] * symMatrixB[ k ][ l ] * matrixA[ j ][ l ]

Definition at line 170 of file fixedSizeSquareMatrixOps.hpp.

◆ Rij_eq_AkiBkj()

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, std::ptrdiff_t KSIZE, typename DST_MATRIX , typename MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_eq_AkiBkj ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
MATRIX_A const &LVARRAY_RESTRICT_REF  matrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply the transpose of matrixA with matrixB and put the result into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and the second dimension of matrixA.
JSIZEThe size of the second dimension of dstMatrix and matrixB.
KSIZEThe size of the first dimension of matrixA and matrixB.
DST_MATRIXThe type of dstMatrix.
MATRIX_AThe type of matrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe matrix the result is written to, of size ISIZE x N.
matrixAThe left matrix in the multiplication, of size KSIZE x M.
matrixBThe right matrix in the multiplication, of size KSIZE x N.

Performs the operation

dstMatrix[ i ][ j ] = matrixA[ k ][ i ] * matrixB[ k ][ j ]

Definition at line 1269 of file genericTensorOps.hpp.

◆ Rij_eq_symAikBjk()

template<std::ptrdiff_t M, typename DST_MATRIX , typename SYM_MATRIX_A , typename MATRIX_B >
constexpr void LvArray::tensorOps::Rij_eq_symAikBjk ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
SYM_MATRIX_A const &LVARRAY_RESTRICT_REF  symMatrixA,
MATRIX_B const &LVARRAY_RESTRICT_REF  matrixB 
)
inline

Multiply the transpose of matrix matrixB by the symmetric matrix symMatrixA and store the result in dstMatrix.

Template Parameters
MThe size of dstMatrix, symMatrixA and matrixB.
DST_MATRIXThe type of dstMatrix.
SYM_MATRIX_AThe type of symMatrixA.
MATRIX_BThe type of matrixB.
Parameters
dstMatrixThe M x M matrix to write the result to.
symMatrixAThe M x M symmetric matrix to multiply matrixB by.
matrixBThe M x M matrix to be multiplied by matrixB.

Performs the operation

dstMatrix[ i ][ j ] = symMatrixA[ i ][ k ] * matrixB[ j ][ k ]

Definition at line 145 of file fixedSizeSquareMatrixOps.hpp.

◆ scale() [1/2]

template<std::ptrdiff_t ISIZE, typename VECTOR >
constexpr void LvArray::tensorOps::scale ( VECTOR &&  vector,
std::remove_reference_t< decltype(vector[0]) > const  scale 
)
inline

Multiply the entries of vector by scale.

Template Parameters
ISIZEThe size of vector.
VECTORThe type of vector.
Parameters
vectorThe vector to scale, of length M.
scaleThe value to scale the entries of vector by.

Performs the operation

vector[ i ] *= scale

Definition at line 397 of file genericTensorOps.hpp.

◆ scale() [2/2]

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename MATRIX >
constexpr void LvArray::tensorOps::scale ( MATRIX &&  matrix,
std::remove_reference_t< decltype(matrix[0][0]) > const  scale 
)
inline

Multiply the entries of matrix by scale.

Template Parameters
ISIZEThe size of the first dimension of matrix.
JSIZEThe size of the second dimension of matrix.
MATRIXThe type of matrix.
Parameters
matrixThe matrix to scale, of size ISIZE x N.
scaleThe value scale the entries of vector by.

Performs the operations

matrix[ i ][ j ] *= scale

Definition at line 419 of file genericTensorOps.hpp.

◆ scaledAdd()

template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void LvArray::tensorOps::scaledAdd ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SRC_VECTOR const &LVARRAY_RESTRICT_REF  srcVector,
std::remove_reference_t< decltype(srcVector[0]) > const  scale 
)
inline

Add srcVector scaled by scale to dstVector.

Template Parameters
ISIZEThe length of dstVector and srcVector.
DST_VECTORThe type of dstVector.
SRC_VECTORThe type of srcVector.
Parameters
dstVectorThe destination vector, of length M.
srcVectorThe source vector, of length M.
scaleThe value to scale the entries of srcVector by.

Performs the operation

dstVector[ i ] += scale * srcVector[ i ]

Definition at line 602 of file genericTensorOps.hpp.

◆ scaledCopy() [1/2]

template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void LvArray::tensorOps::scaledCopy ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SRC_VECTOR const &LVARRAY_RESTRICT_REF  srcVector,
std::remove_reference_t< decltype(srcVector[0]) > const  scale 
)
inline

Copy srcVector scaled by scale into dstVector.

Template Parameters
ISIZEThe length of dstVector and srcVector.
DST_VECTORThe type of dstVector.
SRC_VECTORThe type of srcVector.
Parameters
dstVectorThe destination vector, of length M.
srcVectorThe source vector, of length M.
scaleThe value to scale srcVector by.

Performs the operations

dstVector[ i ] = scale * srcVector[ i ]

Definition at line 446 of file genericTensorOps.hpp.

◆ scaledCopy() [2/2]

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void LvArray::tensorOps::scaledCopy ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
SRC_MATRIX const &LVARRAY_RESTRICT_REF  srcMatrix,
std::remove_reference_t< decltype(srcMatrix[0][0]) > const  scale 
)
inline

Copy srcMatrix scaled by scale into dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and srcMatrix.
JSIZEThe size of the second dimension of dstMatrix and srcMatrix.
DST_MATRIXThe type of dstMatrix.
SRC_MATRIXThe type of srcMatrix.
Parameters
dstMatrixThe destination matrix, of size ISIZE x N.
srcMatrixThe source matrix, of size ISIZE x N.
scaleThe value to scale srcMatrix by.

Performs the operation

dstMatrix[ i ][ j ] = scale * srcMatrix[ i ][ j ]

Definition at line 473 of file genericTensorOps.hpp.

◆ subtract()

template<std::ptrdiff_t ISIZE, typename DST_VECTOR , typename SRC_VECTOR >
constexpr void LvArray::tensorOps::subtract ( DST_VECTOR &&LVARRAY_RESTRICT_REF  dstVector,
SRC_VECTOR const &LVARRAY_RESTRICT_REF  srcVector 
)
inline

Subtract srcVector from dstVector.

Template Parameters
ISIZEThe length of dstVector and srcVector.
DST_VECTORThe type of dstVector.
SRC_VECTORThe type of srcVector.
Parameters
dstVectorThe destination vector, of length M.
srcVectorThe source vector, of length M.

Performs the operation

dstVector[ i ] -= srcVector[ i ]

Definition at line 577 of file genericTensorOps.hpp.

◆ symAddIdentity()

template<std::ptrdiff_t ISIZE, typename SYM_MATRIX >
constexpr void LvArray::tensorOps::symAddIdentity ( SYM_MATRIX &&  symMatrix,
std::remove_reference_t< decltype(symMatrix[0]) > const  scale 
)
inline

Add scale times the identity matrix to symMatrix.

Template Parameters
ISIZEThe size of symMatrix.
SYM_MATRIXThe type of symMatrix.
Parameters
symMatrixThe ISIZE x ISIZE symmetric matrix to add the identity matrix to.
scaleThe amount to scale the identity matrix by.

Performs the operations

matrix[ i ][ i ] += scale

Definition at line 1430 of file genericTensorOps.hpp.

◆ symDeterminant()

template<std::ptrdiff_t M, typename SYM_MATRIX >
constexpr auto LvArray::tensorOps::symDeterminant ( SYM_MATRIX const &  symMatrix)
inline
Returns
Return the determinant of the symmetric matrix symMatrix.
Template Parameters
SYM_MATRIXThe type of symMatrix.
Parameters
symMatrixThe M x M symmetric matrix to get the determinant of.

Definition at line 186 of file fixedSizeSquareMatrixOps.hpp.

◆ symEigenvalues()

template<std::ptrdiff_t M, typename DST_VECTOR , typename SYM_MATRIX >
constexpr void LvArray::tensorOps::symEigenvalues ( DST_VECTOR &&LVARRAY_RESTRICT_REF  eigenvalues,
SYM_MATRIX const &LVARRAY_RESTRICT_REF  symMatrix 
)
inline

Compute the eigenvalues of the symmetric matrix symMatrix.

Template Parameters
DST_VECTORThe type of eigenvalues.
SYM_MATRIXThe type of symMatrix.
Parameters
eigenvaluesThe vector of length M to write the eigenvalues to.
symMatrixThe MxM symmetric matrix to compute the eigenvalues of.

Computes the eigenvalues by directly solving the characteristic equation, they are returned sorted in ascending order.

Note
The 3x3 matrices eigenvalues are computed to within the following relative tolerance: double precision: 3e-8 single precision: 5e-4 However for matrices with well spaced eigenvalues the precision is many orders greater.
symMatrix can contain integers but eigenvalues must contain floating point numbers.

Definition at line 242 of file fixedSizeSquareMatrixOps.hpp.

◆ symEigenvectors()

template<std::ptrdiff_t M, typename DST_VECTOR , typename DST_MATRIX , typename SYM_MATRIX >
constexpr void LvArray::tensorOps::symEigenvectors ( DST_VECTOR &&LVARRAY_RESTRICT_REF  eigenvalues,
DST_MATRIX &&LVARRAY_RESTRICT_REF  eigenvectors,
SYM_MATRIX const &LVARRAY_RESTRICT_REF  symMatrix 
)
inline

Compute the eigenvalues and eigenvectors of the symmetric matrix symMatrix.

Template Parameters
DST_VECTORThe type of eigenvalues.
DST_MATRIXThe type of eigenvectors
SYM_MATRIXThe type of symMatrix.
Parameters
eigenvaluesThe vector of length M to write the eigenvalues to.
eigenvectorsThe MxM matrix to write the eigenvectors to.
symMatrixThe MxM symmetric matrix to compute the eigenvalues of.

Computes the eigenvalues by directly solving the characteristic equation, they are returned sorted in ascending order. The row

eigenvectors[ i ]

contains the eigenvector corresponding to

eigenvalues[ i ]

.

Note
For 3x3 matrices the eigenvalues are computed to within the following relative tolerance: double precision: 3e-8 single precision: 5e-4 However for matrices with well spaced eigenvalues the precision is many orders greater.
symMatrix can contain integers but eigenvalues must contain floating point numbers.

Definition at line 269 of file fixedSizeSquareMatrixOps.hpp.

◆ symInvert() [1/2]

template<std::ptrdiff_t M, typename DST_SYM_MATRIX , typename SRC_SYM_MATRIX >
constexpr auto LvArray::tensorOps::symInvert ( DST_SYM_MATRIX &&LVARRAY_RESTRICT_REF  dstSymMatrix,
SRC_SYM_MATRIX const &LVARRAY_RESTRICT_REF  srcSymMatrix 
)
inline

Invert the symmetric matrix srcSymMatrix and store the result in dstSymMatrix.

Template Parameters
MThe size of the symmetric matrices dstSymMatrix and srcSymMatrix.
DST_SYM_MATRIXThe type of dstSymMatrix.
SRC_SYM_MATRIXThe type of srcSymMatrix.
Parameters
dstSymMatrixThe M x M symmetric matrix to write the inverse to.
srcSymMatrixThe M x M symmetric matrix to take the inverse of.
Returns
The determinant.
Note
srcSymMatrix can contain integers but dstMatrix must contain floating point values.

Definition at line 201 of file fixedSizeSquareMatrixOps.hpp.

◆ symInvert() [2/2]

template<std::ptrdiff_t M, typename SYM_MATRIX >
constexpr auto LvArray::tensorOps::symInvert ( SYM_MATRIX &&  symMatrix)
inline

Invert the symmetric matrix symMatrix overwritting it.

Template Parameters
MThe size of the matrix symMatrix.
SYM_MATRIXThe type of symMatrix.
Parameters
symMatrixThe M x M symmetric matrix to take the inverse of and overwrite.
Returns
The determinant.
Note
symMatrix must contain floating point values.

Definition at line 219 of file fixedSizeSquareMatrixOps.hpp.

◆ symmetricToDense()

template<std::ptrdiff_t M, typename DST_MATRIX , typename SRC_SYM_MATRIX >
constexpr void LvArray::tensorOps::symmetricToDense ( DST_MATRIX &&  dstMatrix,
SRC_SYM_MATRIX const &  srcSymMatrix 
)
inline

Convert the srcSymMatrix into a dense matrix.

Template Parameters
MThe size of dstMatrix and srcSymMatrix.
DST_MATRIXThe type of dstMatrix.
SRC_SYM_MATRIXThe type of srcSymMatrix.
Parameters
dstMatrixThe resulting MxM matrix.
srcSymMatrixThe MxM symmetric matrix to convert.

Definition at line 308 of file fixedSizeSquareMatrixOps.hpp.

◆ symTrace()

template<std::ptrdiff_t ISIZE, typename SYM_MATRIX >
constexpr auto LvArray::tensorOps::symTrace ( SYM_MATRIX const &  symMatrix)
inline
Returns
The trace of symMatrix.
Template Parameters
ISIZEThe size of symMatrix.
SYM_MATRIXThe type of symMatrix.
Parameters
symMatrixThe ISIZE x ISIZE symmetric matrix to get the trace of.

Definition at line 1449 of file genericTensorOps.hpp.

◆ trace()

template<std::ptrdiff_t ISIZE, typename MATRIX >
constexpr auto LvArray::tensorOps::trace ( MATRIX const &  matrix)
inline
Returns
The trace of matrix.
Template Parameters
ISIZEThe size of matrix.
MATRIXThe type of matrix.
Parameters
matrixThe ISIZE x ISIZE matrix to get the trace of.

Definition at line 1398 of file genericTensorOps.hpp.

◆ transpose() [1/2]

template<std::ptrdiff_t ISIZE, std::ptrdiff_t JSIZE, typename DST_MATRIX , typename SRC_MATRIX >
constexpr void LvArray::tensorOps::transpose ( DST_MATRIX &&LVARRAY_RESTRICT_REF  dstMatrix,
SRC_MATRIX const &LVARRAY_RESTRICT_REF  srcMatrix 
)
inline

Store the transpose of the NxM matrix srcMatrix in dstMatrix.

Template Parameters
ISIZEThe size of the first dimension of dstMatrix and the second dimension of srcMatrix.
JSIZEThe size of the second dimension of dstMatrix and the first dimension of srcMatrix.
DST_MATRIXThe type of dstMatrix.
SRC_MATRIXThe type of srcMatrix.
Parameters
dstMatrixThe MxN matrix where the transpose of srcMatrix is written.
srcMatrixThe NxM matrix to transpose.

Definition at line 1014 of file genericTensorOps.hpp.

◆ transpose() [2/2]

template<std::ptrdiff_t ISIZE, typename MATRIX >
constexpr void LvArray::tensorOps::transpose ( MATRIX &&LVARRAY_RESTRICT_REF  matrix)
inline

Transpose the MxM matrix matrix.

Template Parameters
ISIZEThe size of matrix.
MATRIXThe type of matrix.
Parameters
matrixThe MxM matrix to transpose.

Definition at line 1353 of file genericTensorOps.hpp.