Loading...
Searching...
No Matches
Tensor.h File Reference
#include "MatrixSquareBracketsAccess.h"
#include "Vector.h"
#include "LoopUnroller.h"
#include "Exception.h"
#include <array>
#include <type_traits>

Classes

struct  PLMD::TensorGenericAux
 Small class to contain local utilities. More...
 
class  PLMD::TensorTyped< T, n, m >
 Class implementing fixed size matrices of doubles. More...
 

Namespaces

namespace  PLMD
 

Typedefs

typedef Tensor3d PLMD::Tensor
 
typedef TensorGeneric< 1, 1 > PLMD::Tensor1d
 
typedef TensorTyped< float, 1, 1 > PLMD::Tensor1f
 
typedef TensorGeneric< 2, 2 > PLMD::Tensor2d
 
typedef TensorTyped< float, 2, 2 > PLMD::Tensor2f
 
typedef TensorGeneric< 3, 3 > PLMD::Tensor3d
 
typedef TensorTyped< float, 3, 3 > PLMD::Tensor3f
 
typedef TensorGeneric< 4, 4 > PLMD::Tensor4d
 
typedef TensorTyped< float, 4, 4 > PLMD::Tensor4f
 
typedef TensorGeneric< 5, 5 > PLMD::Tensor5d
 
typedef TensorTyped< float, 5, 5 > PLMD::Tensor5f
 
template<unsigned n, unsigned m>
using PLMD::TensorGeneric = TensorTyped<double,n,m>
 
template<typename T>
using PLMD::TensorT = TensorTyped<T,3,3>
 Alias for three by three Tensor of any type:
 

Functions

template<typename T>
constexpr TensorTyped< T, 3, 3 > PLMD::dcrossDv1 (const VectorTyped< T, 3 > &v1, const VectorTyped< T, 3 > &v2)
 
template<typename T>
constexpr TensorTyped< T, 3, 3 > PLMD::dcrossDv2 (const VectorTyped< T, 3 > &v1, const VectorTyped< T, 3 > &v2)
 
template<typename T>
TensorTyped< T, 3, 3 > PLMD::deriNorm (const VectorTyped< T, 3 > &v1, const TensorTyped< T, 3, 3 > &v2)
 
template<typename T>
constexpr T PLMD::determinant (const TensorTyped< T, 3, 3 > &t)
 
template<typename precision, unsigned n, unsigned m>
void PLMD::diagMatSym (const TensorTyped< precision, n, n > &mat, VectorTyped< precision, m > &evals, TensorTyped< precision, m, n > &evec)
 Diagonalize tensor.
 
template<typename T, unsigned n, unsigned m>
void PLMD::diagMatSym (const TensorTyped< T, n, n > &, VectorTyped< T, m > &evals, TensorTyped< T, m, n > &evec)
 Diagonalize tensor.
 
template<typename T, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::extProduct (const VectorTyped< T, n > &v1, const VectorTyped< T, m > &v2)
 returns the transpose of a tensor (same as TensorGeneric(const VectorGeneric&,const VectorGeneric&))
 
template<typename T, unsigned n, unsigned m>
PLMD::frobeniusNorm (const TensorTyped< T, m, n > &t)
 Compute the Frobenius norm 2.
 
template<typename T>
constexpr TensorTyped< T, 3, 3 > PLMD::inverse (const TensorTyped< T, 3, 3 > &t)
 
template<typename T, unsigned n>
PLMD::lowestEigenpairSym (const TensorTyped< T, n, n > &K, VectorTyped< T, n > &eigenvector, unsigned niter=24)
 Compute lowest eigenvalue and eigenvector, using a branchless iterative implementation.
 
template<typename T, unsigned n, unsigned m, unsigned l>
constexpr TensorTyped< T, n, l > PLMD::matmul (const TensorTyped< T, n, m > &a, const TensorTyped< T, m, l > &b)
 matrix-matrix multiplication
 
template<typename T, unsigned n, unsigned m, unsigned l, unsigned i>
constexpr TensorTyped< T, n, i > PLMD::matmul (const TensorTyped< T, n, m > &a, const TensorTyped< T, m, l > &b, const TensorTyped< T, l, i > &c)
 matrix-matrix-matrix multiplication
 
template<typename T, unsigned n, unsigned m, unsigned l>
constexpr VectorTyped< T, n > PLMD::matmul (const TensorTyped< T, n, m > &a, const TensorTyped< T, m, l > &b, const VectorTyped< T, l > &c)
 matrix-matrix-vector multiplication
 
template<typename T, typename TT, unsigned n, unsigned m>
constexpr VectorTyped< T, n > PLMD::matmul (const TensorTyped< T, n, m > &a, const VectorTyped< TT, m > &b)
 matrix-vector multiplicationi, the first argument determines the type of the result
 
template<typename T, typename TT, unsigned n, unsigned m>
constexpr VectorTyped< T, n > PLMD::matmul (const VectorTyped< T, m > &a, const TensorTyped< TT, m, n > &b)
 vector-matrix multiplication, the first argument determines the type of the result
 
template<typename T, unsigned n, unsigned m, unsigned l>
constexpr VectorTyped< T, l > PLMD::matmul (const VectorTyped< T, n > &a, const TensorTyped< T, n, m > &b, const TensorTyped< T, m, l > &c)
 vector-matrix-matrix multiplication
 
template<typename T, unsigned n, unsigned m>
constexpr T PLMD::matmul (const VectorTyped< T, n > &a, const TensorTyped< T, n, m > &b, const VectorTyped< T, m > &c)
 vector-matrix-vector multiplication
 
template<typename T, unsigned n_>
constexpr T PLMD::matmul (const VectorTyped< T, n_ > &a, const VectorTyped< T, n_ > &b)
 vector-vector multiplication (maps to dotProduct)
 
template<typename T, typename J, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::operator* (const TensorTyped< T, n, m > &t1, J s)
 
template<typename T, typename J, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::operator* (J s, const TensorTyped< T, n, m > &t1)
 
template<typename T, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::operator+ (const TensorTyped< T, n, m > &t1, const TensorTyped< T, n, m > &t2)
 
template<typename T, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::operator- (const TensorTyped< T, n, m > &t1, const TensorTyped< T, n, m > &t2)
 
template<typename T, typename J, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::operator/ (const TensorTyped< T, n, m > &t1, J s)
 
template<typename T, unsigned n, unsigned m>
std::ostream & PLMD::operator<< (std::ostream &os, const TensorTyped< T, n, m > &t)
 
template<typename T, unsigned n, unsigned m>
constexpr TensorTyped< T, n, m > PLMD::transpose (const TensorTyped< T, m, n > &t)
 returns the transpose of a tensor (same as TensorGeneric::transpose())
 
template<typename T>
TensorTyped< T, 3, 3 > PLMD::VcrossTensor (const TensorTyped< T, 3, 3 > &v2, const VectorTyped< T, 3 > &v1)
 
template<typename T>
TensorTyped< T, 3, 3 > PLMD::VcrossTensor (const VectorTyped< T, 3 > &v1, const TensorTyped< T, 3, 3 > &v2)