STK++ 0.9.13
STK_CArrayPoint.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23 */
24
25/*
26 * Project: stkpp::Arrays
27 * created on: 25 nov. 2011
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
35#ifndef STK_CARRAY2DPOINT_H
36#define STK_CARRAY2DPOINT_H
37
38#include "STK_ICArray.h"
39
40namespace STK
41{
42// forward declarations
43template< typename Type, int SizeCols_=UnknownSize, bool Orient_ = Arrays::by_col_>
44class CArrayPoint;
45template< typename Type, int SizeRows_, int SizeCols_, bool Orient_> class CArray;
46template< typename Type, int Size_, bool Orient_> class CArraySquare;
47template< typename Type, int SizeRows_, bool Orient_> class CArrayVector;
48template< typename Type, bool Orient_> class CArrayNumber;
49
50// useful typedef
60
70
71namespace hidden
72{
76template<typename Type_, int SizeCols_, bool Orient_>
78{
81
82 // The CAllocator have to have the same structure than the CArray
84
85 typedef Type_ Type;
86 typedef typename RemoveConst<Type>::Type const& TypeConst;
87
88 enum
89 {
90 structure_ = Arrays::point_,
91 orient_ = Orient_,
92 sizeRows_ = 1,
93 sizeCols_ = SizeCols_,
94 size_ = SizeCols_,
95 storage_ = Arrays::dense_
96 };
97};
98
99
100} // namespace hidden
101
102
106template <typename Type_, int SizeCols_, bool Orient_>
107class CArrayPoint: public ICArray < CArrayPoint<Type_, SizeCols_, Orient_> >
108{
109 public:
112
117
118 enum
119 {
126 };
127
133 CArrayPoint( int sizeCols): Base(1, sizeCols) {}
137 CArrayPoint( Range range): Base(1, range.size())
138 { this->shift(range.begin());}
143 CArrayPoint( int sizeCols, Type const& v): Base(1, sizeCols, v) {}
148 CArrayPoint( Range range, Type const& v): Base(1, range.size(), v)
149 { this->shift(range.begin());}
154 CArrayPoint( CArrayPoint const& T, bool ref=false): Base(T, ref) {}
159 CArrayPoint( CArrayPoint const& T, Range const& J)
160 : Base(T, T.rows(), J) {}
166 template<class OtherArray>
167 CArrayPoint( ICArray<OtherArray> const& T, Range const& J, int row)
168 : Base(T.allocator(), Range(row, 1), J)
169 {}
174 CArrayPoint( Type* const& q, int nbCol): Base(q, 1, nbCol) {}
178 template<class OtherAllocator>
185 template<class OtherDerived>
196 template<class Rhs>
202};
203
204} // namespace STK
205
206
207#endif /* STK_CARRAY2DPOINT_H */
Interface base class for the CArray, this is an internal header file, included by other Containers li...
CArrayPoint< Type_, SizeCols_, Orient_ > & operator=(Type const &value)
CArrayPoint< Type_, SizeCols_, Orient_ > & setValue(TypeConst value)
set a value to this container.
CArrayPoint< Type_, SizeCols_, Orient_ > & assign(ExprBase< Rhs > const &rhs)
declaration of the point case.
hidden::Traits< CArrayPoint< Type_, SizeCols_, Orient_ > >::Col Col
CArrayPoint(int sizeCols, Type const &v)
constructor with specified size, initialization with a constant.
CArrayPoint()
Default constructor.
hidden::Traits< CArrayPoint< Type_, SizeCols_, Orient_ > >::Type Type
CArrayPoint(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
CArrayPoint(Type *const &q, int nbCol)
wrapper constructor for 0 based C-Array.
CArrayPoint & operator=(Type const &v)
operator= : set the container to a constant value.
hidden::Traits< CArrayPoint< Type_, SizeCols_, Orient_ > >::Row Row
CArrayPoint(CArrayPoint const &T, bool ref=false)
Copy constructor.
CArrayPoint(ICArray< OtherArray > const &T, Range const &J, int row)
constructor by reference, ref_=1.
CArrayPoint(int sizeCols)
constructor with specified dimension.
CArrayPoint & operator=(CArrayPoint rhs)
operator = : overwrite the CArray with the Right hand side rhs.
CArrayPoint(ITContainer2D< OtherAllocator > const &allocator)
constructor by reference.
CArrayPoint(CArrayPoint const &T, Range const &J)
constructor by reference, ref_=1.
ICArray< CArrayPoint< Type_, SizeCols_, Orient_ > > Base
ArrayBase< CArrayPoint< Type_, SizeCols_, Orient_ > > LowBase
CArrayPoint(Range range)
constructor with specified ranges.
CArrayPoint(Range range, Type const &v)
constructor with specified ranges, initialization with a constant.
~CArrayPoint()
destructor.
CArrayPoint & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArrayPoint with the Right hand side T.
hidden::Traits< CArrayPoint< Type_, SizeCols_, Orient_ > >::TypeConst TypeConst
CArrayPoint< Type_, SizeCols_, Orient_ > & shift(int beginRows, int beginCols)
shift the Array.
hidden::CSlice< CArrayPoint< Type_, SizeCols_, Orient_ >, 1, sizeCols_ >::Result row(int i) const
implement the row operator using a reference on the row of the allocator
Allocator const & allocator() const
Get a constant reference on the main allocator.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
int begin() const
get the first index of the TRange.
Definition STK_Range.h:93
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
@ dense_
dense matrix/vector/array/expression
@ point_
row oriented vector/array/expression
The namespace STK is the main domain space of the Statistical ToolKit project.
CArrayPoint< Real, UnknownSize, Arrays::by_col_ > CPointX
CArrayPoint< int, UnknownSize, Arrays::by_col_ > CPointXi
CArrayPoint< Real, 2, Arrays::by_col_ > CPoint2
CArrayPoint< int, 3, Arrays::by_row_ > CPointByRow3i
CArrayPoint< double, 3, Arrays::by_col_ > CPoint3d
CArrayPoint< double, UnknownSize, Arrays::by_row_ > CPointByRowXd
CArrayPoint< double, 2, Arrays::by_col_ > CPoint2d
CArrayPoint< int, 2, Arrays::by_col_ > CPoint2i
CArrayPoint< Real, 2, Arrays::by_row_ > CPointByRow2
CArrayPoint< Real, 3, Arrays::by_row_ > CPointByRow3
CArrayPoint< Real, UnknownSize, Arrays::by_row_ > CPointByRowX
CArrayPoint< int, UnknownSize, Arrays::by_row_ > CPointByRowXi
CArrayPoint< double, UnknownSize, Arrays::by_col_ > CPointXd
CArrayPoint< int, 2, Arrays::by_row_ > CPointByRow2i
CArrayPoint< double, 2, Arrays::by_row_ > CPointByRow2d
CArrayPoint< double, 3, Arrays::by_row_ > CPointByRow3d
CArrayPoint< Real, 3, Arrays::by_col_ > CPoint3
CArrayPoint< int, 3, Arrays::by_col_ > CPoint3i
CAllocator< Type_, 1, SizeCols_, Orient_ > Allocator