CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
index_pack.cc
Go to the documentation of this file.
1// -*- C++ -*-
12#include "ranges/ranges.h"
13
14namespace CNORXZ
15{
17 mIs(is)
18 {}
19
23
25 {
26 return mIs;
27 }
28
30 {
31 return mIs.size();
32 }
33
35 {
36 return mIs[i];
37 }
38
40 {
41 return get(i);
42 }
43
45 {
46 auto o = mIs;
47 o.push_back(i->xptr());
48 return DPack(std::move(o));
49 }
50
52 {
54 o.reserve(size()+1);
55 o.push_back(i->xptr());
56 o.insert(o.end(), mIs.begin(), mIs.end());
57 return DPack(std::move(o));
58 }
59
60 DPack DPack::mul(const DPack& p) const
61 {
63 o.reserve(size()+p.size());
64 o.insert(o.end(), mIs.begin(), mIs.end());
65 o.insert(o.end(), p.all().begin(), p.all().end());
66 return DPack(std::move(o));
67 }
68
70 {
71 Vector<RangePtr> o(mIs.size());
72 std::transform(mIs.begin(), mIs.end(), o.begin(),
73 [](const auto& i) { return i->range(); } );
74 return yrange(o);
75 }
76
78 {
79 if(mIs.size() == 0) { return 0; }
80 const SizeT isizem1 = mIs.size()-1;
81 SizeT o = mIs[isizem1]->lex();
82 SizeT m = mIs[isizem1]->lmax().val();
83 for(SizeT i = isizem1; i != 0; --i){
84 const SizeT j = i-1;
85 o += mIs[j]->lex() * m;
86 m *= mIs[j]->lmax().val();
87 }
88 return o;
89 }
90
92 {
93 return lex();
94 }
95}
SizeT size() const
Definition index_pack.cc:29
DPack rmul(const Sptr< DIndex > &i) const
Definition index_pack.cc:44
SizeT pos() const
Definition index_pack.cc:91
const Vector< XIndexPtr > & all() const
Definition index_pack.cc:24
DPack lmul(const Sptr< DIndex > &i) const
Definition index_pack.cc:51
RangePtr mkRange() const
Definition index_pack.cc:69
SizeT lex() const
Definition index_pack.cc:77
const XIndexPtr & operator[](SizeT i) const
Definition index_pack.cc:39
DPack mul(const DPack &p) const
Definition index_pack.cc:60
const XIndexPtr & get(SizeT i) const
Definition index_pack.cc:34
DPack(const Vector< XIndexPtr > &is)
Definition index_pack.cc:16
uint64_t SizeT
Definition types.h:38
RangePtr yrange(const Vector< RangePtr > &rs)
Definition yrange.cc:666
Sptr< RangeBase > RangePtr
Definition types.h:157
Sptr< XIndexBase > XIndexPtr
Definition types.h:216
std::vector< T, Allocator< T > > Vector
Definition types.h:310
Sptr< Range > rangeCast(const RangePtr r)
std::shared_ptr< T > Sptr
Definition types.h:48
Ranges main header.