SyTen
syten::DenseProduct Namespace Reference

Contains helper functions related to the product of two dense tensors, see syten::prodD() for the main entry point. More...

Classes

struct  TemporaryTransposeStorage
 Temporary transpose storage class, used during tensor-tensor products. More...
 

Functions

template<Rank frank, Rank srank>
void check_dense_dims (std::array< Index, frank > const &dimA, std::array< Index, srank > const &dimB, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b)
 Asserts that the dimensions of two tensors, as described by dimA and dimB, are compatible with hte product described in c_a and c_b. More...
 
template<Rank summed, Rank frank, Rank srank, Rank rrank, typename Scalar >
void gemm_transpose (DenseTensor< frank, Scalar > const &a, DenseTensor< srank, Scalar > const &b, DenseTensor< rrank, Scalar > &r, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b)
 Product of two trivial-order tensors with subsequent transpose to obtain the desired order in the output. More...
 
template<Rank summed, Rank frank, Rank srank, typename Scalar >
DenseTensor< frank+srank - 2 *summed, Scalar > impl (DenseTensor< frank, Scalar > const &a, DenseTensor< srank, Scalar > const &b, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b, bool conjugate=false, TemporaryTransposeStorage< Scalar, frank, srank > *tts=nullptr)
 Dense tensor-tensor contraction, default implementation. More...
 
template<>
DenseTensor< 1, HighPrecimpl< 1 > (DenseTensor< 1, HighPrec > const &a, DenseTensor< 2, HighPrec > const &b, std::array< int, 1 > const &c_a, std::array< int, 2 > const &c_b, bool conjugate, TemporaryTransposeStorage< HighPrec, 1, 2 > *)
 Specialisation for a matrix-vector product of HighPrec scalars. More...
 
template<>
DenseTensor< 1, double > impl< 1 > (DenseTensor< 2, double > const &a, DenseTensor< 1, double > const &b, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b, bool conjugate, TemporaryTransposeStorage< double, 2, 1 > *)
 Specialisation for a matrix-vector product of doubles. More...
 
template<>
DenseTensor< 1, float > impl< 1 > (DenseTensor< 2, float > const &a, DenseTensor< 1, float > const &b, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b, bool conjugate, TemporaryTransposeStorage< float, 2, 1 > *)
 Specialisation for a matrix-vector product of floats. More...
 
template<>
DenseTensor< 2, HighPrecimpl< 1 > (DenseTensor< 2, HighPrec > const &a, DenseTensor< 2, HighPrec > const &b, std::array< int, 2 > const &c_a, std::array< int, 2 > const &c_b, bool conjugate, TemporaryTransposeStorage< HighPrec, 2, 2 > *)
 Specialisation for a matrix-matrix product of HighPrec scalars. More...
 
template<>
DenseTensor< 1, std::complex< double > > impl< 1 > (DenseTensor< 2, std::complex< double > > const &a, DenseTensor< 1, std::complex< double > > const &b, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b, bool conjugate, TemporaryTransposeStorage< std::complex< double >, 2, 1 > *)
 Specialisation for a matrix-vector product of complex doubles. More...
 
template<>
DenseTensor< 1, std::complex< float > > impl< 1 > (DenseTensor< 2, std::complex< float > > const &a, DenseTensor< 1, std::complex< float > > const &b, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b, bool conjugate, TemporaryTransposeStorage< std::complex< float >, 2, 1 > *)
 Specialisation for a matrix-vector product of complex floats. More...
 
template<Rank rank>
bool is_trivial_order_a (std::array< Index, rank > const &dims, std::array< int, rank > const &c_a)
 Returns true if the tensor as specified by its dimensions and contraction specifier does not have to be transposed to be usable in a TTGT-based tensor transposition if it is the first tensor to be contracted. More...
 
template<Rank rank>
bool is_trivial_order_b (std::array< Index, rank > const &dims, std::array< int, rank > const &c_b)
 Returns true if the tensor as specified by its dimensions and contraction specifier does not have to be transposed to be usable in a TTGT-based tensor transposition if it is the second tensor to be contracted. More...
 
template<Rank frank, Rank srank, Rank rrank>
bool is_trivial_order_r (std::array< Index, frank > const &dims_a, std::array< Index, srank > const &dims_b, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b)
 Returns true if r calculated as the contraction of tensors a and b defined by their dimensions and contraction specifiers does not have to be transposed according to those specifiers. More...
 
