11#ifndef NDARRAY_views_h_INCLUDED
12#define NDARRAY_views_h_INCLUDED
18#include <boost/fusion/include/push_back.hpp>
19#include <boost/fusion/include/vector.hpp>
20#include <boost/fusion/include/make_vector.hpp>
21#include <boost/fusion/include/mpl.hpp>
36 Slice(Size start_, Size stop_, Offset step_) : start(start_), stop(stop_), step(step_) {}
38 Size computeSize()
const {
return (step > 1) ? (stop - start + 1) / step : stop - start; }
48 Range(Size start_, Size stop_) : start(start_), stop(stop_) {}
62 explicit Scalar(Size n_) : n(n_) {}
73template <
typename Seq_ = boost::fusion::vector<> >
80 template <
typename OtherSequence>
81 explicit View(OtherSequence
const & other) :
_seq(other) {}
83 template <
typename OtherSequence>
84 View(View<OtherSequence>
const & other) :
_seq(other.
_seq) {}
137 boost::fusion::make_vector(
index::Slice(start, stop, step))
View< boost::fusion::vector1< index::Full > > view()
Start a view definition that includes the entire first dimension.
Definition views.h:121
Forward declarations and default template parameters for ndarray.
A template meta-sequence that defines an arbitrary view into an unspecified array.
Definition views.h:74
View< typename boost::fusion::result_of::push_back< Sequence const, index::Range >::type > Range
The View that results from chaining a range (start,stop) to this.
Definition views.h:90
Scalar operator()(Size n) const
Chain a single element of the next dimension to this.
Definition views.h:112
Full operator()() const
Chain the full next dimension to this.
Definition views.h:99
Sequence _seq
A boost::fusion sequence of index objects.
Definition views.h:76
View< typename boost::fusion::result_of::push_back< Sequence const, index::Scalar >::type > Scalar
The View that results from chaining a scalar (n) to this.
Definition views.h:96
Slice operator()(Size start, Size stop, Offset step) const
Chain a noncontiguous slice of the next dimension to this.
Definition views.h:107
Seq_ Sequence
A boost::fusion sequence type.
Definition views.h:75
View< typename boost::fusion::result_of::push_back< Sequence const, index::Full >::type > Full
The View that results from chaining an full dimension index () to this.
Definition views.h:87
View< typename boost::fusion::result_of::push_back< Sequence const, index::Slice >::type > Slice
The View that results from chaining a slice (start,stop,step) to this.
Definition views.h:93
Range operator()(Size start, Size stop) const
Chain a contiguous range of the next dimension to this.
Definition views.h:102
Empty structure marking a view of an entire dimension.
Definition views.h:54
Simple structure defining a contiguous range of indices.
Definition views.h:44
Structure marking a single element of a dimension.
Definition views.h:59
Simple structure defining a noncontiguous range of indices.
Definition views.h:31