CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
lindex.cc.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_lindex_cc_h__
13#define __cxz_lindex_cc_h__
14
15#include "lindex.h"
16
17namespace CNORXZ
18{
19 template <class Index, SizeT L>
21 Index(*i),
22 mI(i)
23 {}
24
25 template <class Index, SizeT L>
27 {
28 return IndexId<L>(mI->ptrId());
29 }
30
31 template <class Index, SizeT L>
32 template <SizeT I>
33 decltype(auto) LIndex<Index,L>::stepSize(const IndexId<I>& id) const
34 {
35 if constexpr(L == 0 and I == 0){
36 return UPos(mI->id() == id ? 1 : 0);
37 }
38 else {
39 if constexpr(L == I) {
40 return SPos<1>();
41 }
42 else {
43 return SPos<0>();
44 }
45 }
46 }
48 template <class Index, SizeT L>
49 template <class Xpr, class F>
50 decltype(auto) LIndex<Index,L>::ifor(const Xpr& xpr, F&& f) const
51 {
52 return For<L,Xpr,F>(this->pmax().val(), this->id(), xpr, std::forward<F>(f));
53 }
54
55 template <class Index, SizeT L, class I1>
56 decltype(auto) operator*(const Sptr<LIndex<Index,L>>& a, const Sptr<I1>& b)
57 {
58 return iptrMul(a, b);
59 }
60
61 template <SizeT L, class Index>
62 decltype(auto) lindexPtr(const Sptr<Index>& i)
63 {
64 return std::make_shared<LIndex<Index,L>>( i );
65 }
66
67 template <class Index, SizeT L>
68 decltype(auto) lindexPtr(const Sptr<Index>& i, CSizeT<L> l)
69 {
70 return lindexPtr<l>( i );
71 }
72}
73
74#endif
LIndex(const Sptr< Index > &i)
Definition lindex.cc.h:20
IndexId< L > id() const
Definition lindex.cc.h:26
Statically labeled index.
decltype(auto) xpr(const Sptr< I > &i)
std::integral_constant< SizeT, N > CSizeT
Definition types.h:81
Sptr< Range > rangeCast(const RangePtr r)
decltype(auto) iptrMul(const Sptr< I1 > &a, const Sptr< I2 > &b)
decltype(auto) lindexPtr(const Sptr< Index > &i)
Definition lindex.cc.h:62
std::shared_ptr< T > Sptr
Definition types.h:48