DenseTensor< 2, HighPrecmm (DenseTensor< 2, HighPrec > const &a, DenseTensor< 2, HighPrec > const &b, std::array< int, 2 > const &c_a, std::array< int, 2 > const &c_b, bool conjugate)
 Matrix-matrix product of high-precision scalars. More...
 
void mm_cm (double const *at, double const *bt, double *rt, std::size_t const dx, std::size_t const dy, std::size_t const dz)
 General column-major matrix-matrix product. More...
 
void mm_cm (float const *at, float const *bt, float *rt, std::size_t const dx, std::size_t const dy, std::size_t const dz)
 General column-major matrix-matrix product. More...
 
void mm_cm (std::complex< double > const *at, std::complex< double > const *bt, std::complex< double > *rt, std::size_t const dx, std::size_t const dy, std::size_t const dz)
 General column-major matrix-matrix product. More...
 
void mm_cm (std::complex< float > const *at, std::complex< float > const *bt, std::complex< float > *rt, std::size_t const dx, std::size_t const dy, std::size_t const dz)
 General column-major matrix-matrix product. More...
 
DenseTensor< 1, HighPrecmv (DenseTensor< 1, HighPrec > const &a, DenseTensor< 2, HighPrec > const &b, std::array< int, 1 > const &c_a, std::array< int, 2 > const &c_b, bool conjugate)
 Matrix-vector product of high-precision scalars. More...
 
DenseTensor< 1, double > mv (DenseTensor< 2, double > const &a, DenseTensor< 1, double > const &v, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b)
 Matrix-vector product of doubles. More...
 
DenseTensor< 1, float > mv (DenseTensor< 2, float > const &a, DenseTensor< 1, float > const &v, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b)
 Matrix-vector product of floats. More...
 
DenseTensor< 1, std::complex< double > > mv (DenseTensor< 2, std::complex< double > > const &a, DenseTensor< 1, std::complex< double > > const &v, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b)
 Matrix-vector product of std::complex<double> More...
 
DenseTensor< 1, std::complex< float > > mv (DenseTensor< 2, std::complex< float > > const &a, DenseTensor< 1, std::complex< float > > const &v, std::array< int, 2 > const &c_a, std::array< int, 1 > const &c_b)
 Matrix-vector product of std::complex<float> More...
 
template<Rank summed, Rank frank, Rank srank, typename Scalar >
DenseTensor< frank+srank - 2 *summed, Scalar > one_times_many (DenseTensor< frank, Scalar > const &a, DenseTensor< srank, Scalar > const &b, std::array< int, frank > const &c_a, std::array< int, srank > const &c_b, bool conjugate_a, bool conjugate_b)
 Product of a singleton tensor and a larger tensor. More...
 
template<Rank summed, Rank frank, Rank srank, typename Scalar >
DenseTensor< frank+srank - 2 *summed, Scalar > one_times_one (DenseTensor< frank, Scalar > const &a, DenseTensor< srank, Scalar > const &b, std::array< int, frank > const &, std::array< int, srank > const &, bool conjugate)
 Product of two singleton tensors. More...
 
template<std::size_t rank>
std::vector< int > reverse_dims_to_vec (std::array< Index, rank > const &in)
 Returns a vector with the entry of in in reversed order. More...
 
template<Rank summed, Rank frank, typename Scalar >
void transpose_a (DenseTensor< frank, Scalar > const &a, std::array< int, frank > const &c_a, DenseTensor< frank, Scalar > &out_a, std::array< int, frank > &out_c_a)
 Transposition of a first/a tensor to trivial order. More...
 
template<Rank summed, Rank srank, typename Scalar >
void transpose_b (DenseTensor< srank, Scalar > const &b, std::array< int, srank > const &c_b, DenseTensor< srank, Scalar > &out_b, std::array< int, srank > &out_c_b, Conj do_conj=Conj::n())
 Transposition of a second/b tensor to trivial order. More...
 
template<Rank frank, Rank srank>
void validateProductSpecifier (std::array< int, frank > const &c_a, std::array< int, srank > const &c_b, int summed=0)
 Validates a pair of product specifiers. More...
 

Detailed Description

Contains helper functions related to the product of two dense tensors, see syten::prodD() for the main entry point.