12#ifndef __cxz_op_types_cc_h__
13#define __cxz_op_types_cc_h__
27 template <
class F,
class IndexT>
34 template <
class IndexT>
42 template <
class F,
class...
Args>
72 template <
typename T,
class IndexT>
74 mData(a.data()+
ind->pos()),
78 template <
typename T,
class IndexT>
80 mData(data+
ind->pos()),
84 template <
typename T,
class IndexT>
87 mData = data+
ind->pos();
92 template <
typename T,
class IndexT>
97 return vreg(mData,pos);
100 return mData[pos.val()];
104 template <
typename T,
class IndexT>
110 template <
typename T,
class IndexT>
114 return mIndex->stepSize(
id);
117 template <
typename T,
class IndexT>
123 template <
typename T,
class IndexT>
129 template <
typename T,
class IndexT>
139 template <
class IndexT,
class Op>
146 template <
class IndexT,
class Op>
147 template <
class PosT>
150 return mOp(mFp(pos));
153 template <
class IndexT,
class Op>
159 template <
class IndexT,
class Op>
163 return mIndex->stepSize(
id);
166 template <
class IndexT,
class Op>
172 template <
class IndexT,
class Op>
182 template <
typename T,
class IndexT>
188 template <
typename T,
class IndexT>
192 if(mC.size() != mIndex->pmax().val()){
193 mC.resize(mIndex->pmax().val());
198 template <
typename T,
class IndexT>
204 "size-mismatch: expected " << mC.size() <<
", got " << c.size());
205 std::transform(c.begin(), c.end(), mC.begin(), [](
const auto& x) { return x; } );
209 template <
typename T,
class IndexT>
215 template <
typename T,
class IndexT>
221 template <
typename T,
class IndexT>
228 OI::a(mIndex, [](
auto&
a1,
const auto&
a2) {
a1 =
a2; }, o);
232 template <
typename T,
class IndexT>
236 OI::a(mIndex, [](
auto&
a1,
const auto&
a2) {
a1 +=
a2; }, o);
240 template <
typename T,
class IndexT>
243 OI::a(mIndex, [](
auto&
a1,
const auto&
a2) {
a1 =
a2; }, o);
247 template <
typename T,
class IndexT>
248 template <
class PosT>
253 return vreg(mC.data(),pos);
258 return vreg(
const_cast<const T*
>(mC.data()),pos);
262 return mC[pos.val()];
266 template <
typename T,
class IndexT>
272 template <
typename T,
class IndexT>
276 return mIndex->stepSize(
id);
279 template <
typename T,
class IndexT>
285 template <
typename T,
class IndexT>
295 template <
typename T,
class IndexT>
297 mData(a.data()+
ind->pos()),
301 template <
typename T,
class IndexT>
303 mData(data+
ind->pos()),
307 template <
typename T,
class IndexT>
310 mData = data+
ind->pos();
315 template <
typename T,
class IndexT>
319 OI::a(mIndex, [](
auto& a,
const auto&
b) { a =
b; }, o);
323 template <
typename T,
class IndexT>
327 OI::a(mIndex, [](
auto& a,
const auto&
b) { a +=
b; }, o);
331 template <
typename T,
class IndexT>
334 OI::a(mIndex, [](
auto& a,
const auto&
b) { a =
b; }, o);
338 template <
typename T,
class IndexT>
339 template <
class PosT>
344 return vreg(mData,pos);
349 return vreg(
const_cast<const T*
>(mData),pos);
353 return mData[pos.val()];
357 template <
typename T,
class IndexT>
363 template <
typename T,
class IndexT>
367 return mIndex->stepSize(
id);
370 template <
typename T,
class IndexT>
376 template <
typename T,
class IndexT>
386 template <
class F,
class...
Ops>
392 template <
class F,
class...
Ops>
393 template <
class PosT>
399 template <
class F,
class...
Ops>
402 return exec(std::make_index_sequence<
sizeof...(
Ops)>{});
405 template <
class F,
class...
Ops>
409 return rootStepsi(
id, std::make_index_sequence<
sizeof...(
Ops)>{});
412 template <
class F,
class...
Ops>
416 return mF( std::get<Is>(mOps)() ... );
419 template <
class F,
class...
Ops>
422 std::index_sequence<Is...>
is)
const
424 return ( std::get<Is>(mOps).rootSteps(
id) << ... );
427 template <
class F,
class...
Ops>
433 template <
class Tar,
class Src>
445 template <
class Tar,
class Src>
470 template <
class CXpr>
475 template <
class CXpr>
476 template <
class PosT>
482 template <
class CXpr>
488 template <
class CXpr>
495 template <
class F,
class Op,
class IndexT>
498 typedef decltype(
i->ifor(
op,
f ))
CXprT;
506 template <
class IndexT>
#define CXZ_ASSERT(statement, errmsg)
constexpr COpRoot & init(const T *data, const Sptr< IndexT > &ind)
constexpr COpRoot()=default
constexpr Contraction()=default
constexpr decltype(auto) rootSteps(const IndexId< I > &id) const
constexpr OpCont & operator+=(const Op &in)
constexpr OpCont & operator=(const Op &in)
constexpr OpCont & init(const Sptr< IndexT > &ind)
constexpr OpCont()=default
void a(const Sptr< IndexT > &ind, F &&f, const Args &... args)
constexpr OpRoot & operator+=(const Op &in)
constexpr OpRoot()=default
constexpr OpRoot & init(T *data, const Sptr< IndexT > &ind)
constexpr OpRoot & operator=(const Op &in)
constexpr Operation()=default
constexpr decltype(auto) data() const
constexpr POpRoot()=default
Operation extensions main header.
constexpr decltype(auto) indexOp(const Sptr< IndexT > &i)
constexpr decltype(auto) poproot(const Sptr< IndexT > &ind, const SizeT *parts, Op &&op)
constexpr decltype(auto) coproot(const CArrayBase< T > &a, const Sptr< IndexT > &ind)
std::vector< T, Allocator< T > > Vector
constexpr decltype(auto) contraction(F &&f, Op &&op, const Sptr< IndexT > &i)
Sptr< Range > rangeCast(const RangePtr r)
decltype(auto) vreg(const T *d, const EPosT &pos)
constexpr decltype(auto) operation(F &&f, const Ops &... ops)
constexpr decltype(auto) assignxpr(const Tar &tar, const Src &src)
std::shared_ptr< T > Sptr
auto pos_unpack_args(const F &f, const PosT &pos, const Tuple< Ops... > &args)
constexpr decltype(auto) oproot(ArrayBase< T > &a, const Sptr< IndexT > &ind)
Operation types declarations.
Operation utilities declarations.