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
276#ifdef STK_BOUNDS_CHECK
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);
460 allocator_.resize(
I.size(),
J.size()).shift(
I.begin(),
J.begin());
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(COND, MSG)
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)
base class for template arrays.
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
Type of the Range for the columns.
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
Allocator allocator_
allocator of the memory
hidden::Traits< Derived >::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< Derived > 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
Get a constant reference on the main allocator.
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< Derived >::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< Derived >::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< Derived >::Row Row
Derived & shift(int firstIdx)
shift the Array.
hidden::Traits< Derived >::Col Col
void setValueImpl(int i, int j, TypeConst value)
implement setValue for vector/point/diagonal arrays
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
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.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
@ 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...
The namespace STK is the main domain space of the Statistical ToolKit project.
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.