ExaTN
Public Member Functions | List of all members
exatn::numerics::Tensor Class Reference

Public Member Functions

 Tensor (const std::string &name, const TensorShape &shape, const TensorSignature &signature)
 
 Tensor (const std::string &name, const TensorShape &shape)
 
template<typename T >
 Tensor (const std::string &name, std::initializer_list< T > extents, std::initializer_list< std::pair< SpaceId, SubspaceId >> subspaces)
 
template<typename T >
 Tensor (const std::string &name, const std::vector< T > &extents, const std::vector< std::pair< SpaceId, SubspaceId >> &subspaces)
 
template<typename T >
 Tensor (const std::string &name, std::initializer_list< T > extents)
 
template<typename T >
 Tensor (const std::string &name, const std::vector< T > &extents)
 
 Tensor (const std::string &name)
 
 Tensor (const std::string &name, const Tensor &left_tensor, const Tensor &right_tensor, const std::vector< TensorLeg > &contraction)
 
 Tensor (const Tensor &tensor)=default
 
Tensoroperator= (const Tensor &tensor)=default
 
 Tensor (Tensor &&tensor) noexcept=default
 
Tensoroperator= (Tensor &&tensor) noexcept=default
 
void printIt () const
 
void printItFile (std::ofstream &output_file) const
 
const std::string & getName () const
 
unsigned int getRank () const
 
const TensorShapegetShape () const
 
const TensorSignaturegetSignature () const
 
DimExtent getDimExtent (unsigned int dim_id) const
 
const std::vector< DimExtent > & getDimExtents () const
 
SpaceId getDimSpaceId (unsigned int dim_id) const
 
SubspaceId getDimSubspaceId (unsigned int dim_id) const
 
std::pair< SpaceId, SubspaceId > getDimSpaceAttr (unsigned int dim_id) const
 
bool isCongruentTo (const Tensor &another) const
 
void deleteDimension (unsigned int dim_id)
 
void appendDimension (std::pair< SpaceId, SubspaceId > subspace, DimExtent dim_extent)
 
void appendDimension (DimExtent dim_extent)
 
std::shared_ptr< TensorcreateSubtensor (const std::string &name, const std::vector< int > &mode_mask, int mask_val)
 
void setElementType (TensorElementType element_type)
 
TensorElementType getElementType () const
 
void registerIsometry (const std::vector< unsigned int > &isometry)
 
const std::list< std::vector< unsigned int > > & retrieveIsometries () const
 
TensorHashType getTensorHash () const
 

Constructor & Destructor Documentation

◆ Tensor() [1/6]

exatn::numerics::Tensor::Tensor ( const std::string &  name,
const TensorShape shape,
const TensorSignature signature 
)

Create a tensor by providing its name, shape and signature.

◆ Tensor() [2/6]

exatn::numerics::Tensor::Tensor ( const std::string &  name,
const TensorShape shape 
)

Create a tensor by providing its name and shape. The signature defaults to SOME_SPACE spaces and lbound=0 subspaces.

◆ Tensor() [3/6]

template<typename T >
exatn::numerics::Tensor::Tensor ( const std::string &  name,
std::initializer_list< T >  extents,
std::initializer_list< std::pair< SpaceId, SubspaceId >>  subspaces 
)

Create a tensor by providing its name, shape and signature from scratch.

◆ Tensor() [4/6]

template<typename T >
exatn::numerics::Tensor::Tensor ( const std::string &  name,
std::initializer_list< T >  extents 
)

Create a tensor by providing its name and shape from scratch. The signature defaults to SOME_SPACE spaces and lbound=0 subspaces.

◆ Tensor() [5/6]

exatn::numerics::Tensor::Tensor ( const std::string &  name)

Create a rank-0 tensor (scalar).

◆ Tensor() [6/6]

exatn::numerics::Tensor::Tensor ( const std::string &  name,
const Tensor left_tensor,
const Tensor right_tensor,
const std::vector< TensorLeg > &  contraction 
)

Create a tensor by contracting two other tensors. The vector of tensor legs specifies the tensor contraction pattern: contraction[] describes dimensions of both input tensors, first left tensor dimensions, then right tensor dimensions: contraction.size() = left_rank + right_rank; Output tensor id = 0; Left input tensor id = 1; Right input tensor id = 2.

Member Function Documentation

◆ appendDimension()

void exatn::numerics::Tensor::appendDimension ( std::pair< SpaceId, SubspaceId >  subspace,
DimExtent  dim_extent 
)

Appends a new dimension to the tensor at the end, increasing the tensor rank by one.

◆ createSubtensor()

std::shared_ptr< Tensor > exatn::numerics::Tensor::createSubtensor ( const std::string &  name,
const std::vector< int > &  mode_mask,
int  mask_val 
)

Creates a new tensor from the current tensor by selecting a subset of its modes. Vector mode_mask must have the size equal to the original tensor rank: mode_mask[i] == mask_val will select dimension i for appending to the subtensor.

◆ deleteDimension()

void exatn::numerics::Tensor::deleteDimension ( unsigned int  dim_id)

Deletes a specific tensor dimension, reducing the tensor rank by one.

◆ getDimExtent()

DimExtent exatn::numerics::Tensor::getDimExtent ( unsigned int  dim_id) const

Get the extent of a specific tensor dimension.

◆ getDimExtents()

const std::vector< DimExtent > & exatn::numerics::Tensor::getDimExtents ( ) const

Get the extents of all tensor dimensions.

◆ getDimSpaceId()

SpaceId exatn::numerics::Tensor::getDimSpaceId ( unsigned int  dim_id) const

Get the space/subspace id for a specific tensor dimension.

◆ getElementType()

TensorElementType exatn::numerics::Tensor::getElementType ( ) const

Returns the tensor element type.

◆ getName()

const std::string & exatn::numerics::Tensor::getName ( ) const

Get tensor name.

◆ getRank()

unsigned int exatn::numerics::Tensor::getRank ( ) const

Get the tensor rank (order).

◆ getShape()

const TensorShape & exatn::numerics::Tensor::getShape ( ) const

Get the tensor shape.

◆ getSignature()

const TensorSignature & exatn::numerics::Tensor::getSignature ( ) const

Get the tensor signature.

◆ getTensorHash()

TensorHashType exatn::numerics::Tensor::getTensorHash ( ) const

Get the unique integer tensor id.

◆ isCongruentTo()

bool exatn::numerics::Tensor::isCongruentTo ( const Tensor another) const

Returns TRUE if the tensor is congruent to another tensor, that is, it has the same shape and signature.

◆ printIt()

void exatn::numerics::Tensor::printIt ( ) const

Print.

◆ registerIsometry()

void exatn::numerics::Tensor::registerIsometry ( const std::vector< unsigned int > &  isometry)

Registers an isometry in the tensor.

◆ retrieveIsometries()

const std::list< std::vector< unsigned int > > & exatn::numerics::Tensor::retrieveIsometries ( ) const

Retrieves the list of all registered isometries in the tensor.

◆ setElementType()

void exatn::numerics::Tensor::setElementType ( TensorElementType  element_type)

Sets the tensor element type.


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