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

◆ shrink() [3/4]

Strided & aff::Strided::shrink ( const Tdim i,
const Tsubscript first,
const Tsubscript last 
)

subarray

Definition at line 184 of file strided.cc.

References AFF_assert, calculate_base(), first(), last(), Mfirst, Mlast, Mmax_dimen, and offset().

187  {
189  "ERROR (Strided::shrink): illegal dimension");
190  AFF_assert(((Mfirst[i]<=first)&&(first<=last)&&(last<=Mlast[i])),
191  "ERROR (Strided::shrink): index range error");
192  // take the long way home
193  TIndexVec newfirst(Mfirst);
194  newfirst[i]=first;
195  Tsubscript offset=this->offset(newfirst);
196  Mfirst[i]=first;
197  Mlast[i]=last;
198  this->calculate_base(offset);
199  return(*this);
200  }
TIndexVec Mlast
Definition: strided.h:288
const TIndexVec & first() const
return vector of first index values
Definition: strided.h:206
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
const TIndexVec & last() const
return vector of last index values
Definition: strided.h:208
ptrdiff_t Tsubscript
Type to hold an array&#39;s subscript value.
Definition: types.h:53
SimpleRigidArray< Tsubscript, Mmax_dimen > TIndexVec
type of limit arrays (any sign)
Definition: strided.h:128
TIndexVec Mfirst
Definition: strided.h:287
Tsubscript offset(const TIndexVec &index) const
full dimensionality access
Definition: strided.h:220
Here is the call graph for this function: