occ
Loading...
Searching...
No Matches
einsum.h File Reference
#include <array>
#include <occ/core/linear_algebra.h>
#include <stdexcept>
#include <string_view>
#include <type_traits>
#include <unsupported/Eigen/CXX11/Tensor>
Include dependency graph for einsum.h:

Namespaces

namespace  occ
 
namespace  occ::qm
 quantum mechanics/quantum chemistry functionality including Hartree-Fock and more
 
namespace  occ::qm::cc
 
namespace  occ::qm::cc::detail
 

Functions

void occ::qm::cc::detail::permute (const double *in, const Eigen::Index *dims, int rank, const int *perm, double *out)
 out = in with out.dim(k) = in.dim(perm[k]); column-major, rank <= 6
 
void occ::qm::cc::detail::einsum_shape (std::string_view spec, const Eigen::Index *da, int ra, const Eigen::Index *db, int rb, Eigen::Index *dc, int rc)
 the result's dimensions for spec on operands of the given shapes
 
void occ::qm::cc::detail::einsum_contract (std::string_view spec, const double *a, const Eigen::Index *da, int ra, const double *b, const Eigen::Index *db, int rb, double *out, int rc)
 the contraction itself, into out (sized from einsum_shape)
 
template<typename E >
constexpr int occ::qm::cc::detail::rank_of ()
 
template<typename E >
decltype(auto) occ::qm::cc::detail::evaluated (const E &e)
 
template<int R>
std::array< Eigen::Index, R > occ::qm::cc::detail::dims_of (const Eigen::Tensor< double, R > &t)
 
template<int R>
Eigen::Tensor< double, R > occ::qm::cc::transpose (const Eigen::Tensor< double, R > &a, const std::type_identity_t< std::array< int, R > > &perm)
 numpy a.transpose(perm): out.dimension(k) = a.dimension(perm[k]), evaluated
 
template<int RC, typename A , typename B >
Eigen::Tensor< double, RC > occ::qm::cc::einsum (std::string_view spec, const A &a, const B &b)
 numpy einsum of two operands with an RC-index result: a label in both inputs and not in the output is summed; a label may not repeat within one operand, nor appear in both inputs and the output (no batch or trace terms).
 
template<int R>
double occ::qm::cc::dot (const Eigen::Tensor< double, R > &a, const Eigen::Tensor< double, R > &b)
 sum_x a(x) b(x) over two tensors of the same shape
 
template<int R>
double occ::qm::cc::norm (const Eigen::Tensor< double, R > &a)
 Frobenius norm of a tensor.
 
template<int R>
double occ::qm::cc::max_abs (const Eigen::Tensor< double, R > &a)
 largest |a(x)|
 
Eigen::Tensor< double, 2 > occ::qm::cc::as_tensor (const occ::Mat &m)
 a matrix as a 2-index tensor (both column-major: a plain copy)
 
occ::Mat occ::qm::cc::as_matrix (const Eigen::Tensor< double, 2 > &t)
 a 2-index tensor as a matrix