High Performance Plasticity  0.5.0
hpp::Tensor2< T > Class Template Reference

A class for second order tensors. More...

#include <tensor.h>

Public Member Functions

 Tensor2 ()
 Default constructor. More...
 
 Tensor2 (const unsigned int n1, const unsigned int n2)
 Constructor for a zeroed tensor. More...
 
 Tensor2 (const Tensor2< T > &A)
 Copy constructor. More...
 
unsigned int getn1 () const
 
unsigned int getn2 () const
 
unsigned int getNVals () const
 
getVal (const unsigned int i, const unsigned int j) const
 Get the value of \(T_{ij}\). More...
 
getValFlat (const unsigned int flatIdx) const
 Get the value of \(T_{i}\). More...
 
void setVal (const unsigned int i, const unsigned int j, T val)
 
T & operator() (const unsigned int i, const unsigned int j)
 Get the a reference to the value of \(T_{ij}\). More...
 
T & operator() (const unsigned int flatIdx)
 
void copyValuesOut (T *outVals) const
 
 Tensor2 (const Tensor4< T > &A)
 Construct a square second order tensor from a square fourth order tensor. More...
 
Tensor2< T > & operator= (const Tensor2< T > &input)
 The standard assignment operator. More...
 
void printToStream (std::ostream &out) const
 Pretty printing to stream. More...
 
 Tensor2 (H5::DataSet &dataset, std::vector< hsize_t > gridOffset, std::vector< hsize_t > tensorDims)
 Construct from HD5 dataset and offset. More...
 
void writeToExistingHDF5Dataset (H5::DataSet &dataset, std::vector< hsize_t > arrayOffset)
 
 Tensor2 (H5::H5File &file, const H5std_string &datasetName, std::vector< hsize_t > tensorDims)
 Construct from HD5 file and dataset name. More...
 
void writeToNewHDF5 (const H5std_string &filename, const H5std_string &datasetName)
 
void addAsNewHDF5Dataset (H5::H5File &file, const H5std_string &datasetName)
 Adding to an HDF5 file as a new dataset. More...
 
 Tensor2 (hid_t dset_id, hid_t plist_id, std::vector< hsize_t > gridOffset, std::vector< hsize_t > tensorDims)
 Construct from HD5 dataset and offset. More...
 
void writeToExistingHDF5Dataset (hid_t dset_id, hid_t plist_id, std::vector< hsize_t > arrayOffset)
 
void invInPlace ()
 The inverse of the tensor. More...
 
Tensor2< T > inv () const
 The inverse of the tensor. More...
 
Tensor2< T > exp () const
 The matrix exponential of the tensor. More...
 
void assertSquare () const
 
bool isRotationMatrix () const
 
tr () const
 The trace of the tensor. More...
 
det () const
 The determinant of the tensor. More...
 
min () const
 The minimum element in the tensor. More...
 
max () const
 The maximum element in the tensor. More...
 
absmax () const
 The maximum element in the tensor. More...
 
spectralNorm () const
 
frobeniusNorm () const
 
prod () const
 Product of all elements. More...
 
Tensor2< T > abs () const
 The element-wise absolute value of the tensor. More...
 
Tensor2< T > trans () const
 The transpose of the tensor. More...
 
Tensor2< T > constrainedTo (const T minVal, const T maxVal) const
 Creates a new tensor with the values of the elements constrained between two values. More...
 
void constrainInPlace (const T minVal, const T maxVal)
 Replaces the elements with their values constrained between two limits. More...
 
Tensor2< T > scaledToUnitDeterminant () const
 Create a tensor with the values uniformly scaled so that the new tensor has unit determinant. More...
 
Tensor2< T > deviatoricComponent () const
 The deviatoric component of the tensor. More...
 
void evecDecomposition (std::valarray< T > &evals, Tensor2< T > &evecs)
 
Tensor2< T > sqrtMatrix ()
 Matrix square root of the tensor. More...
 
PolarDecomposition< T > polarDecomposition () const
 Polar decomposition of the tensor. More...
 

