High Performance Plasticity  0.5.0
tensor.h File Reference

Header file for tensor classes. More...

#include <cstddef>
#include <iostream>
#include <cassert>
#include <lapacke.h>
#include <vector>
#include <limits>
#include <stdexcept>
#include <algorithm>
#include <valarray>
#include <random>
#include <hdf5/serial/H5Cpp.h>
#include <hdf5/openmpi/hdf5.h>
#include <hpp/config.h>
#include <hpp/mpiUtils.h>
#include <hpp/hdfUtilsCpp.h>
#include <hpp/hdfUtils.h>
#include <unsupported/Eigen/MatrixFunctions>
#include "mpi.h"
Include dependency graph for tensor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  hpp::TensorError
 
struct  hpp::idx2d
 A 2D index. More...
 
struct  hpp::idx4d
 A 4D index. More...
 
class  hpp::Tensor2< T >
 A class for second order tensors. More...
 
class  hpp::Tensor4< T >
 
struct  hpp::PolarDecomposition< T >
 
class  hpp::Tensor2< T >
 A class for second order tensors. More...
 
class  hpp::Tensor4< T >
 

Namespaces

 hpp
 

Functions

template<typename T >
std::vector< T > hpp::operator/ (const std::vector< T > &vec, T scalar)
 Elementwise division. More...
 
template<typename T >
std::vector< std::vector< T > > hpp::operator/ (const std::vector< std::vector< T >> &veclist, T scalar)
 
template<typename T >
void hpp::operator*= (std::vector< T > &vec, const T scalar)
 
template<typename T >
void hpp::operator/= (std::vector< T > &vec, const T scalar)
 
template<typename T >
std::vector< T > hpp::operator* (const std::vector< T > &vec, const T scalar)
 
template<typename T >
std::vector< T > hpp::operator* (const T scalar, const std::vector< T > &vec)
 
template<typename T >
std::vector< std::vector< T > > hpp::operator* (T scalar, const std::vector< std::vector< T >> &veclist)
 
template<typename T >
std::vector< T > hpp::abs (const std::vector< T > &vec)
 
template<typename T >
hpp::min (const std::vector< T > &vec)
 
template<typename T >
hpp::max (const std::vector< T > &vec)
 
template<typename T >
std::vector< T > hpp::operator- (const std::vector< T > &vec1, const std::vector< T > &vec2)
 
template<typename T >
hpp::prod (const std::vector< T > &vec)
 Product of all the entries of a vector. More...
 
template<typename T >
std::ostream & hpp::operator<< (std::ostream &out, const std::vector< T > &vec)
 
template<typename T >
std::ostream & hpp::operator<< (std::ostream &out, const std::valarray< T > &vec)
 
idx2d hpp::unflat (unsigned int flatIdx, unsigned int n1, unsigned int n2)
 
