CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
mrange.cc.h
Go to the documentation of this file.
1// -*- C++ -*-
13#ifndef __cxz_mrange_cc_h__
14#define __cxz_mrange_cc_h__
15
16#include "mrange.h"
17#include "operation/op_types.h"
18#include "operation/op_types.cc.h" // -> do .cc files
19#include "operation/op_utility.cc.h" // -> do .cc files
20#include "array/marray.h"
21
22namespace CNORXZ
23{
24 /*=========================+
25 | GMIndex (private) |
26 +=========================*/
27
28 template <class FormatT, class... Indices>
29 template <SizeT... Is>
30 constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkIPack(Isq<Is...> is) const
31 {
32 static_assert(sizeof...(Is) == NI,
33 "sequence sioze does not match number of indices");
34 CXZ_ASSERT( ( (mRange->sub(Is) != nullptr) and ... ),
35 "subranges not available" );
36 return std::make_tuple( std::make_shared<Indices>( mRange->sub(Is) )... );
37 }
38
39 template <class FormatT, class... Indices>
40 constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkLMax(const SPack<Indices...>& ipack)
41 {
42 return iter<0,NI>( [&](auto i) { return ipack[i]->lmax(); },
43 [](auto... e) { return (e * ...); });
44 }
45
46 template <class FormatT, class... Indices>
47 constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkPMax(const SPack<Indices...>& ipack, const FormatT& format)
48 {
49 if constexpr(std::is_same<FormatT,None>::value){
50 return mkLMax(ipack);
51 }
52 else {
53 return iter<0,NI>
54 ( [&](auto i)
55 { return (ipack[i]->pmax() - SPos<1>()) * format[i]; },
56 [](auto... e) { return (e + ...); }) + SPos<1>();
57 }
58 }
59
60 template <class FormatT, class... Indices>
61 inline void GMIndex<FormatT,Indices...>::mkPos()
62 {
63 mLex = iter<0,NI>
64 ([&](auto i) { return mIPack[i]->lex() * mLexFormat[i].val(); },
65 [](const auto&... e) { return (e + ...); });
66 if constexpr(not std::is_same<FormatT,None>::value){
67 IB::mPos = iter<0,NI>
68 ([&](auto i) { return mIPack[i]->pos() * mFormat[i].val(); },
69 [](const auto&... e) { return (e + ...); });
70 }
71 else {
72 IB::mPos = mLex;
73 }
74 }
75
76 template <class FormatT, class... Indices>
77 template <SizeT... Is>
79 {
80 return gmformat
82 ( [&](auto i) { return ipack[i]->pmax(); },
83 [](const auto&... as) { return (as * ...); } )...,
84 SPos<1>() );
85 }
86
87 template <class FormatT, class... Indices>
88 template <SizeT I>
90 {
91 constexpr CSizeT<I> i;
92 auto& ind = mIPack[i];
93 if constexpr(I != 0){
94 if(ind->lex() == ind->lmax().val()-1){
95 IB::mPos -= format()[i].val() * ind->pos();
96 if constexpr(not std::is_same<FormatT,None>::value){
97 mLex -= lexFormat()[i].val() * ind->lex();
98 }
99 (*ind) = 0;
100 up<I-1>();
101 return;
102 }
103 }
104 IB::mPos += format()[i].val();
105 if constexpr(not std::is_same<FormatT,None>::value){
106 mLex += lexFormat()[i].val();
107 }
108 ++(*ind);
109 }
110
111 template <class FormatT, class... Indices>
112 template <SizeT I>
113 inline void GMIndex<FormatT,Indices...>::down()
114 {
115 constexpr CSizeT<I> i;
116 auto& ind = mIPack[i];
117 if constexpr(I != 0){
118 if(ind->lex() == 0){
119 (*ind) = ind->lmax().val()-1;
120 IB::mPos += format()[i].val() * ind->pos();
121 if constexpr(not std::is_same<FormatT,None>::value){
122 mLex += lexFormat()[i].val() * ind->lex();
123 }
124 down<I-1>();
125 return;
126 }
127 }
128 IB::mPos -= format()[i].val();
129 if constexpr(not std::is_same<FormatT,None>::value){
130 mLex -= lexFormat()[i].val();
131 }
132 --(*ind);
133 }
134
135 template <class FormatT, class... Indices>
136 template <SizeT I, class Xpr, class F>
137 constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkIFor(const Xpr& xpr, F&& f) const
138 {
139 constexpr CSizeT<I> i;
140 if constexpr(I == sizeof...(Indices)-1){
141 return mIPack[i]->ifor(xpr,std::forward<F>(f));
142 }
143 else {
144 auto f1 = f;
145 auto f2 = f1;
146 return mIPack[i]->ifor( mkIFor<I+1>( xpr, std::move(f1) ), std::move(f2) );
147 }
148 }
149
150 /*===============+
151 | GMIndex |
152 +===============*/
153
154 template <class FormatT, class... Indices>
157 mRange(rangeCast<RangeType>(i.range())),
158 mIPack(mkIPack(Isqr<0,NI>{})),
159 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
160 mFormat(i.mFormat),
161 mLMax(mkLMax(mIPack)),
162 mPMax(mkPMax(mIPack,mFormat))
163 {
164 *this = i.lex();
165 }
166
167 template <class FormatT, class... Indices>
169 {
170 IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>::operator=(0);
171 mRange = rangeCast<RangeType>(i.range());
172 mIPack = mkIPack(Isqr<0,NI>{});
173 mLexFormat = mkLexFormat(mIPack,Isqr<1,NI>{});
174 mFormat = i.mFormat;
175 mLMax = mkLMax(mIPack);
176 mPMax = mkPMax(mIPack,mFormat);
177 return *this = i.lex();
178 }
179
180 template <class FormatT, class... Indices>
183 mRange(std::dynamic_pointer_cast<RangeType>(pack.mkRange())),
184 mIPack(pack),
185 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
186 mFormat(),
187 mLMax(mkLMax(mIPack)),
188 mPMax(mkPMax(mIPack,mFormat))
189 {
190 if constexpr(not std::is_same<None,FormatT>::value){
191 mFormat = mLexFormat;
192 }
193 mkPos();
194 }
195
196 template <class FormatT, class... Indices>
199 mRange(std::dynamic_pointer_cast<RangeType>(pack.mkRange())),
200 mIPack(pack),
201 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
202 mFormat(bs),
203 mLMax(mkLMax(mIPack)),
204 mPMax(mkPMax(mIPack,mFormat))
205 {
206 mkPos();
207 }
208
209 template <class FormatT, class... Indices>
212 mRange(std::dynamic_pointer_cast<RangeType>(mrange(is->range()...))),
213 mIPack(is...),
214 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
215 mFormat(),
216 mLMax(mkLMax(mIPack)),
217 mPMax(mkPMax(mIPack,mFormat))
218 {
219 if constexpr(not std::is_same<None,FormatT>::value){
220 mFormat = mLexFormat;
221 }
222 mkPos();
223 }
224
225 template <class FormatT, class... Indices>
227 const Sptr<Indices>&... is) :
229 mRange(std::dynamic_pointer_cast<RangeType>(mrange(is->range()...))),
230 mIPack(is...),
231 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
232 mFormat(bs),
233 mLMax(mkLMax(mIPack)),
234 mPMax(mkPMax(mIPack,mFormat))
235 {
236 mkPos();
237 }
238
239 template <class FormatT, class... Indices>
242 mRange(rangeCast<RangeType>(range)),
243 mIPack(mkIPack(Isqr<0,NI>{})),
244 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
245 mFormat(),
246 mLMax(mkLMax(mIPack)),
247 mPMax(mkPMax(mIPack,mFormat))
248 {
249 if constexpr(not std::is_same<None,FormatT>::value){
250 mFormat = mLexFormat;
251 }
252 *this = lexpos;
253 }
254
255 template <class FormatT, class... Indices>
256 constexpr GMIndex<FormatT,Indices...>::GMIndex(const RangePtr& range, const FormatT& format, SizeT lexpos) :
258 mRange(rangeCast<RangeType>(range)),
259 mIPack(mkIPack(Isqr<0,NI>{})),
260 mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
261 mFormat(format),
262 mLMax(mkLMax(mIPack)),
263 mPMax(mkPMax(mIPack,mFormat))
264 {
265 *this = lexpos;
266 }
267
268 template <class FormatT, class... Indices>
270 {
271 if(lexpos >= lmax().val()){
272 if constexpr(not std::is_same<FormatT,None>::value){ mLex = lmax().val(); }
273 IB::mPos = pmax().val();
274 return *this;
275 }
276 if constexpr(not std::is_same<FormatT,None>::value){ mLex = lexpos; }
277 IB::mPos = iter<0,NI>( [&](auto i) {
278 *mIPack[i] = (lexpos / lexFormat()[i].val()) % mIPack[i]->lmax().val();
279 return format()[i].val() * mIPack[i]->pos();
280 }, [](const auto&... e) { return (e + ...); } );
281 return *this;
282 }
283
284 template <class FormatT, class... Indices>
286 {
287 if(lex() == lmax().val()-1){
288 return *this = lmax().val();
289 }
290 if(lex() != lmax().val()){
291 up<NI-1>();
292 }
293 return *this;
294 }
295
296 template <class FormatT, class... Indices>
298 {
299 if(lex() == lmax().val()){
300 return *this = lmax().val()-1;
301 }
302 if(lex() != 0){
303 down<NI-1>();
304 }
305 return *this;
306 }
307
308 template <class FormatT, class... Indices>
310 {
311 GMIndex o(*this);
312 return o += n;
313 }
314
315 template <class FormatT, class... Indices>
317 {
318 GMIndex o(*this);
319 return o -= n;
320 }
321
322 template <class FormatT, class... Indices>
324 {
325 return lex() - i.lex();
326 }
327
328 template <class FormatT, class... Indices>
330 {
331 if(-n > static_cast<long int>(lex())){
332 (*this) = 0;
333 }
334 const SizeT p = lex() + n;
335 if(p > lmax().val()){
336 (*this) = lmax().val();
337 }
338 (*this) = p;
339 return *this;
340 }
341
342 template <class FormatT, class... Indices>
344 {
345 if(n > static_cast<long int>(lex())){
346 (*this) = 0;
347 }
348 const SizeT p = lex() + n;
349 if(p > lmax().val()){
350 (*this) = lmax().val();
351 }
352 (*this) = p;
353 return *this;
354 }
355
356 template <class FormatT, class... Indices>
358 {
359 if constexpr(std::is_same<FormatT,None>::value){
360 return IB::mPos;
361 }
362 else {
363 return mLex;
364 }
365 }
366
367 template <class FormatT, class... Indices>
368 constexpr decltype(auto) GMIndex<FormatT,Indices...>::pmax() const
369 {
370 return mPMax;
371 }
372
373 template <class FormatT, class... Indices>
374 constexpr decltype(auto) GMIndex<FormatT,Indices...>::lmax() const
375 {
376 return mLMax;
377 }
378
379 template <class FormatT, class... Indices>
381 {
382 return IndexId<0>(this->ptrId());
383 }
384
385 template <class FormatT, class... Indices>
387 {
388 return meta();
389 }
390
391 template <class FormatT, class... Indices>
393 {
394 return NI;
395 }
396
397 template <class FormatT, class... Indices>
399 {
400 return mRange;
401 }
402
403 template <class FormatT, class... Indices>
404 template <SizeT I>
405 decltype(auto) GMIndex<FormatT,Indices...>::stepSize(const IndexId<I>& id) const
406 {
407 return iter<0,NI>
408 ( [&](auto i) { return mIPack[i]->stepSize(id) * format()[i]; },
409 [](const auto&... ss) { return ( ss + ... ); });
410 }
411
412 template <class FormatT, class... Indices>
414 {
415 const String blim = "(";
416 const String elim = ")";
417 const String dlim = ",";
418 return iter<1,NI>
419 ( [&](auto i) { return mIPack[i]->stringMeta(); },
420 [&](const auto&... xs) {
421 return blim + mIPack[CSizeT<0>{}]->stringMeta() + ( (dlim + xs) + ... ) + elim;
422 } );
423 }
424
425 template <class FormatT, class... Indices>
427 {
428 return iter<0,NI>( [&](auto i) { return mIPack[i]->meta(); },
429 [](const auto&... xs) { return std::make_tuple(xs...); } );
430 }
431
432 template <class FormatT, class... Indices>
434 {
435 iter<0,NI>( [&](auto i) { mIPack[i]->at( std::get<i>(metaPos) ); }, NoF {} );
436 IB::mPos = iter<0,NI>
437 ( [&](auto i) { return mIPack[i]->pos()*format()[i].val(); },
438 [](const auto&... xs) { return (xs + ...); });
439 return *this;
440 }
441
442 template <class FormatT, class... Indices>
444 {
445 return iter<0,NI>( [&](auto i) { return _this->pack()[i]->xpr( _this->pack()[i] ); },
446 [](const auto&... x) {
447 return operation( [](const auto&... e) {
448 return std::make_tuple(e...);
449 }, x... );
450 } );
451 }
452
453 template <class FormatT, class... Indices>
454 template <class Xpr, class F>
455 constexpr decltype(auto) GMIndex<FormatT,Indices...>::ifor(const Xpr& xpr, F&& f) const
456 {
457 return mkIFor<0>(xpr, std::forward<F>(f));
458 }
459
460 template <class FormatT, class... Indices>
462 {
463 if constexpr(std::is_same<FormatT,None>::value){
464 return true;
465 }
466 else {
467 const bool ret1 = iter<0,NI>
468 ( [&](auto i) { return mIPack[i]->formatIsTrivial(); },
469 [](const auto&... x) { return (x and ...); } );
470 if(not ret1){
471 return false;
472 }
473 const bool ret2 = iter<0,NI-1>
474 ( [&](auto j) { return mFormat[CSizeT<j>{}].val() == mIPack[CSizeT<j+1>{}]->lmax().val() * mFormat[CSizeT<j+1>{}].val(); },
475 [](const auto&... x) { return (x and ...); });
476 if(ret2 and mFormat[CSizeT<NI-1>{}].val() == 1){
477 return true;
478 }
479 else {
480 return false;
481 }
482 }
483 }
484
485 template <class FormatT, class... Indices>
487 {
488 mIPack = mi.pack();
489 mkPos();
490 return *this;
491 }
492
493 template <class FormatT, class... Indices>
495 {
496 mkPos();
497 return *this;
498 }
499
500 template <class FormatT, class... Indices>
502 {
503 return mIPack;
504 }
505
506 template <class FormatT, class... Indices>
508 {
509 if constexpr(std::is_same<FormatT,None>::value){
510 return mLexFormat;
511 }
512 else {
513 return mFormat;
514 }
515 }
516
517 template <class FormatT, class... Indices>
519 {
520 return mLexFormat;
521 }
522
523 template <class FormatT, class... Indices>
525 {
526 return iter<0,NI>
527 ( [&](auto i) {
528 typedef typename std::remove_reference<decltype(*mIPack[i])>::type::RangeType RangeT;
529 return std::dynamic_pointer_cast<RangeT>( mIPack[i]->prange( *last.pack()[i] ) );
530 },
531 [](const auto&... e) { return mrange(e...); }
532 );
533
534 }
535
536 template <class FormatT, class... Indices>
538 {
539 return iter<0,NI>( [&](auto i) { return mul(mIPack[i]->deepFormat(), format()[i].val()); },
540 [&](const auto&... e) { return concat(e...); } );
541 }
542
543 template <class FormatT, class... Indices>
545 {
546 return iter<0,NI>( [&](auto i) { return mIPack[i]->deepMax(); },
547 [&](const auto&... e) { return concat(e...); } );
548 }
549
550 template <class FormatT, class... Indices>
553 {
554 // f: input format
555 // s: input sizes
556 CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()");
557 if(f.size() == 1){
558 CXZ_ASSERT(s[0] == lmax().val(), "got inconsistent size; expeected "
559 << lmax().val() << ", got " << s[0]);
560 return *this;
561 }
562
563 if constexpr(std::is_same<FormatT,None>::value){
565 "cannot reformat MIndex with format type = None");
566 return *this;
567 }
568 else {
569 SizeT j = 0;
570 SizeT j0 = 0;
571 SizeT xi = 1;
572 typename FormatT::InputType nformat;
573 iter<0,NI>( [&](auto i) {
574 CXZ_ASSERT(j != s.size(), "incompatible format");
575 xi *= mIPack[i]->lmax().val();
576 SizeT xj = s[j];
577 if(xi >= xj){
578 j0 = j;
579 while(xj < xi){
580 ++j;
581 CXZ_ASSERT(j != s.size(), "incompatible format");
582 xj *= s[j];
583 }
584 CXZ_ASSERT(xj == xi, "incompatible format");
585 xi = 1;
586 ++j;
587
590 std::copy(f.begin()+j0,f.begin()+j,nf.begin());
591 std::get<i>(nformat) = *std::min_element(nf.begin(), nf.end());
592 std::for_each(nf.begin(), nf.end(), [&](SizeT& x)
593 { CXZ_ASSERT(x % std::get<i>(nformat).val() == 0, "incompatible");
594 x /= std::get<i>(nformat).val(); } );
595 std::copy(s.begin()+j0,s.begin()+j,ns.begin());
596 mIPack[i]->reformat(nf,ns);
597 }
598 else {
599 CXZ_ERROR("reformating with lower-dimensional formats is not possible; use sub-indices instead");
600 }
601 }, NoF {});
602 mFormat = FormatT(nformat);
603 return *this;
604 }
605 }
606
607 template <class FormatT, class... Indices>
609 {
610 if constexpr(not std::is_same<FormatT,None>::value){
611 mFormat = bs;
612 }
613 return *this;
614 }
615
616 template <class... Indices>
617 constexpr decltype(auto) mindex(const Sptr<Indices>&... is)
618 {
619 return MIndex<Indices...>(is...);
620 }
621
622 template <class... Indices>
623 constexpr decltype(auto) mindex(const SPack<Indices...>& pack)
624 {
625 return MIndex<Indices...>(pack);
626 }
627
628 template <class... Indices>
629 constexpr decltype(auto) mindexPtr(const SPack<Indices...>& pack)
630 {
631 return std::make_shared<MIndex<Indices...>>(pack);
632 }
633
634 template <class FormatT, class... Indices>
635 constexpr decltype(auto) gmindexPtr(const FormatT& bs, const SPack<Indices...>& pack)
636 {
637 return std::make_shared<GMIndex<FormatT,Indices...>>(bs, pack);
638 }
639
640 template <class I1, class FormatT, class... Indices>
641 decltype(auto) operator*(const Sptr<GMIndex<FormatT,Indices...>>& a, const Sptr<I1>& b)
642 {
643 return iptrMul(a, b);
644 }
645
646 /*=====================+
647 | MRangeFactory |
648 +=====================*/
649
650 template <class... Ranges>
654
655 template <class... Ranges>
657 const RangePtr& ref) :
658 mRs(rs),
659 mRef(ref)
660 {}
661
662 template <class... Ranges>
664 {
665 Vector<Uuid> key = iter<0,sizeof...(Ranges)>
666 ( [&](auto i) { return std::get<i>( mRs ); },
667 [](const auto&... e) { return Vector<Uuid> { e->id()... }; } );
668 const auto& info = typeid(MRange<Ranges...>);
669 mProd = this->fromCreated(info, key);
670 if(mProd == nullptr) {
671 mProd = std::shared_ptr<MRange<Ranges...>>
672 ( new MRange<Ranges...>( mRs ) );
673 this->addToCreated(info, key, mProd);
674 }
675 }
676
677 /*==============+
678 | MRange |
679 +==============*/
680
681 template <class... Ranges>
683 mRs(rs),
684 mA( mkA() )
685 {}
686
687 template <class... Ranges>
689 {
690 CXZ_ASSERT(num < this->dim(), "index out of range");
691 return mA[num];
692 }
693
694 template <class... Ranges>
696 {
697 if constexpr(NR == 0) {
698 return MArray<RangePtr>();
699 }
700 else {
702 ( iter<0,NR>
703 ( [](auto i) { return i; },
704 [](auto... x) { return Arr<SizeT,NR> { x... }; } ) ).create();
705 return MArray<RangePtr>
706 ( sr, iter<0,NR>
707 ( [&](auto i) { return std::get<i>(mRs); },
708 [](auto... x) { return Vector<RangePtr> ({ x... }); } ) );
709 }
710 }
711
712 template <class... Ranges>
714 {
715 return iter<0,NR>( [&](auto i) { return std::get<i>(mRs)->size(); },
716 [](const auto&... xs) { return (xs * ...); } );
717 }
718
719 template <class... Ranges>
721 {
722 return NR;
723 }
724
725 template <class... Ranges>
727 {
728 return (this->begin()+pos).stringMeta();
729 }
730
731 template <class... Ranges>
733 {
734 return typeid(MRange<Ranges...>);
735 }
736
737 template <class... Ranges>
739 {
740 return typeid(MetaType);
741 }
742
743 template <class... Ranges>
744 decltype(auto) MRange<Ranges...>::space() const
745 {
746 return mRs;
747 }
748
749 template <class... Ranges>
750 const typename MRange<Ranges...>::MetaType MRange<Ranges...>::get(SizeT pos) const
751 {
752 return (this->begin()+pos)->meta();
753 }
754
755 template <class... Ranges>
757 {
758 auto i = this->begin();
759 return i.at(metaPos).pos();
760 }
761
762 template <class... Ranges>
764 {
765 CXZ_ASSERT( r->dim() == this->dim(), "cannot extend range of dimension "
766 << this->dim() << " by range of dimension " << r->dim());
767 auto rs = iter<0,NR>( [&](auto i) {
768 typedef typename std::remove_reference<decltype(*std::get<i>(mRs))>::type RType;
769 return std::dynamic_pointer_cast<RType>( std::get<i>(mRs)->extend(r->sub(i)) ); },
770 [](const auto&... e) { return std::make_tuple(e...); }
771 );
772 return MRangeFactory<Ranges...>( rs ).create();
773 }
774
775 template <class... Ranges>
777 {
778 Vector<Uuid> k = iter<0,sizeof...(Ranges)>
779 ( [&](auto i) { return std::get<i>( mRs ); },
780 [](const auto&... e) { return Vector<Uuid> { e->id()... }; } );
781 return k;
782 }
783
784 /*========================+
785 | MRange (private) |
786 +========================*/
787
788 template <class... Ranges>
789 decltype(auto) MRange<Ranges...>::mkA() const
790 {
791 return iter<0,NR>([&](auto i) { return std::get<i>(mRs); },
792 [](const auto&... xs) { return Arr<RangePtr,NR> { xs... }; } );
793 }
794
795 /*============================+
796 | non-member functions |
797 +============================*/
798
799 template <class... Ranges>
801 {
802 return MRangeFactory<Ranges...>(std::make_tuple(rs...)).create();
803 }
804
805 template <class... Ranges>
806 Sptr<MRange<Ranges...>> RangeCast<MRange<Ranges...>>::func(const RangePtr& r)
807 {
808 CXZ_ASSERT(r->dim() == sizeof...(Ranges), "expect range of dimension "
809 << sizeof...(Ranges) << ", got " << r->dim());
810 return std::dynamic_pointer_cast<MRange<Ranges...>>( MRangeFactory
811 ( iter<0,sizeof...(Ranges)>
812 ( [&](auto i) {
813 return rangeCast<typename std::tuple_element<i,Tuple<Ranges...>>::type> (r->sub(i)); },
814 [](const auto&... e){ return std::make_tuple( e... ); } ) ).create() );
815 }
816}
817
818#endif
#define CXZ_ERROR(errmsg)
Definition assert.h:26
#define CXZ_ASSERT(statement, errmsg)
Definition assert.h:40
GMIndex & setFormat(const FormatT &bs)
Definition mrange.cc.h:608
bool formatIsTrivial() const
Definition mrange.cc.h:461
MetaType operator*() const
Definition mrange.cc.h:386
SizeT lex() const
Definition mrange.cc.h:357
MetaType meta() const
Definition mrange.cc.h:426
Tuple< typename Indices::MetaType... > MetaType
Definition mrange.h:45
IndexId< 0 > id() const
Definition mrange.cc.h:380
GMIndex & operator--()
Definition mrange.cc.h:297
constexpr GMIndex()=default
RangePtr prange(const GMIndex< FormatT, Indices... > &last) const
Definition mrange.cc.h:524
GMIndex & operator-=(Int n)
Definition mrange.cc.h:343
auto deepMax() const
Definition mrange.cc.h:544
GMIndex & reformat(const Vector< SizeT > &f, const Vector< SizeT > &s)
Definition mrange.cc.h:552
const SPack< Indices... > & pack() const
Definition mrange.cc.h:501
GMIndex operator-(Int n) const
Definition mrange.cc.h:316
GMIndex operator+(Int n) const
Definition mrange.cc.h:309
auto deepFormat() const
Definition mrange.cc.h:537
constexpr SizeT dim() const
Definition mrange.cc.h:392
String stringMeta() const
Definition mrange.cc.h:413
GMIndex & at(const MetaType &metaPos)
Definition mrange.cc.h:433
GMIndex & operator++()
Definition mrange.cc.h:285
Sptr< RangeType > range() const
Definition mrange.cc.h:398
constexpr GMIndex & operator=(GMIndex &&i)=default
GMIndex & operator()()
Definition mrange.cc.h:494
GMIndex & operator+=(Int n)
Definition mrange.cc.h:329
constexpr decltype(auto) ifor(const Xpr &xpr, F &&f) const
const auto & lexFormat() const
Definition mrange.cc.h:518
const auto & format() const
Definition mrange.cc.h:507
virtual RangePtr extend(const RangePtr &r) const override final
Definition mrange.cc.h:763
virtual String stringMeta(SizeT pos) const override final
Definition mrange.cc.h:726
virtual SizeT size() const override final
Definition mrange.cc.h:713
virtual const TypeInfo & metaType() const override final
Definition mrange.cc.h:738
SizeT getMeta(const MetaType &metaPos) const
Definition mrange.cc.h:756
virtual const TypeInfo & type() const override final
Definition mrange.cc.h:732
virtual Vector< Uuid > key() const override final
Definition mrange.cc.h:776
const MetaType get(SizeT pos) const
Definition mrange.cc.h:750
virtual SizeT dim() const override final
Definition mrange.cc.h:720
virtual MArray< RangePtr > sub() const override final
Definition mrange.cc.h:695
MRange()=default
Tuple< typename Ranges::IndexType::MetaType... > MetaType
Definition mrange.h:347
MArray declarations.
MRange, GMIndex and MIndex declaration.
typename MkIsq< B, E >::type Isqr
Definition isq.h:45
decltype(auto) concat(const T1 &a1, const T2 &a2, const Ts &... as)
Definition utils.h:114
constexpr decltype(auto) gmindexPtr(const FormatT &bs, const SPack< Indices... > &pack)
Definition mrange.cc.h:635
std::string String
Definition types.h:42
std::type_info TypeInfo
Definition types.h:71
uint64_t SizeT
Definition types.h:38
constexpr decltype(auto) mindex(const Sptr< Indices > &... is)
Definition mrange.cc.h:617
Sptr< RangeBase > RangePtr
Definition types.h:157
std::vector< T, Allocator< T > > Vector
Definition types.h:310
int32_t Int
Definition types.h:36
RangePtr mrange(const Sptr< Ranges > &... rs)
Definition mrange.cc.h:800
decltype(auto) xpr(const Sptr< I > &i)
std::integral_constant< SizeT, N > CSizeT
Definition types.h:81
Sptr< Range > rangeCast(const RangePtr r)
std::tuple< T... > Tuple
Definition types.h:60
std::array< T, N > Arr
Definition types.h:45
constexpr decltype(auto) gmformat(const PosT &... ps)
constexpr Arr< T, N > mul(const Arr< T, N > &a, const T &b)
Definition utils.h:125
std::index_sequence< Is... > Isq
Definition types.h:74
decltype(auto) iptrMul(const Sptr< I1 > &a, const Sptr< I2 > &b)
bool formatIsTrivial(const Vector< SizeT > &f, const Vector< SizeT > &s)
RangePtr prange(const Sptr< RangeT > &range, const Vector< SizeT > &parts)
Definition prange.cc.h:401
constexpr decltype(auto) operation(F &&f, const Ops &... ops)
constexpr decltype(auto) mindexPtr(const SPack< Indices... > &pack)
Definition mrange.cc.h:629
std::shared_ptr< T > Sptr
Definition types.h:48
constexpr decltype(auto) iter(const G &g, const F &f)
Definition iter.cc.h:34
Operation types template implementations.
Operation types declarations.
Operation utilities template implementations.