Protected Attributes

unsigned int n1 = 0
 the first dimension of the tensor More...
 
unsigned int n2 = 0
 the second dimension of the tensor More...
 
unsigned int nVals = 0
 the total number of elements in the tensor More...
 
std::valarray< T > vals
 the underlying 1D array More...
 

Private Member Functions

void initialize (const unsigned int n1, const unsigned int n2)
 Initialize the dimensions and allocation for the tensor. More...
 
void copyValues (const Tensor2< T > &input)
 Copy the values from one tensor to another. More...
 
void constructFromHDF5Dataset (H5::DataSet &dataset, std::vector< hsize_t > gridOffset, std::vector< hsize_t > tensorDims)
 
void constructFromHDF5Dataset (hid_t dset_id, hid_t plist_id, std::vector< hsize_t > gridOffset, std::vector< hsize_t > tensorDims)
 
 Tensor2 (const unsigned int n1, const unsigned int n2, const T *inArray)
 Constructor for a populated tensor. More...
 
 Tensor2 (const unsigned int n1, const unsigned int n2, const std::valarray< T > &inVec)
 Constructor for a populated tensor. More...
 
unsigned int flat (const unsigned int i, const unsigned int j) const
 Flatten the two indices of the tensor. More...
 
idx2d unflat (const unsigned int idx) const
 Unflatten the two indices of the tensor. More...
 

Private Attributes

friend Tensor4< T >
 

Friends

template<typename U , unsigned int M, unsigned int N>
class Tensor2CUDA
 