idx4d hpp::unflat (unsigned int flatIdx, unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
 
template<typename T , typename U >
std::vector< T > hpp::unflatC (T flatIdx, std::vector< U > dims)
 
template<typename T , typename U >
hpp::flatC (std::vector< T > idx, std::vector< U > dims)
 
template<typename T >
std::vector< T > hpp::ones (unsigned int n)
 
template<typename T >
Tensor2< T > hpp::outer (const std::vector< T > &A, const std::vector< T > &B)
 
template<typename T >
void hpp::outerInPlace (const std::vector< T > &A, const std::vector< T > &B, Tensor2< T > &C)
 
template<typename T >
Tensor2< T > hpp::outer (const std::valarray< T > &A, const std::valarray< T > &B)
 
template<typename T >
Tensor2< T > hpp::identityTensor2 (unsigned int n)
 
template<typename T >
void hpp::identityTensor2InPlace (unsigned int n, Tensor2< T > &A)
 
template<typename T >
Tensor2< T > hpp::ones2 (unsigned int n)
 
template<typename T >
Tensor2< T > hpp::diag2 (const std::vector< T > &vals)
 
template<typename T >
Tensor2< T > hpp::diag2 (const std::valarray< T > &vals)
 
template<typename T >
bool hpp::areEqual (const Tensor2< T > &A, const Tensor2< T > &B, T tol)
 
template<typename T >
bool hpp::operator== (const Tensor2< T > &A, const Tensor2< T > &B)
 Test equality of two tensors. More...
 
template<typename T >
bool hpp::operator!= (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
bool hpp::areSameShape (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::assertSameShape (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
Tensor2< T > hpp::operator+ (const Tensor2< T > &A, const Tensor2< T > &B)
 Addition. More...
 
template<typename T >
void hpp::operator+= (Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
Tensor2< T > hpp::operator+ (const Tensor2< T > &A, const T &B)
 
template<typename T >
Tensor2< T > hpp::operator+ (const T &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::operator+= (Tensor2< T > &A, const T &B)
 
template<typename T >
Tensor2< T > hpp::MPISum (Tensor2< T > &local, MPI_Comm comm)
 
template<typename T >
Tensor2< T > hpp::operator- (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::operator-= (Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
Tensor2< T > hpp::operator- (const Tensor2< T > &A, const T &B)
 
template<typename T >
Tensor2< T > hpp::operator- (const T &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::operator-= (Tensor2< T > &A, const T &B)
 
template<typename T >
Tensor2< T > hpp::operator* (const Tensor2< T > &A, const T &B)
 
template<typename T >
Tensor2< T > hpp::operator* (const T &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::operator*= (Tensor2< T > &A, const T &B)
 
template<typename T >
Tensor2< T > hpp::operator/ (const Tensor2< T > &A, const T &B)
 
template<typename T >
void hpp::operator/= (Tensor2< T > &A, const T &B)
 
template<typename T >
void hpp::assertCompatibleForMultiplication (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
Tensor2< T > hpp::operator* (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::ABPlusBTransposeAInPlace (const hpp::Tensor2< T > &A, const hpp::Tensor2< T > &B, hpp::Tensor2< T > &C)
 
template<typename T >
hpp::contract (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
std::ostream & hpp::operator<< (std::ostream &out, const Tensor2< T > &A)
 
template<typename T >
std::ostream & hpp::operator<< (std::ostream &out, Tensor4< T > &A)
 
template<typename T >
Tensor4< T > hpp::identityTensor4 (unsigned int n)
 
template<typename T >
void hpp::identityTensor4InPlace (unsigned int n, Tensor4< T > &A)
 
template<typename T >
bool hpp::areSameShape (const Tensor4< T > &A, const Tensor4< T > &B)
 
template<typename T >
void hpp::assertSameShape (const Tensor4< T > &A, const Tensor4< T > &B)
 
template<typename T >
bool hpp::operator== (const Tensor4< T > &A, const Tensor4< T > &B)
 Test equality of two tensors. More...
 
template<typename T >
bool hpp::operator!= (const Tensor4< T > &A, const Tensor4< T > &B)
 
template<typename T >
Tensor4< T > hpp::operator+ (const Tensor4< T > &A, const Tensor4< T > &B)
 Addition. More...
 
template<typename T >
void hpp::operator+= (Tensor4< T > &A, const Tensor4< T > &B)
 
template<typename T >
Tensor4< T > hpp::operator+ (const Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::operator+ (const T &A, const Tensor4< T > &B)
 
template<typename T >
void hpp::operator+= (Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::operator- (const Tensor4< T > &A)
 
template<typename T >
Tensor4< T > hpp::operator- (const Tensor4< T > &A, const Tensor4< T > &B)
 
template<typename T >
void hpp::operator-= (Tensor4< T > &A, const Tensor4< T > &B)
 
template<typename T >
Tensor4< T > hpp::operator- (const Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::operator- (const T &A, const Tensor4< T > &B)
 
template<typename T >
void hpp::operator-= (Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::operator* (const Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::operator* (const T &A, const Tensor4< T > &B)
 
template<typename T >
void hpp::operator*= (Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::operator/ (const Tensor4< T > &A, const T &B)
 
template<typename T >
void hpp::operator/= (Tensor4< T > &A, const T &B)
 
template<typename T >
Tensor4< T > hpp::outer (const Tensor2< T > &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::assertCompatibleForOuterProduct (const Tensor2< T > &A, const Tensor2< T > &B, const Tensor4< T > &C)
 
template<typename T >
void hpp::outerInPlace (const Tensor2< T > &A, const Tensor2< T > &B, Tensor4< T > &C)
 
template<typename T >
void hpp::assertCompatibleForContraction (const Tensor4< T > &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::assertCompatibleForContraction (const Tensor4< T > &A, const Tensor2< T > &B, const Tensor2< T > &C)
 
template<typename T >
Tensor2< T > hpp::contract (const Tensor4< T > &A, const Tensor2< T > &B)
 
template<typename T >
void hpp::contractInPlace (const Tensor4< T > &A, const Tensor2< T > &B, Tensor2< T > &C)
 
template<typename U >
void hpp::assertCompatibleForContraction (const Tensor4< U > &A, const Tensor4< U > &B)
 
template<typename U >
Tensor4< U > hpp::contract (const Tensor4< U > &A, const Tensor4< U > &B)
 
template<typename T >
std::vector< T > hpp::operator* (const hpp::Tensor2< T > &A, const std::vector< T > &x)
 
template<typename T >
std::valarray< T > hpp::operator* (const hpp::Tensor2< T > &A, const std::valarray< T > &x)
 
template<typename T >
hpp::Tensor2< T > hpp::operator* (const std::vector< T > &x, const hpp::Tensor2< T > &A)
 Replicates the numpy behaviour of vec*mat. More...
 
template<typename T >
Tensor2< T > hpp::transformIntoFrame (const Tensor2< T > &A, const Tensor2< T > &Q)
 Transform tensor \( \mathbf{A} \) into the frame given by the columns of \( \mathbf{Q} \). More...
 
template<typename T >
Tensor2< T > hpp::transformOutOfFrame (const Tensor2< T > &A_star, const Tensor2< T > &Q)
 Transform tensor \( \mathbf{A}^* \) out of the frame given by the columns of \( \mathbf{Q} \). More...
 
template<typename T >
Tensor4< T > hpp::transformOutOfFrame (const Tensor4< T > &E_star, const Tensor2< T > &Q)
 Transform tensor \( \mathbf{E}^* \) out of the frame given by the columns of \( \mathbf{Q} \). More...
 

Detailed Description

Header file for tensor classes.

This class will do no bounds-checking or any other safety checks that induce significant overhead.

Author
Michael Malahe