mptensor v0.6.0
Parallel Library for Tensor Network Methods
Loading...
Searching...
No Matches
mptensor Namespace Reference

Namespaces

namespace  debug
 Namespace for debugging.
 
namespace  interface
 Nameclass for Matrix interface.
 
namespace  internal
 Library-internal helpers and types.
 
namespace  io_helper
 
namespace  lapack
 Namespace for the non-distributed Matrix class with LAPACK.
 
namespace  matrix
 Namespace for matrix classes.
 
namespace  mpi
 
namespace  random_tensor
 
namespace  scalapack
 Namespace for the distributed Matrix class with ScaLAPACK, PBLAS, and BLACS.
 

Classes

class  BasicIndex
 
class  Tensor
 Tensor class. The main object of mptensor. More...
 

Typedefs

using complex = std::complex< double >
 
using Index = BasicIndex< std::ptrdiff_t >
 
using Axes = Index
 
using Shape = Index
 
using DTensor = Tensor< scalapack::Matrix< double > >
 
using ZTensor = Tensor< scalapack::Matrix< complex > >
 

Functions

template<typename C >
constexpr size_t value_type_tag ()
 
template<>
constexpr size_t value_type_tag< double > ()
 
template<>
constexpr size_t value_type_tag< complex > ()
 
template<typename C >
constexpr char * value_type_name ()
 
template<>
constexpr char * value_type_name< double > ()
 
template<>
constexpr char * value_type_name< complex > ()
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const BasicIndex< T > &idx)
 
template<typename T >
BasicIndex< T > operator+ (const BasicIndex< T > &lhs, const BasicIndex< T > &rhs)
 
size_t normalize_axis (std::ptrdiff_t a, size_t rank)
 
internal::UAxes normalize_axes (const Axes &axes, size_t rank)
 
size_t normalize_index (std::ptrdiff_t i, size_t n)
 
internal::UIndex normalize_index (const Index &idx, const internal::UShape &shape)
 
size_t normalize_slice_end (std::ptrdiff_t e, size_t n)
 
internal::UShape to_internal_shape (const Shape &s)
 
Index to_public (const internal::UIndex &u)
 
Index range (const std::ptrdiff_t start, const std::ptrdiff_t stop, const std::ptrdiff_t step)
 Arithmetic sequence start, start+step, ... up to (not including) stop.
 
Index range (const std::ptrdiff_t start, const std::ptrdiff_t stop)
 
Index range (const std::ptrdiff_t stop)
 
bool is_no_transpose (const internal::UAxes &axes, const internal::UAxes &axes_map, size_t rank)
 
template<typename MatrixType >
int rsvd (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt, const size_t target_rank, const size_t oversamp)
 Singular value decomposition by randomized algorithm.
 
template<typename MatrixType >
int rsvd (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt, const size_t target_rank)
 RSVD with oversamp = target_rank.
 
template<typename MatrixType , typename Func1 , typename Func2 >
int rsvd (Func1 &multiply_row, Func2 &multiply_col, const Shape &shape_row, const Shape &shape_col, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt, const size_t target_rank, const size_t oversamp)
 Singular value decomposition by randomized algorithm.
 
template<typename MatrixType , typename Func1 , typename Func2 >
int rsvd (Func1 &multiply_row, Func2 &multiply_col, const Shape &shape_row, const Shape &shape_col, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt, const size_t target_rank)
 RSVD with oversamp = target_rank.
 
void set_seed (unsigned int seed)
 Set seed for random number generator.
 
template<typename MatrixType >
Tensor< MatrixType > transpose (Tensor< MatrixType > T, const Axes &axes)
 Transposition of tensor with lazy evaluation.
 
template<typename MatrixType >
Tensor< MatrixType > transpose (const Tensor< MatrixType > &T, const Axes &axes, size_t urank_new)
 Transposition of tensor without lazy evaluation.
 
template<typename MatrixType >
Tensor< MatrixType > reshape (const Tensor< MatrixType > &T, const Shape &shape_new)
 Change the shape of tensor.
 
template<typename MatrixType >
Tensor< MatrixType > slice (const Tensor< MatrixType > &T, std::ptrdiff_t n_axes, std::ptrdiff_t i_begin, std::ptrdiff_t i_end)
 Slice a tensor.
 
