|
const Base & | Eigen () const |
|
Base & | Eigen () |
|
template<size_t r, size_t s, int Z = Rank> |
enable_if_t< Z==4, Self & > | addBlock (const MatrixX< Scalar > &M, const size_t i, const size_t j, const size_t k, const size_t l) |
|
template<int Z = Rank> |
enable_if_t< Z==4, Self & > | addBlock (const Self &T, const size_t i, const size_t j, const size_t k, const size_t l) |
|
template<int Z = Rank> |
enable_if_t< Z==4, Matrix< Scalar > > | pairWiseReduced (const size_t start_i=0, const size_t start_j=0, const size_t start_k=0, const size_t start_l=0) const |
|
template<int N, int LHSRank = Rank, int RHSRank> |
Tensor< Scalar, LHSRank+RHSRank - 2 *N > | einsum (const Tensor< Scalar, RHSRank > &rhs, const std::string &lhs_labels, const std::string &rhs_labels, const std::string &output_labels) const |
|
template<int N, int LHSRank = Rank, int RHSRank> |
Tensor< Scalar, LHSRank+RHSRank - 2 *N > | einsum (std::string contraction_string, const Tensor< Scalar, RHSRank > &rhs) const |
|
template<int N, int LHSRank = Rank> |
Tensor< Scalar, LHSRank+2 - 2 *N > | einsum (std::string contraction_string, const Matrix< Scalar > rhs) const |
|
template<int Z = Rank> |
const enable_if_t< Z==2, GQCP::Matrix< Scalar > > | asMatrix () const |
|
GQCP::Matrix< Scalar > | reshape (const size_t rows, const size_t cols) const |
|
bool | hasEqualDimensionsAs (const Self &other) const |
|
template<int Z = Rank> |
enable_if_t< Z==4, bool > | isApprox (const Self &other, const double tolerance=1.0e-12) const |
|
size_t | numberOfElements () const |
|
template<int Z = Rank> |
enable_if_t< Z==4 > | print (std::ostream &output_stream=std::cout) const |
|
template<typename _Scalar, int _Rank>
class GQCP::Tensor< _Scalar, _Rank >
An extension of the Eigen::Tensor class, with extra operations.
- Template Parameters
-
_Scalar | The scalar type of one of the elements of the tensor. |
_Rank | The rank of the tensor, i.e. the number of axes. |
We have decided to inherit from Eigen::Tensor, because we will use different hierarchies: see also: https://eigen.tuxfamily.org/dox-devel/TopicCustomizing_InheritingMatrix.html.
template<typename _Scalar , int _Rank>
template<size_t r, size_t s, int Z = Rank>
Add a matrix to a this tensor starting from given indices
- Template Parameters
-
r | indicates with which tensor index axis (0,1,2,3) the row index axis of the matrix should align |
s | indicates with which tensor index axis (0,1,2,3) the column index axis of the matrix should align |
- Parameters
-
M | a matrix |
i | starting index for the 1st index axis of the tensor |
j | starting index for the 2nd index axis of the tensor |
k | starting index for the 3rd index axis of the tensor |
l | starting index for the 4th index axis of the tensor |
- Returns
- a reference to updated this
Example: Given a rank-4 tensor of dimensions (10,10,10,10), and a matrix M of dimensions (3,3) Input : <2,0> (M, 0, 2, 1, 3): <2,0> dictates that the row index axis of the matrix aligns with the 3rd index axis of the tensor (2nd starting from 0) and that the column index axis of the matrix aligns with the 1st index axis tensor (0th starting from 0) (0, 2, 1, 3) dictates the starting indexes to which the matrix is added, given the input <2,0> this means the indices of the 2nd (indicated by the "2") and the 4th (indicated by the "3") axes are held fixed because they do not correspond to the entries <2,0>.