AFF --- A container for numbers (array) by Friederich and Forbriger.

◆ Strided() [3/4]

aff::Strided::Strided ( const TIndexVec first,
const TIndexVec last,
const Tsubscript shift = 0 
)
explicit

construct Fortran layout to given first and last index

construct do given first and last index

Parameters
firstvector of first index value in each dimension
lastvector of last index value in each dimension
shiftdefines offset shift (i.e. first element accessed in memory representation)

This constructor together with the aff::Strided::shrink() function is used by aff::Shaper in aff::Shaper::operator Tshape () to create a strided shape.

See also
Array layout

Definition at line 110 of file strided.cc.

References AFF_assert, calculate_base(), first(), aff::inline_anylarger(), last(), Mfirst, Mlast, Mmax_dimen, Mstride, and shift().

112  {
114  "ERROR (Strided): first index must be smaller than last");
115  Mfirst=first;
116  Mlast=last;
117  Mstride[0]=1;
118  for(Tdim i=1; i<Mmax_dimen; i++)
119  {
120  Mstride[i]=Mstride[i-1]*(1+Mlast[i-1]-Mfirst[i-1]);
121  }
123  }
TIndexVec Mlast
Definition: strided.h:288
const TIndexVec & first() const
return vector of first index values
Definition: strided.h:206
Strided & shift(const Tdim &i, const Tsubscript &index)
shift
Definition: strided.cc:250
bool inline_anylarger(const SimpleRigidArray< T, N > &A, const SimpleRigidArray< T, N > &B)
Returns true if any of A is larger than corresponding B.
Definition: simplearray.h:194
static const Tdim Mmax_dimen
instantiate static member (otherwise the linker won&#39;t find it)
Definition: strided.h:123
#define AFF_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:162
void calculate_base(const Tsubscript &offset)
construct do given first and last index
Definition: strided.cc:128
TSizeVec Mstride
Definition: strided.h:286
const TIndexVec & last() const
return vector of last index values
Definition: strided.h:208
unsigned short int Tdim
Type to hold an array dimensionality.
Definition: types.h:49
TIndexVec Mfirst
Definition: strided.h:287
Here is the call graph for this function: