mptensor  v0.3.0
Parallel Library for Tensor Network Methods
mptensor Namespace Reference

Namespaces

 debug
 Namespace for debugging.
 
 io_helper
 
 lapack
 Namespace for the non-distributed Matrix class with LAPACK.
 
 matrix_interface
 Nameclass for Matrix inteface.
 
 mpi_wrapper
 Wrappers of MPI library.
 
 random_tensor
 
 scalapack
 Namespace for the distributed Matrix class with ScaLAPACK, PBLAS, and BLACS.
 

Classes

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

Typedefs

typedef std::complex< double > complex
 
typedef Index Axes
 
typedef Index Shape
 

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

Typedef Documentation

◆ Axes

◆ Shape

Function Documentation

◆ is_no_transpose()

bool mptensor::is_no_transpose ( const Axes axes,
const Axes axes_map,
size_t  rank 
)

◆ operator+()

Index mptensor::operator+ ( const Index ,
const Index  
)
related

◆ operator<<()

std::ostream& mptensor::operator<< ( std::ostream &  os,
const Index idx 
)
related

◆ range() [1/2]

Index mptensor::range ( const size_t  start,
const size_t  stop 
)

Create an increasing sequence. it is similar to range() in python.

◆ range() [2/2]

Index mptensor::range ( const size_t  stop)
inline

◆ 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