1#ifndef TENSOR_INTERFACE_EIGEN_IMPL_H_
2#define TENSOR_INTERFACE_EIGEN_IMPL_H_
5#include <unsupported/Eigen/CXX11/Tensor>
14 template <
typename Scalar, std::
size_t Rank>
15 using TType = Eigen::Tensor<Scalar, Rank>;
16 template <
typename Scalar, std::
size_t Rank>
17 using cTType =
const Eigen::Tensor<Scalar, Rank>;
19 template <
typename Scalar, std::
size_t Rank>
20 using MapTType = Eigen::TensorMap<TType<Scalar, Rank>>;
21 template <
typename Scalar, std::
size_t Rank>
22 using cMapTType = Eigen::TensorMap<cTType<Scalar, Rank>>;
28 template <
typename Scalar, std::
size_t Rank>
31 template <
typename Scalar,
int Rank>
34 template <
typename Scalar,
int Rank>
38 template <
typename Scalar, std::
size_t Rank>
41 template <
typename Scalar, std::
size_t Rank>
45 template <
typename Scalar,
int Rank>
48 template <
typename Scalar,
int Rank>
51 template <
typename Scalar,
int Rank>
54 template <
typename Scalar,
int Rank>
57 template <
typename Scalar,
int Rank>
61 template <
typename Scalar,
int Rank>
64 template <
typename Scalar,
int Rank>
68 template <
typename Scalar,
int Rank>
72 template <
typename Scalar,
int Rank>
75 template <
typename Scalar, std::
size_t Rank,
typename Expr1,
typename Expr2>
76 static void addScale(
const Expr1& src, Expr2& dst,
const Scalar& scale);
79 template <
typename Scalar, std::size_t Rank1, std::size_t Rank2,
Indextype... Is>
82 template <
typename Scalar, std::size_t Rank,
Indextype... p>
85 template <
typename Scalar, std::size_t Rank,
Indextype... p>
89 static const Eigen::TensorShufflingOp<const std::array<Indextype, Eigen::internal::traits<Expr>::NumDimensions>,
const Expr>
100 template <
typename Scalar,
int Rank1, std::
size_t Rank2>
104 template <
typename Scalar, std::
size_t Rank1, std::
size_t Rank2>
106 const std::array<Indextype, Rank2>& offsets,
107 const std::array<Indextype, Rank2>& extents,
110 template <
typename Scalar,
int Rank1, std::
size_t Rank2>
111 static const Eigen::TensorSlicingOp<const std::array<Indextype, Rank2>,
const std::array<Indextype, Rank2>,
const TType<Scalar, Rank1>>
112 slice(
TType<Scalar, Rank1>& T,
const std::array<Indextype, Rank2>& offsets,
const std::array<Indextype, Rank2>& extents);
114 template <
typename Scalar,
int Rank1, std::
size_t Rank2>
115 static const Eigen::TensorReshapingOp<const std::array<Indextype, Rank2>,
const TType<Scalar, Rank1>>
118 template <
typename Scalar,
int Rank>
124#ifndef XPED_COMPILED_LIB
XpedWorld & getUniverse()
Definition: Mpi.hpp:49
static auto shuffle_view(const Expr &T)
Definition: TensorInterface_Array_impl.hpp:300
nda::dense_array< Scalar, Rank > TType
Definition: TensorInterface_Array_impl.hpp:44
static void setZero(TType< Scalar, Rank > &T)
const nda::dense_array< Scalar, Rank > cTType
Definition: TensorInterface_Array_impl.hpp:46
static void setConstant(TType< Scalar, Rank > &T, const Scalar &val)
static TType< Scalar, Rank > construct(const MapTType< Scalar, Rank > &map)
static cTType< Scalar, Rank > construct(const cMapTType< Scalar, Rank > &map)
static Scalar * get_raw_data(TType< Scalar, Rank > &T)
static void addScale(const Expr1 &src, Expr2 &dst, const Scalar &scale)
static std::array< Indextype, Rank > dimensions(const TType< Scalar, Rank > &T)
static TType< Scalar, Rank2 > reshape(const TType< Scalar, Rank1 > &T, const std::array< Indextype, Rank2 > &dims)
static void setSubTensor(TType< Scalar, Rank1 > &T, const std::array< Indextype, Rank2 > &offsets, const std::array< Indextype, Rank2 > &extents, const TType< Scalar, Rank1 > &S)
static void setVal(TType< Scalar, Rank > &T, const std::array< Indextype, Rank > &index, const Scalar &val)
nda::index_t Indextype
Definition: TensorInterface_Array_impl.hpp:54
static std::string print(const TType< Scalar, Rank > &T)
static TType< Scalar, Rank > shuffle(const TType< Scalar, Rank > &T)
static auto slice(TType< Scalar, Rank1 > &T, const std::array< Indextype, Rank2 > &offsets, const std::array< Indextype, Rank2 > &extents)
Definition: TensorInterface_Array_impl.hpp:358
static const Scalar * get_raw_data(const TType< Scalar, Rank > &T)
static Scalar getVal(const TType< Scalar, Rank > &T, const std::array< Indextype, Rank > &index)
nda::dense_array_ref< Scalar, Rank > MapTType
Definition: TensorInterface_Array_impl.hpp:49
static MapTType< Scalar, Rank > Map(Scalar *data, const std::array< Indextype, Rank > &dims)
static void setRandom(TType< Scalar, Rank > &T)
static TType< Scalar, Rank > tensorProd(const TType< Scalar, Rank > &T1, const TType< Scalar, Rank > &T2)
static TType< Scalar, Rank > construct(const std::array< Indextype, Rank > &dims, mpi::XpedWorld &world=mpi::getUniverse())
Definition: TensorInterface_Array_impl.hpp:58
static TType< Scalar, Rank1+Rank2 - sizeof...(Is)> contract(const TType< Scalar, Rank1 > &T1, const TType< Scalar, Rank2 > &T2)
static TType< Scalar, Rank > shuffle(const TType< Scalar, Rank > &T, seq::iseq< Indextype, p... > s)
static TType< Scalar, Rank2 > reshape(const TType< Scalar, Rank1 > &T, const std::array< Indextype, Rank2 > &dims)
Definition: TensorInterface_Array_impl.hpp:350
static cMapTType< Scalar, Rank > cMap(const Scalar *data, const std::array< Indextype, Rank > &dims)
nda::const_dense_array_ref< Scalar, Rank > cMapTType
Definition: TensorInterface_Array_impl.hpp:51