template<typename U >
bool areSameShape (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
void assertSameShape (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
void assertCompatibleForMultiplication (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
void assertCompatibleForContraction (const Tensor4< U > &A, const Tensor2< U > &B)
 
template<typename U >
void assertCompatibleForContraction (const Tensor4< U > &A, const Tensor2< U > &B, const Tensor2< U > &C)
 
template<typename U >
bool areEqual (const Tensor2< U > &A, const Tensor2< U > &B, U tol)
 
template<typename U >
bool operator== (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
bool operator!= (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
Tensor2< U > operator* (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
void ABPlusBTransposeAInPlace (const hpp::Tensor2< U > &A, const hpp::Tensor2< U > &B, hpp::Tensor2< U > &C)
 
template<typename U >
Tensor2< U > contract (const Tensor4< U > &A, const Tensor2< U > &B)
 
template<typename U >
contract (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
void contractInPlace (const Tensor4< U > &A, const Tensor2< U > &B, Tensor2< U > &C)
 
template<typename U >
void assertCompatibleForOuterProduct (const Tensor2< U > &A, const Tensor2< U > &B, const Tensor4< U > &C)
 
template<typename U >
Tensor4< U > outer (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
void outerInPlace (const Tensor2< U > &A, const Tensor2< U > &B, Tensor4< U > &C)
 
template<typename U >
Tensor2< U > operator+ (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
Tensor2< U > operator+ (const Tensor2< U > &A, const U &B)
 
template<typename U >
Tensor2< U > operator+ (const U &A, const Tensor2< U > &B)
 
template<typename U >
void operator+= (Tensor2< U > &A, const U &B)
 
template<typename U >
void operator+= (Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
Tensor2< U > MPISum (Tensor2< U > &local, MPI_Comm comm)
 
template<typename U >
Tensor2< U > operator- (const Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
Tensor2< U > operator- (const Tensor2< U > &A, const U &B)
 
template<typename U >
Tensor2< U > operator- (const U &A, const Tensor2< U > &B)
 
template<typename U >
void operator-= (Tensor2< U > &A, const U &B)
 
template<typename U >
void operator-= (Tensor2< U > &A, const Tensor2< U > &B)
 
template<typename U >
Tensor2< U > operator* (const Tensor2< U > &A, const U &B)
 
template<typename U >
Tensor2< U > operator* (const U &A, const Tensor2< U > &B)
 
template<typename U >
void operator*= (Tensor2< U > &A, const U &B)
 
template<typename U >
Tensor2< U > operator/ (const Tensor2< U > &A, const U &B)
 
template<typename U >
void operator/= (Tensor2< U > &A, const U &B)
 
template<typename U >
void identityTensor2InPlace (unsigned int n, Tensor2< U > &A)
 

Detailed Description

template<typename T>
class hpp::Tensor2< T >

A class for second order tensors.

Template Parameters
Tthe scalar type

Constructor & Destructor Documentation

template<typename T >
hpp::Tensor2< T >::Tensor2 ( )

Default constructor.

Sets dimensions to zero

template<typename T >
hpp::Tensor2< T >::Tensor2 ( const unsigned int  n1,
const unsigned int  n2 
)

Constructor for a zeroed tensor.

Parameters
n1the first dimension of the tensor
n2the second dimension of the tensor
Template Parameters
Tthe scalar type
Returns
the zeroed tensor of dimension n1xn2
template<typename T>
hpp::Tensor2< T >::Tensor2 ( const Tensor2< T > &  A)

Copy constructor.

Parameters
Athe tensor to copy from
template<typename T>
hpp::Tensor2< T >::Tensor2 ( const Tensor4< T > &  A)
explicit

Construct a square second order tensor from a square fourth order tensor.

This is primarily used for intermediate steps in constructing fourth order inverses with respect to the contraction between a 4th order tensor and a 2nd order tensor.

The 4th order tensor \(\mathbf{A}\), of dimension \(n \times n \times n \times n\) is flattened into the 2nd order tensor \(\mathbf{B}\), of dimension \( n^2 \times n^2 \) according to:

\[ \mathbf{A}_{ijkl} = \mathbf{B}_{in+j,kn+l}. \]

That is, it is a row-major flattening.

Parameters
Athe 4th order tensor \(\mathbf{A}\)
Template Parameters
Tthe scalar type
Returns
the 2nd order tensor \(\mathbf{B}\)
template<typename T>
hpp::Tensor2< T >::Tensor2 ( H5::DataSet &  dataset,
std::vector< hsize_t >  gridOffset,
std::vector< hsize_t >  tensorDims 
)

Construct from HD5 dataset and offset.

Using the HDF5 C++ API

Parameters
dataset
gridOffset
tensorDims
template<typename T>
hpp::Tensor2< T >::Tensor2 ( H5::H5File &  file,
const H5std_string &  datasetName,
std::vector< hsize_t >  tensorDims 
)

Construct from HD5 file and dataset name.

Where the dataset itself is just the tensor

Parameters
file
datasetName
tensorDimsthe dimension of the tensor to load
template<typename T>
hpp::Tensor2< T >::Tensor2 ( hid_t  dset_id,
hid_t  plist_id,
std::vector< hsize_t >  gridOffset,
std::vector< hsize_t >  tensorDims 
)

Construct from HD5 dataset and offset.

Uses the HDF5 C API

Parameters
dset_id
plist_id
gridOffset
tensorDims
template<typename T>
hpp::Tensor2< T >::Tensor2 ( const unsigned int  n1,
const unsigned int  n2,
const T *  inVals 
)
private

Constructor for a populated tensor.

Populates the values of the tensor from a 1D array of values that have to have the same layout as the the underlying array

Parameters
n1the first dimension of the tensor
n2the second dimension of the tensor
inValsthe array to be copied in
Template Parameters
Tthe scalar type
Returns
the populated tensor of dimension n1xn2
template<typename T>
hpp::Tensor2< T >::Tensor2 ( const unsigned int  n1,
const unsigned int  n2,
const std::valarray< T > &  inVals 
)
private

Constructor for a populated tensor.

Populates the values of the tensor from an STL vector of values that have to have the same layout as the the underlying array

Parameters
n1the first dimension of the tensor
n2the second dimension of the tensor
inValsthe STL vector to be copied in
Template Parameters
Tthe scalar type
Returns
the populated tensor of dimension n1xn2

Member Function Documentation

template<typename T >
Tensor2< T > hpp::Tensor2< T >::abs ( ) const

The element-wise absolute value of the tensor.

Template Parameters
Tthe scalar type
Returns
the element-wise absolute value of the tensor
template<typename T >
T hpp::Tensor2< T >::absmax ( ) const

The maximum element in the tensor.

Template Parameters
Tthe scalar type
Returns
the maximum element in the tensor
template<typename T >
void hpp::Tensor2< T >::addAsNewHDF5Dataset ( H5::H5File &  file,
const H5std_string &  datasetName 
)

Adding to an HDF5 file as a new dataset.

Parameters
filethe HDF5 file handle
datasetNamethe name of this dataset
template<typename T >
void hpp::Tensor2< T >::assertSquare ( ) const
template<typename T>
Tensor2< T > hpp::Tensor2< T >::constrainedTo ( const T  minVal,
const T  maxVal 
) const

Creates a new tensor with the values of the elements constrained between two values.

For each element, if its value is below minVal, it's set to minVal. If it's above maxVal, it's set to maxVal.

Parameters
minValthe minimum value
maxValthe maximum value
Returns
a new tensor that conforms to the constraints
template<typename T>
void hpp::Tensor2< T >::constrainInPlace ( const T  minVal,
const T  maxVal 
)

Replaces the elements with their values constrained between two limits.

For each element, if its value is below minVal, it's set to minVal. If it's above maxVal, it's set to maxVal.

Parameters
minValthe minimum value
maxValthe maximum value
template<typename T >
void hpp::Tensor2< T >::constructFromHDF5Dataset ( H5::DataSet &  dataset,
std::vector< hsize_t >  gridOffset,
std::vector< hsize_t >  tensorDims 
)
private
template<typename T >
void hpp::Tensor2< T >::constructFromHDF5Dataset ( hid_t  dset_id,
hid_t  plist_id,
std::vector< hsize_t >  gridOffset,
std::vector< hsize_t >  tensorDims 
)
private
template<typename T>
void hpp::Tensor2< T >::copyValues ( const Tensor2< T > &  input)
private

Copy the values from one tensor to another.

Dimension compatability is checked for all builds

Parameters
inputthe input tensor
Template Parameters
Tthe scalar type
template<typename T>
void hpp::Tensor2< T >::copyValuesOut ( T *  outVals) const
template<typename T >
T hpp::Tensor2< T >::det ( ) const

The determinant of the tensor.

The approach is taken from https://www.ibm.com/developerworks/community/blogs/jfp/entry/A_Comparison_Of_C_Julia_Python_Numba_Cython_Scipy_and_BLAS_on_LU_Factorization It is not particularly stable, and we should consider a more robust implementation for large tensors

Template Parameters
Tthe scalar type
Returns
the determinant of this tensor, \(det(\mathbf{A})\)
template<typename T >
Tensor2< T > hpp::Tensor2< T >::deviatoricComponent ( ) const

The deviatoric component of the tensor.

Template Parameters
Tthe scalar type
Returns
the deviatoric component of the tensor
template<typename T>
void hpp::Tensor2< T >::evecDecomposition ( std::valarray< T > &  evals,
Tensor2< T > &  evecs 
)
template<typename T >
Tensor2< T > hpp::Tensor2< T >::exp ( ) const

The matrix exponential of the tensor.

Template Parameters
Tthe scalar type
Returns
The matrix exponential of the tensor, \( \exp(\mathbf{A}) \).
template<typename T >
unsigned int hpp::Tensor2< T >::flat ( const unsigned int  i,
const unsigned int  j 
) const
inlineprivate

Flatten the two indices of the tensor.

The flattening order is dictated by the macro HPP_ARRAY_LAYOUT

Parameters
ithe first index
jthe second index
Returns
the flattened index
template<typename T >
T hpp::Tensor2< T >::frobeniusNorm ( ) const
template<typename T>
unsigned int hpp::Tensor2< T >::getn1 ( ) const
inline
template<typename T>
unsigned int hpp::Tensor2< T >::getn2 ( ) const
inline
template<typename T>
unsigned int hpp::Tensor2< T >::getNVals ( ) const
inline
template<typename T >
T hpp::Tensor2< T >::getVal ( const unsigned int  i,
const unsigned int  j 
) const
inline

Get the value of \(T_{ij}\).

Bounds checking is done for debug builds

Parameters
i
j
Template Parameters
Tthe scalar type
Returns
\(T_{ij}\)
template<typename T >
T hpp::Tensor2< T >::getValFlat ( const unsigned int  flatIdx) const
inline

Get the value of \(T_{i}\).

Where \(i\) is the index in the underlying array. Bounds checking is done for debug builds.

Parameters
flatIdxi
Template Parameters
Tthe scalar type
Returns
\(T_{i}\)
template<typename T >
void hpp::Tensor2< T >::initialize ( const unsigned int  n1,
const unsigned int  n2 
)
private

Initialize the dimensions and allocation for the tensor.

The elements are also zeroed.

Parameters
n1the first dimension of the tensor
n2the second dimension of the tensor
Template Parameters
Tthe scalar type
template<typename T >
Tensor2< T > hpp::Tensor2< T >::inv ( ) const

The inverse of the tensor.

Returns
the inverse of this tensor, \( \mathbf{A}^{-1} \)
Template Parameters
Tthe scalar type
template<typename T >
void hpp::Tensor2< T >::invInPlace ( )

The inverse of the tensor.

Returns
the inverse of this tensor, \(\mathbf{A}^{-1}\)
Template Parameters
Tthe scalar type
template<typename T >
bool hpp::Tensor2< T >::isRotationMatrix ( ) const
template<typename T >
T hpp::Tensor2< T >::max ( ) const

The maximum element in the tensor.

Template Parameters
Tthe scalar type
Returns
the maximum element in the tensor
template<typename T >
T hpp::Tensor2< T >::min ( ) const

The minimum element in the tensor.

Template Parameters
Tthe scalar type
Returns
the minimum element in the tensor
template<typename T >
T & hpp::Tensor2< T >::operator() ( const unsigned int  i,
const unsigned int  j 
)
inline

Get the a reference to the value of \(T_{ij}\).

Bounds checking is done for debug builds

Parameters
i
j
Template Parameters
Tthe scalar type
Returns
\(T_{ij}\)
template<typename T >
T & hpp::Tensor2< T >::operator() ( const unsigned int  flatIdx)
inline
template<typename T>
Tensor2< T > & hpp::Tensor2< T >::operator= ( const Tensor2< T > &  input)

The standard assignment operator.

Parameters
inputthe right-hand side of the assignment
Template Parameters
Tthe scalar type
template<typename T >
PolarDecomposition< T > hpp::Tensor2< T >::polarDecomposition ( ) const

Polar decomposition of the tensor.

Returns
template<typename T >
void hpp::Tensor2< T >::printToStream ( std::ostream &  out) const

Pretty printing to stream.

Parameters
out
Template Parameters
Tthe scalar type
template<typename T >
T hpp::Tensor2< T >::prod ( ) const

Product of all elements.

Template Parameters
Tthe scalar type
Returns
The prodct
template<typename T >
Tensor2< T > hpp::Tensor2< T >::scaledToUnitDeterminant ( ) const

Create a tensor with the values uniformly scaled so that the new tensor has unit determinant.

Template Parameters
Tthe scalar type
Returns
the scaled tensor
template<typename T>
void hpp::Tensor2< T >::setVal ( const unsigned int  i,
const unsigned int  j,
val 
)
template<typename T>
T hpp::Tensor2< T >::spectralNorm ( ) const
template<typename T >
Tensor2< T > hpp::Tensor2< T >::sqrtMatrix ( )

Matrix square root of the tensor.

Returns
template<typename T >
T hpp::Tensor2< T >::tr ( ) const

The trace of the tensor.

Template Parameters
Tthe scalar type
Returns
the trace of this tensor, \(tr(\mathbf{A})\)
template<typename T >
Tensor2< T > hpp::Tensor2< T >::trans ( ) const

The transpose of the tensor.

Template Parameters
Tthe scalar type
Returns
the tranpose of this tensor, \(\mathbf{A}^T\)
template<typename T >
idx2d hpp::Tensor2< T >::unflat ( const unsigned int  flat_idx) const
inlineprivate

Unflatten the two indices of the tensor.

The unflattening order is dictated by the macro HPP_ARRAY_LAYOUT

Parameters
flat_idxthe flattened index
Returns
an idx2d with the unflattened indices
template<typename T >
void hpp::Tensor2< T >::writeToExistingHDF5Dataset ( H5::DataSet &  dataset,
std::vector< hsize_t >  arrayOffset 
)
template<typename T >
void hpp::Tensor2< T >::writeToExistingHDF5Dataset ( hid_t  dset_id,
hid_t  plist_id,
std::vector< hsize_t >  arrayOffset 
)
template<typename T >
void hpp::Tensor2< T >::writeToNewHDF5 ( const H5std_string &  filename,
const H5std_string &  datasetName 
)

Friends And Related Function Documentation

template<typename T>
template<typename U >
void ABPlusBTransposeAInPlace ( const hpp::Tensor2< U > &  A,
const hpp::Tensor2< U > &  B,
hpp::Tensor2< U > &  C 
)
friend
template<typename T>
template<typename U >
bool areEqual ( const Tensor2< U > &  A,
const Tensor2< U > &  B,
tol 
)
friend
template<typename T>
template<typename U >
bool areSameShape ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void assertCompatibleForContraction ( const Tensor4< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void assertCompatibleForContraction ( const Tensor4< U > &  A,
const Tensor2< U > &  B,
const Tensor2< U > &  C 
)
friend
template<typename T>
template<typename U >
void assertCompatibleForMultiplication ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void assertCompatibleForOuterProduct ( const Tensor2< U > &  A,
const Tensor2< U > &  B,
const Tensor4< U > &  C 
)
friend
template<typename T>
template<typename U >
void assertSameShape ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> contract ( const Tensor4< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
U contract ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void contractInPlace ( const Tensor4< U > &  A,
const Tensor2< U > &  B,
Tensor2< U > &  C 
)
friend
template<typename T>
template<typename U >
void identityTensor2InPlace ( unsigned int  n,
Tensor2< U > &  A 
)
friend
template<typename T>
template<typename U >
Tensor2<U> MPISum ( Tensor2< U > &  local,
MPI_Comm  comm 
)
friend
template<typename T>
template<typename U >
bool operator!= ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator* ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator* ( const Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator* ( const U &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void operator*= ( Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator+ ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator+ ( const Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator+ ( const U &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void operator+= ( Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
void operator+= ( Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator- ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator- ( const Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator- ( const U &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void operator-= ( Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
void operator-= ( Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor2<U> operator/ ( const Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
void operator/= ( Tensor2< U > &  A,
const U &  B 
)
friend
template<typename T>
template<typename U >
bool operator== ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
Tensor4<U> outer ( const Tensor2< U > &  A,
const Tensor2< U > &  B 
)
friend
template<typename T>
template<typename U >
void outerInPlace ( const Tensor2< U > &  A,
const Tensor2< U > &  B,
Tensor4< U > &  C 
)
friend
template<typename T>
template<typename U , unsigned int M, unsigned int N>
friend class Tensor2CUDA
friend

Member Data Documentation

template<typename T>
unsigned int hpp::Tensor2< T >::n1 = 0
protected

the first dimension of the tensor

template<typename T>
unsigned int hpp::Tensor2< T >::n2 = 0
protected

the second dimension of the tensor

template<typename T>
unsigned int hpp::Tensor2< T >::nVals = 0
protected

the total number of elements in the tensor

template<typename T>
friend hpp::Tensor2< T >::Tensor4< T >
private
template<typename T>
std::valarray<T> hpp::Tensor2< T >::vals
protected

the underlying 1D array


The documentation for this class was generated from the following files: