STK++ 0.9.13
STK_Array2DPoint.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 * Purpose: Define the Array2DPoint class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
36#ifndef STK_ARRAY2DPOINT_H
37#define STK_ARRAY2DPOINT_H
38
39#include "STK_IArray2D.h"
40#include "STK_IArray2DSlicers.h"
42
43namespace STK
44{
45
46template<typename> class Array2DPoint;
47template<typename> class Array2DVector;
48
56
57namespace hidden
58{
62template<class Type_>
63struct Traits< Array2DPoint<Type_> >
64{
71
72 typedef Type_ Type;
73 typedef typename RemoveConst<Type>::Type const& TypeConst;
74
75 enum
76 {
77 structure_ = Arrays::point_,
78 orient_ = Arrays::by_col_,
79 sizeRows_ = 1,
80 sizeCols_ = UnknownSize,
81 size_ = UnknownSize,
82 storage_ = Arrays::dense_ // always dense
83 };
85};
86
87} // namespace hidden
88
98template<class Type_>
99class Array2DPoint: public IArray2D< Array2DPoint<Type_> >
100{
101 public:
104
111
114
115 enum
116 {
123 };
124
130 Array2DPoint( Range const& J): Base(Range(1), J) {}
135 Array2DPoint( Range const& J, Type const& v): Base(Range(1), J)
141 Array2DPoint( Array2DPoint const& T, bool ref =false)
142 : Base(T, ref)
143 {}
148 Array2DPoint( Array2DPoint const& T, Range const& J)
149 : Base(T, T.rows(), J) {}
155 template<class OtherArray>
157 : Base(T, Range(row, 1), J)
158 {}
162 template<class OtherDerived>
170 Array2DPoint( Type** p_data, Range const& J, int row)
171 : Base(p_data, Range(row, 1), J) {}
177 Type const& elt1Impl(int const& j) const
178 { return this->elt(this->beginRows(), j);}
182 inline Type& elt1Impl(int const& j) { return this->elt(this->beginRows(), j);}
186 void shift1D(int const& cbeg) { Base::shift(this->beginRows(), cbeg);}
191 { Base::resize(this->rows(), J); return *this;}
196 { this->setValue(this->beginRows(), j, v);}
197
201 void pushBack( int n=1) { Base::pushBackCols(n);}
205 void erase( int pos, int n=1)
206 { Base::eraseCols(pos, n);}
212 void insertElt( int pos, int n =1)
213 { Base::insertCols(pos, n);}
217 template<class Rhs>
227};
228
229} // namespace STK
230
231#endif // STK_ARRAY2DPOINT_H
In this file we implement the modifiers of the IArray2D.
In this file we implement the slicing methods for IArray2D class.
Interface base class for the Array2D classes, this is an internal header file, included by other cont...
template one dimensional horizontal Array.
hidden::Traits< Array2DPoint< Type_ > >::TypeConst TypeConst
Array2DPoint< Type > & resize1D(Range const &J)
Resize the container.
hidden::Traits< Array2DPoint< Type_ > >::SubArray SubArray
Array2DPoint(Range const &J, Type const &v)
constructor with specified range, initialization with a constant.
Array2DPoint & operator=(Type const &v)
set the container to a constant value.
hidden::Traits< Array2DPoint< Type_ > >::Row Row
Array2DPoint(Array2DPoint const &T, Range const &J)
constructor by reference, ref_=1.
Array2DPoint(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
hidden::Traits< Array2DPoint< Type_ > >::SubRow SubRow
hidden::Traits< Array2DPoint< Type_ > >::SubVector SubVector
hidden::Traits< Array2DPoint< Type_ > >::SubCol SubCol
Array2DPoint(Array2DPoint const &T, bool ref=false)
Copy constructor.
Array2DPoint & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
void insertElt(int pos, int n=1)
Insert n elts at the position pos of the container.
Array2DPoint & operator=(const Array2DPoint &T)
operator = : overwrite the CArray with the Right hand side T.
Type & elt1Impl(int const &j)
void shift1D(int const &cbeg)
New first indexes for the object.
hidden::Traits< Array2DPoint< Type_ > >::Type Type
void pushBack(int n=1)
Add n elements to the container.
Array2DPoint(Range const &J)
constructor with specified range.
Type const & elt1Impl(int const &j) const
IArray2D< Array2DPoint< Type_ > > Base
hidden::Traits< Array2DPoint< Type_ > >::Col Col
void setValue1D(int j, TypeConst v)
Set value at position j.
ArrayBase< Array2DPoint< Type_ > > LowBase
~Array2DPoint()
destructor.
Array2DPoint(Type **p_data, Range const &J, int row)
constructor by reference, ref_=1.
void erase(int pos, int n=1)
Delete n elts at the pos index to the container.
Array2DPoint()
Default constructor.
Array2DPoint(IArray2D< OtherArray > const &T, Range const &J, int row)
constructor by reference, ref_=1.
Array2DPoint< Type_ > & operator=(Type const &value)
Array2DPoint< Type_ > & setValue(TypeConst value)
set a value to this container.
Array2DPoint< Type_ > & assign(ExprBase< Rhs > const &rhs)
template interface base class for two-dimensional arrays.
void insertCols(int pos, int n=1)
Insert n columns at the index pos to the array.
Array2DPoint< Type_ > & resize(Range const &I, Range const &J)
resize the array.
void pushBackCols(int n=1)
Add n columns at the end of the array.
Row row(int i) const
access to a part of a row.
void shift(int rbeg, int cbeg)
Set new beginning indexes to the array.
void eraseCols(int pos, int n=1)
Delete n columns at the specified position of the array.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
Array2DPoint< Real > PointX
final class for a Real horizontal container.
@ dense_
dense matrix/vector/array/expression
@ point_
row oriented vector/array/expression
@ by_col_
storage by column
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.
Array2DPoint< int > PointXi
Array2DPoint< double > PointXd
RemoveConst< Type >::Type const & TypeConst