1#ifndef TENSOR_INTERFACE_CYCLOPS_IMPL_H_
2#define TENSOR_INTERFACE_CYCLOPS_IMPL_H_
11 template <
typename Scalar, std::
size_t Rank>
12 using TType = CTF::Tensor<Scalar>;
13 template <
typename Scalar, std::
size_t Rank>
14 using cTType =
const CTF::Tensor<Scalar>;
16 template <
typename Scalar, std::
size_t Rank>
18 template <
typename Scalar, std::
size_t Rank>
26 if(i == 0) {
return 'i'; }
27 if(i == 1) {
return 'j'; }
28 if(i == 2) {
return 'k'; }
29 if(i == 3) {
return 'l'; }
30 if(i == 4) {
return 'm'; }
31 if(i == 5) {
return 'n'; }
32 if(i == 6) {
return 'o'; }
33 if(i == 100) {
return 'z'; }
34 if(i == 101) {
return 'y'; }
35 if(i == 102) {
return 'x'; }
36 if(i == 103) {
return 'w'; }
37 if(i == 104) {
return 'v'; }
38 if(i == 105) {
return 'u'; }
39 if(i == 106) {
return 't'; }
43 template <std::
size_t Rank>
44 static constexpr std::array<char, Rank>
get_idx(std::size_t shift = 0)
46 std::array<char, Rank> out;
47 for(std::size_t i = 0; i < Rank; i++) { out[i] =
idx(i + shift); }
52 template <
typename Scalar, std::
size_t Rank>
55 template <
typename Scalar,
int Rank>
96 template <
typename Scalar,
int Rank>
99 template <
typename Scalar,
int Rank>
102 template <
typename Scalar,
int Rank>
105 template <
typename Scalar,
int Rank>
108 template <
typename Scalar,
int Rank>
112 template <
typename Scalar,
int Rank>
116 template <
typename Scalar,
int Rank>
120 template <
typename Scalar,
int Rank>
123 template <
typename Scalar, std::
size_t Rank,
typename Expr1,
typename Expr2>
124 static void addScale(
const Expr1& src, Expr2& dst,
const Scalar& scale);
131 seq::iseq<Indextype, Is1...> S1,
132 seq::iseq<Indextype, Is2...> S2,
133 seq::iseq<Indextype, Ist...> St);
135 template <
typename Scalar, std::size_t Rank1, std::size_t Rank2,
Indextype... Is>
138 template <
typename Scalar, std::size_t Rank,
Indextype... p>
141 template <
typename Scalar, std::size_t Rank,
Indextype... p>
147 template <
typename Scalar,
int Rank1, std::
size_t Rank2>
151 template <
typename Scalar, std::
size_t Rank1, std::
size_t Rank2>
153 const std::array<Indextype, Rank2>& offsets,
154 const std::array<Indextype, Rank2>& extents,
157 template <
typename Scalar,
int Rank1, std::
size_t Rank2>
159 slice(
TType<Scalar, Rank1>& T,
const std::array<Indextype, Rank2>& offsets,
const std::array<Indextype, Rank2>& extents);
161 template <
typename Scalar, std::
size_t Rank>
167#ifndef XPED_COMPILED_LIB
CTF::Tensor< Scalar > TType
Definition: PlainInterface_Cyclops_impl.cpp:13
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 constexpr std::array< char, Rank > get_idx(std::size_t shift=0)
Definition: TensorInterface_Cyclops_impl.hpp:44
static auto contract_helper(const TType< Scalar, Rank1 > &T1, const TType< Scalar, Rank2 > &T2, seq::iseq< Indextype, Is1... > S1, seq::iseq< Indextype, Is2... > S2, seq::iseq< Indextype, Ist... > St)
Definition: TensorInterface_Array_impl.hpp:237
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)
static TType< Scalar, Rank > shuffle(const TType< Scalar, Rank > &T)
Definition: TensorInterface_Array_impl.hpp:307
nda::index_t Indextype
Definition: TensorInterface_Array_impl.hpp:54
static constexpr char idx(const Indextype &i)
Definition: TensorInterface_Cyclops_impl.hpp:24
static std::string print(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 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 void setRandom(TType< Scalar, Rank > &T)
static TType< Scalar, Rank > construct(const std::array< Indextype, Rank > &dims, mpi::XpedWorld &world=mpi::getUniverse())
Definition: TensorInterface_Array_impl.hpp:58
static const Scalar * get_raw_data(const TType< Scalar, Rank > &T)
Definition: TensorInterface_Array_impl.hpp:130
static TType< Scalar, Rank > tensorProd(const TType< Scalar, Rank > &T1, const TType< Scalar, Rank > &T2)
Definition: TensorInterface_Array_impl.hpp:153
static TType< Scalar, Rank1+Rank2 - sizeof...(Is)> contract(const TType< Scalar, Rank1 > &T1, const TType< Scalar, Rank2 > &T2)
Definition: TensorInterface_Array_impl.hpp:247
nda::const_dense_array_ref< Scalar, Rank > cMapTType
Definition: TensorInterface_Array_impl.hpp:51