GraceQ/MPS2
A high-performance matrix product state algorithms library based on GraceQ/tensor
Public Member Functions | List of all members
gqmps2::TenVec< TenT > Class Template Reference

A fix size tensor vector. More...

#include <ten_vec.h>

Inheritance diagram for gqmps2::TenVec< TenT >:
gqmps2::DuoVector< TenT >

Public Member Functions

 TenVec (const size_t size)
 Create a TenVec using its size. More...
 
void LoadTen (const size_t idx, const std::string &file)
 Load element tensor from a file. More...
 
void DumpTen (const size_t idx, const std::string &file) const
 Dump element tensor to a file. More...
 
void DumpTen (const size_t idx, const std::string &file, const bool release_mem=false)
 Dump element tensor to a file. More...
 
- Public Member Functions inherited from gqmps2::DuoVector< TenT >
 DuoVector (void)=default
 Default constructor.
 
 DuoVector (const size_t size)
 Create a DuoVector using its size. More...
 
 DuoVector (const DuoVector &duovec)
 Create a DuoVector by copying another DuoVector. More...
 
 DuoVector (DuoVector &&duovec) noexcept
 Create a DuoVector by moving raw data from another DuoVector instance. More...
 
DuoVector< TenT > & operator= (const DuoVector &rhs)
 Copy a DuoVector. More...
 
DuoVector< TenT > & operator= (DuoVector &&rhs) noexcept
 Move a DuoVector. More...
 
virtual ~DuoVector (void)
 Destruct a DuoVector. More...
 
const TenT & operator[] (const size_t idx) const
 Element getter. More...
 
TenT & operator[] (const size_t idx)
 Element setter. More...
 
const TenT * operator() (const size_t idx) const
 Pointer-of-element getter. More...
 
TenT *& operator() (const size_t idx)
 Pointer-of-element setter. More...
 
TenT & front (void)
 Access the first element.
 
const TenT & front (void) const
 
TenT & back (void)
 Access the last element.
 
const TenT & back (void) const
 
const std::vector< const TenT *> cdata (void) const
 Read-only raw data access.
 
void alloc (const size_t idx)
 Allocate memory of the element at given index. More...
 
void dealloc (const size_t idx)
 Deallocate memory of the element at given index. More...
 
void clear (void)
 Deallocate all elements.
 
size_t size (void) const
 Get the size of the DuoVector.
 
bool empty (void) const
 Check whether the vector is empty.
 

Detailed Description

template<typename TenT>
class gqmps2::TenVec< TenT >

A fix size tensor vector.

Template Parameters
TenTType of the element tensor.

Constructor & Destructor Documentation

◆ TenVec()

template<typename TenT>
gqmps2::TenVec< TenT >::TenVec ( const size_t  size)
inline

Create a TenVec using its size.

Parameters
sizeThe size of the vector.

Member Function Documentation

◆ DumpTen() [1/2]

template<typename TenT>
void gqmps2::TenVec< TenT >::DumpTen ( const size_t  idx,
const std::string &  file 
) const
inline

Dump element tensor to a file.

Parameters
idxThe index of the element.
fileThe element tensor will be dumped to this file.

◆ DumpTen() [2/2]

template<typename TenT>
void gqmps2::TenVec< TenT >::DumpTen ( const size_t  idx,
const std::string &  file,
const bool  release_mem = false 
)
inline

Dump element tensor to a file.

Parameters
idxThe index of the element.
fileThe element tensor will be dumped to this file.
release_memWhether release memory after dump.

◆ LoadTen()

template<typename TenT>
void gqmps2::TenVec< TenT >::LoadTen ( const size_t  idx,
const std::string &  file 
)
inline

Load element tensor from a file.

Parameters
idxThe index of the element.
fileThe file which contains the tensor to be loaded.

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