STK++ 0.9.13
STK_SArray2DPoint.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 SArray2DPoint class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
36#ifndef STK_SARRAY2DPOINT_H
37#define STK_SARRAY2DPOINT_H
38
39#include "STK_SArray1D.h"
40
41#include "STK_IArray2D.h"
42#include "STK_IArray2DSlicers.h"
44
45namespace STK
46{
47
48template<typename> class SArray2DPoint;
49template<typename> class SArray2DVector;
50
58
59namespace hidden
60{
64template<class Type_>
65struct Traits< SArray2DPoint<Type_> >
66{
73
74 typedef Type_ Type;
75 typedef typename RemoveConst<Type>::Type const& TypeConst;
76
77 enum
78 {
79 structure_ = Arrays::point_,
80 orient_ = Arrays::by_col_,
81 sizeRows_ = 1,
82 sizeCols_ = UnknownSize,
83 size_ = UnknownSize,
84 storage_ = Arrays::sparse_
85 };
87};
88
89} // namespace hidden
90
100template<class Type_>
101class SArray2DPoint: public IArray2D< SArray2DPoint<Type_> >
102{
103 public:
106
113
116
117 enum
118 {
125 };
126
132 SArray2DPoint( Range const& J): Base(Range(1), J) {}
137 SArray2DPoint( Range const& J, Type const& v): Base(Range(1), J)
143 SArray2DPoint( SArray2DPoint const& T, bool ref =false)
144 : Base(T, ref)
145 {}
151 : Base(T, T.rows(), J) {}
157 template<class OtherArray>
159 : Base(T, Range(row, 1), J)
160 {}
164 template<class OtherDerived>
172 SArray2DPoint( Type** p_data, Range const& J, int row)
173 : Base(p_data, Range(row, 1), J) {}
179 Type const & elt1Impl(int const& j) const { return this->elt(this->beginRows(), j);}
183 inline Type& elt1Impl(int const& j) { return this->elt(this->beginRows(), j);}
187 void shift1D(int const& cbeg) { Base::shift(this->beginRows(), cbeg);}
192 { Base::resize(this->rows(), J); return *this;}
197 { this->setValue(this->beginRows(), j, v);}
198
202 void pushBack( int n=1) { Base::pushBackCols(n);}
206 void erase( int pos, int n=1)
207 { Base::eraseCols(pos, n);}
213 void insertElt( int pos, int n =1)
214 { Base::insertCols(pos, n);}
218 template<class Rhs>
228};
229
230} // namespace STK
231
232#endif // STK_SARRAY2DPOINT_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...
In this file we define and implement the final class SArray1D.
SArray2DPoint< Type_ > & operator=(Type const &value)
SArray2DPoint< Type_ > & setValue(TypeConst value)
set a value to this container.
SArray2DPoint< 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.
SArray2DPoint< 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...
template one dimensional horizontal Array.
SArray2DPoint & operator=(Type const &v)
set the container to a constant value.
hidden::Traits< SArray2DPoint< Type_ > >::SubRow SubRow
SArray2DPoint(Range const &J)
constructor with specified range.
SArray2DPoint(IArray2D< OtherArray > const &T, Range const &J, int row)
constructor by reference, ref_=1.
void shift1D(int const &cbeg)
New first indexes for the object.
hidden::Traits< SArray2DPoint< Type_ > >::SubArray SubArray
ArrayBase< SArray2DPoint< Type_ > > LowBase
SArray2DPoint(SArray2DPoint const &T, bool ref=false)
Copy constructor.
hidden::Traits< SArray2DPoint< Type_ > >::Type Type
SArray2DPoint< Type > & resize1D(Range const &J)
Resize the container.
void insertElt(int pos, int n=1)
Insert n elts at the position pos of the container.
void setValue1D(int j, TypeConst v)
Set value at position j.
Type & elt1Impl(int const &j)
SArray2DPoint(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
SArray2DPoint & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
hidden::Traits< SArray2DPoint< Type_ > >::Col Col
SArray2DPoint()
Default constructor.
hidden::Traits< SArray2DPoint< Type_ > >::SubCol SubCol
~SArray2DPoint()
destructor.
SArray2DPoint(Range const &J, Type const &v)
constructor with specified range, initialization with a constant.
Type const & elt1Impl(int const &j) const
void pushBack(int n=1)
Add n elements to the container.
hidden::Traits< SArray2DPoint< Type_ > >::TypeConst TypeConst
hidden::Traits< SArray2DPoint< Type_ > >::Row Row
SArray2DPoint & operator=(const SArray2DPoint &T)
operator = : overwrite the CArray with the Right hand side T.
SArray2DPoint(Type **p_data, Range const &J, int row)
constructor by reference, ref_=1.
IArray2D< SArray2DPoint< Type_ > > Base
hidden::Traits< SArray2DPoint< Type_ > >::SubVector SubVector
SArray2DPoint(SArray2DPoint const &T, Range const &J)
constructor by reference, ref_=1.
void erase(int pos, int n=1)
Delete n elts at the pos index to the container.
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
SArray2DPoint< Real > SPointX
final class for a Real horizontal container.
@ sparse_
sparse 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.
SArray2DPoint< int > SPointXi
SArray2DPoint< double > SPointXd
SArray1D< Type, UnknownSize, UnknownSize > ColVector
RemoveConst< Type >::Type const & TypeConst