52template<
typename Type,
int SizeRows_,
int SizeCols_,
bool Orient_>
class CArray;
53template<
typename Type,
int Size_,
bool Orient_>
class CArraySquare;
54template<
typename Type,
int SizeCols_,
bool Orient_>
class CArrayPoint;
55template<
typename Type,
int SizeRows_,
bool Orient_>
class CArrayVector;
56template<
typename Type,
bool Orient_>
class CArrayNumber;
66template<
typename Derived,
int SizeRows,
int SizeCols>
98template<
typename Derived,
int Size>
124template<
class Derived>
178 template<
class OtherAllocator>
185 template<
class OtherAllocator>
236#ifdef STK_BOUNDS_CHECK
242 return this->elt(i,j);
249#ifdef STK_BOUNDS_CHECK
255 return this->elt(i,j);
264#ifdef STK_BOUNDS_CHECK
265 if (this->asDerived().begin() > i) {
STKOUT_OF_RANGE_1ARG(ICArray::operator[], i, begin() > i);}
276#ifdef STK_BOUNDS_CHECK
277 if (this->asDerived().begin() > i) {
STKOUT_OF_RANGE_1ARG(ICArray::operator[], i, begin() > i);}
361 template<
int OtherRows_,
int OtherCols_>
367 template<
int OtherRows_,
int OtherCols_>
372 void swap(
int i,
int j) { std::swap(this->elt(i), this->elt(j)); }
376#ifdef STK_BOUNDS_CHECK
377 if (this->beginCols() > pos1)
379 if (this->endCols() <= pos1)
381 if (this->beginCols() > pos2)
383 if (this->endCols() <= pos2)
392#ifdef STK_BOUNDS_CHECK
393 if (this->beginRows() > pos1)
395 if (this->endRows() <= pos1)
397 if (this->beginRows() > pos2)
399 if (this->endRows() <= pos2)
416 Derived&
shift(
int beginRows,
int beginCols)
421 ,YOU_CANNOT_USED_THIS_METHOD_WITH_THIS_KIND_OF_ARRAY);
426 return this->asDerived();
439 return this->asDerived();
454 ,YOU_CANNOT_USED_THIS_METHOD_WITH_THIS_KIND_OF_ARRAY);
461 return this->asDerived();
475 return this->asDerived();
488 return this->asDerived();
In this file we define the base class for Arrays.
In this file we define the CAllocator class.
In this file we define the IContainer2D interface classes.
In this file we define the ITContainer2D interface class.
#define STKOUT_OF_RANGE_1ARG(Where, Arg, Error)
#define STKRUNTIME_ERROR_1ARG(Where, Arg, Error)
#define STKOUT_OF_RANGE_2ARG(Where, Arg1, Arg2, Error)
#define STKRUNTIME_ERROR_2ARG(Where, Arg1, Arg2, Error)
In this file we define the class MemAllocator.
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)
ArrayBase()
Default constructor.
specialization for the number case.
declaration of the point case.
specialization for the square case.
specialization for the vector case.
A CArray is a two dimensional array with a continuous storage like a C-array.
TypeConst operator()(int i, int j) const
hidden::CSlice< Derived, Size_, sizeCols_ >::Result row(TRange< Size_ > const &I) const
implement the row operator using a reference on a range of rows of the allocator
TRange< sizeCols_ > ColRange
hidden::CSlice< Derived, sizeRows_, 1 >::Result col(int j) const
implement the col operator using a reference on the column of the allocator
Derived & resize(Range const &I, Range const &J)
resize the Array.
Derived & shift(int beginRows, int beginCols)
shift the Array.
Derived & resize(int size)
Resize the vector/point/diagonal/square array.
ICArray(Type *const &q, int sizeRows, int sizeCols)
wrapper constructor for 0 based C-Array.
TypeConst elt2Impl(int i, int j) const
implement the writable element accessor
hidden::CSlice< Derived, 1, sizeCols_ >::Result row(int i) const
implement the row operator using a reference on the row of the allocator
hidden::Traits< CArray< Type_, SizeRows_, SizeCols_, Orient_ > >::Allocator Allocator
ColRange const & colsImpl() const
void setValueImpl(int j, TypeConst value)
implement setValue for vector/point/diagonal arrays
ICArray(int sizeRows, int sizeCols, Type const &value)
constructor with specified sizes and value.
TypeConst operator[](int i) const
TypeConst elt1Impl(int j) const
implement the writable element accessor for vector/point/diagonal arrays
ICArray(Derived const &T, bool ref=false)
copy or wrapper constructor.
Derived & resize(TRange< Size_ > const &I)
Resize the vector/point/diagonal/square array.
ArrayBase< CArray< Type_, SizeRows_, SizeCols_, Orient_ > > Base
hidden::CSlice< Derived, 1, Size_ >::Result row(int i, TRange< Size_ > const &J) const
implement the row operator using a reference on the row of the allocator
TypeConst operator()() const
void swapCols(int pos1, int pos2)
hidden::CSlice< Derived, sizeRows_, Size_ >::Result col(TRange< Size_ > const &J) const
implement the col operator using a reference on a range of columns of the allocator
Allocator const & allocator() const
hidden::CSlice< Derived, Size_, 1 >::Result col(TRange< Size_ > const &I, int j) const
implement the col operator using a reference on the column of the allocator
void exchange(Derived &T)
exchange this with T.
hidden::Traits< CArray< Type_, SizeRows_, SizeCols_, Orient_ > >::Type Type
void move(Derived const &T)
move T to this.
hidden::CSlice< Derived, OtherRows_, OtherCols_ >::Result operator()(TRange< OtherRows_ > const &I, TRange< OtherCols_ > const &J) const
Type & elt0Impl()
implement the const element accessor for number arrays
ICArray(ITContainer2D< OtherAllocator > const &allocator, Range const &I, Range const &J)
constructor by reference, ref_=1.
ICArray()
default constructor.
void swapRows(int pos1, int pos2)
hidden::CSlice< Derived, 1, Size_ >::Result operator()(int i, TRange< Size_ > const &J) const
RowRange const & rowsImpl() const
TypeConst elt0Impl() const
implement the writable element accessor for number arrays
void swap(int i, int j)
swap two elements: only for vectors an points.
hidden::Traits< CArray< Type_, SizeRows_, SizeCols_, Orient_ > >::TypeConst TypeConst
hidden::CSliceDispatcher< Derived, Size >::Result sub(TRange< Size > const &J) const
implement the sub operator for 1D arrays using a reference on the row/column of the allocator
Type *const & p_data() const
Type & elt1Impl(int j)
implement the const element accessor for vector/point/diagonal arrays
hidden::Traits< CArray< Type_, SizeRows_, SizeCols_, Orient_ > >::Row Row
Derived & shift(int firstIdx)
shift the Array.
hidden::Traits< CArray< Type_, SizeRows_, SizeCols_, Orient_ > >::Col Col
void setValueImpl(int i, int j, TypeConst value)
implement setValue for vector/point/diagonal arrays
TRange< sizeRows_ > RowRange
Type & elt2Impl(int i, int j)
implement the const element accessor
hidden::CSliceDispatcher< Derived, Size >::Result operator[](TRange< Size > const &I) const
hidden::CSlice< Derived, OtherRows_, OtherCols_ >::Result sub(TRange< OtherRows_ > const &I, TRange< OtherCols_ > const &J) const
implement the sub operator for 2D arrays using references on a range of rows and columns of the alloc...
void clear()
clear all allocated memory .
ICArray(ITContainer2D< OtherAllocator > const &allocator)
constructor by reference, ref_=1.
hidden::CSlice< Derived, Size_, 1 >::Result operator()(TRange< Size_ > const &I, int j) const
Type & operator()(int i, int j)
ICArray(int sizeRows, int sizeCols)
constructor with specified sizes.
Interface base class for homogeneous 2D containers like allocators.
int begin() const
get the first index of the TRange.
int size() const
get the size of the TRange (the number of elements).
Index sub-vector region with fixed size.
int size() const
get the size of the TRange (the number of elements).
@ array2D_
general matrix/array/expression
@ lower_symmetric_
lower symmetric matrix/array/expression
@ lower_triangular_
lower triangular matrix/array/expression
@ symmetric_
symmetric matrix/array/expression
@ upper_triangular_
upper triangular matrix/array/expression
@ diagonal_
diagonal matrix/array/expression
@ upper_symmetric_
upper symmetric matrix/array/expression
@ vector_
column oriented vector/array/expression
@ square_
square matrix/array/expression
const int UnknownSize
This value means that an integer is not known at compile-time, and that instead the value is stored i...
#define STK_STATIC_ASSERT(COND, MSG)
Static assertion with a symbolic message.
The hidden namespace enclose the classes and methods which are used internally by the STK++ classes.
The namespace STK is the main domain space of the Statistical ToolKit project.
TRange< UnknownSize > Range
helper allowing to disambiguate SubVector access
If< structure_==(int) Arrays::vector_, typenameCSlice< Derived, Size, 1 >::Result, typenameCSlice< Derived, 1, Size >::Result >::Result Result
The traits struct CSlice allows to disambiguate return type of the col/row/sub operators for CArray f...
If<(isNumber_), CArrayNumber< Type, orient_ >, typenameIf< isVector_, CArrayVector< Type, SizeRows, orient_ >, typenameIf< isPoint_, CArrayPoint< Type, SizeCols, orient_ >, typenameIf< isSquare_, CArraySquare< Type, SizeRows, orient_ >, CArray< Type, SizeRows, SizeCols, orient_ > >::Result >::Result >::Result >::Result Result
Traits< Derived >::Type Type
Utility class allowing to know if in an assignment the destination must be resized or shifted.
Select a type at compile time.