template<typename MatrixType >
Tensor< MatrixType > slice (const Tensor< MatrixType > &T, const Index &index_begin, const Index &index_end)
 Slice a tensor.
 
template<typename MatrixType >
Tensor< MatrixType > extend (const Tensor< MatrixType > &T, const Shape &shape_new)
 Extend the size of a tensor.
 
template<typename MatrixType >
MatrixType::value_type trace (const Tensor< MatrixType > &M)
 Trace of matrix (rank-2 tensor)
 
template<typename MatrixType >
MatrixType::value_type trace (const Tensor< MatrixType > &T, const Axes &axes_1, const Axes &axes_2)
 Full trace of tensor.
 
template<typename MatrixType >
MatrixType::value_type trace (const Tensor< MatrixType > &A, const Tensor< MatrixType > &B, const Axes &axes_a, const Axes &axes_b)
 Full contraction of two tensors.
 
template<typename MatrixType >
Tensor< MatrixType > contract (const Tensor< MatrixType > &T, const Axes &axes_1, const Axes &axes_2)
 Partial trace of tensor.
 
template<typename MatrixType >
Tensor< MatrixType > tensordot (const Tensor< MatrixType > &a, const Tensor< MatrixType > &b, const Axes &axes_a, const Axes &axes_b)
 Compute tensor dot product.
 
template<typename MatrixType >
Tensor< MatrixType > kron (const Tensor< MatrixType > &a, const Tensor< MatrixType > &b)
 Compute the Kronecker product.
 
template<typename MatrixType >
int svd (const Tensor< MatrixType > &a, std::vector< double > &s)
 Singular value decomposition for rank-2 tensor (matrix)
 
template<typename MatrixType >
int svd (const Tensor< MatrixType > &a, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt)
 Singular value decomposition for rank-2 tensor (matrix)
 
template<typename MatrixType >
int svd (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, std::vector< double > &s)
 Singular value decomposition for tensor.
 
template<typename MatrixType >
int svd (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt)
 Singular value decomposition for tensor.
 
template<typename MatrixType >
int psvd (const Tensor< MatrixType > &a, std::vector< double > &s, const size_t target_rank)
 Partial SVD for rank-2 tensor (matrix)
 
template<typename MatrixType >
int psvd (const Tensor< MatrixType > &a, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt, const size_t target_rank)
 Partial SVD for rank-2 tensor (matrix)
 
template<typename MatrixType >
int psvd (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, std::vector< double > &s, const size_t target_rank)
 Partial SVD for tensor.
 
template<typename MatrixType >
int psvd (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, Tensor< MatrixType > &u, std::vector< double > &s, Tensor< MatrixType > &vt, const size_t target_rank)
 Partial SVD for tensor.
 
template<typename MatrixType >
int qr (const Tensor< MatrixType > &a, Tensor< MatrixType > &q, Tensor< MatrixType > &r)
 QR decomposition of matrix (rank-2 tensor)
 
template<typename MatrixType >
int qr (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, Tensor< MatrixType > &q, Tensor< MatrixType > &r)
 QR decomposition of tensor.
 
template<typename MatrixType >
int eigh (const Tensor< MatrixType > &a, std::vector< double > &eigval, Tensor< MatrixType > &eigvec)
 
template<typename MatrixType >
int eigh (const Tensor< MatrixType > &a, std::vector< double > &eigval)
 
template<typename MatrixType >
int eigh (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, std::vector< double > &eigval, Tensor< MatrixType > &eigvec)
 
template<typename MatrixType >
int eigh (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, std::vector< double > &w)
 Compute the eigenvalues of a complex Hermitian or real symmetric tensor.
 
template<typename MatrixType >
int eigh (const Tensor< MatrixType > &a, const Axes &axes_row_a, const Axes &axes_col_a, const Tensor< MatrixType > &b, const Axes &axes_row_b, const Axes &axes_col_b, std::vector< double > &eigval, Tensor< MatrixType > &eigvec)
 
template<typename MatrixType >
int eig (const Tensor< MatrixType > &a, std::vector< complex > &w, typename Tensor< MatrixType >::template rebind< complex > &z)
 Compute the eigenvalues and eigenvectors of a general matrix (rank-2 tensor)
 
template<typename MatrixType >
int eig (const Tensor< MatrixType > &a, std::vector< complex > &w)
 Compute only the eigenvalues of a general matrix (rank-2 tensor)
 
template<typename MatrixType >
int eig (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, std::vector< complex > &w, typename Tensor< MatrixType >::template rebind< complex > &z)
 Compute the eigenvalues and eigenvectors of a general tensor.
 
template<typename MatrixType >
int eig (const Tensor< MatrixType > &a, const Axes &axes_row, const Axes &axes_col, std::vector< complex > &w)
 Compute the eigenvalues of a general tensor.
 
template<typename MatrixType >
int solve (const Tensor< MatrixType > &a, const std::vector< typename MatrixType::value_type > &b, std::vector< typename MatrixType::value_type > &x)
 Solve linear equation \( A\vec{x}=\vec{b}\).
 
template<typename MatrixType >
int solve (const Tensor< MatrixType > &a, const Tensor< MatrixType > &b, Tensor< MatrixType > &x)
 Solve linear equation \( AX=B\).
 
template<typename MatrixType >
int solve (const Tensor< MatrixType > &a, const Tensor< MatrixType > &b, Tensor< MatrixType > &x, const Axes &axes_row_a, const Axes &axes_col_a, const Axes &axes_row_b, const Axes &axes_col_b)
 Solve linear equation \( AX=B\).
 
template<typename MatrixType >
Tensor< MatrixType > operator+ (Tensor< MatrixType > rhs)
 Unary plus.
 
template<typename MatrixType >
Tensor< MatrixType > operator- (Tensor< MatrixType > rhs)
 Unary minus.
 
template<typename MatrixType >
Tensor< MatrixType > operator+ (Tensor< MatrixType > lhs, const Tensor< MatrixType > &rhs)
 Addition.
 
template<typename MatrixType >
Tensor< MatrixType > operator- (Tensor< MatrixType > lhs, const Tensor< MatrixType > &rhs)
 Subtraction.
 
template<typename MatrixType , typename D >
Tensor< MatrixType > operator* (Tensor< MatrixType > lhs, D rhs)
 Tensor-scalar multiplication.
 
template<typename MatrixType , typename D >
Tensor< MatrixType > operator/ (Tensor< MatrixType > lhs, D rhs)
 Scalar division.
 
template<typename MatrixType , typename D >
Tensor< MatrixType > operator* (D lhs, Tensor< MatrixType > rhs)
 Scalar-tensor multiplication.
 
template<typename MatrixType >
Tensor< MatrixType > sqrt (Tensor< MatrixType > t)
 Take square-root of each element.
 
template<typename MatrixType >
Tensor< MatrixType > conj (Tensor< MatrixType > t)
 Take conjugate of each element.
 
template<typename MatrixType >
double max (const Tensor< MatrixType > &t)
 Return the maximum element. For complex, same as max_abs().
 
template<typename MatrixType >
double min (const Tensor< MatrixType > &t)
 Return the minimum element. For complex, same as min_abs().
 
template<typename MatrixType >
double max_abs (const Tensor< MatrixType > &t)
 Return maximum of the absolute value of an element.
 
template<typename MatrixType >
double min_abs (const Tensor< MatrixType > &t)
 Return minimum of the absolute value of an element.
 
template<typename MatrixType >
std::ostream & operator<< (std::ostream &out, const Tensor< MatrixType > &t)
 Output elements of tensor in numpy style.
 

Typedef Documentation

◆ DTensor

using mptensor::DTensor = typedef Tensor<scalapack::Matrix<double> >

◆ ZTensor

using mptensor::ZTensor = typedef Tensor<scalapack::Matrix<complex> >

Function Documentation

◆ is_no_transpose()

bool mptensor::is_no_transpose ( const internal::UAxes &  axes,
const internal::UAxes &  axes_map,
size_t  rank 
)

◆ value_type_name()

template<typename C >
constexpr char * mptensor::value_type_name ( )
constexpr

◆ value_type_name< complex >()

template<>
constexpr char * mptensor::value_type_name< complex > ( )
constexpr

◆ value_type_name< double >()

template<>
constexpr char * mptensor::value_type_name< double > ( )
constexpr

◆ value_type_tag()

template<typename C >
constexpr size_t mptensor::value_type_tag ( )
constexpr

◆ value_type_tag< complex >()

template<>
constexpr size_t mptensor::value_type_tag< complex > ( )
constexpr

◆ value_type_tag< double >()

template<>
constexpr size_t mptensor::value_type_tag< double > ( )
constexpr