STK++ 0.9.13
STK_SArray2DVector.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 SArray2DVector class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
39#ifndef STK_SARRAY2DVECTOR_H
40#define STK_SARRAY2DVECTOR_H
41
42#include "STK_SArray1D.h"
43
44#include "STK_IArray2D.h"
45#include "STK_IArray2DSlicers.h"
47
48namespace STK
49{
50
51template<typename> class SArray2DPoint;
52template<typename> class SArray2DVector;
53
54
63
64namespace hidden
65{
69template<class Type_>
93
94} // namespace hidden
95
106template<class Type_>
107class SArray2DVector: public IArray2D< SArray2DVector<Type_> >
108{
109 public:
112
119
122
123 enum
124 {
131 };
132 using Base::elt;
138 SArray2DVector( Range const& I) :Base(I, Range(1)) {}
143 SArray2DVector( Range const& I, Type const& v): Base(I, Range(1))
144 { LowBase::setValue(v);}
149 SArray2DVector( const SArray2DVector &T, bool ref =false)
150 : Base(T, ref) {}
156 : Base(T, I, T.cols())
157 {}
163 template<class OtherArray>
165 : Base(T, I, Range(col, 1))
166 {}
170 template<class OtherDerived>
172 { LowBase::operator=(T);}
178 SArray2DVector( Type** p_data, Range const& I, int col)
179 : Base(p_data, I, Range(col, 1))
180 {}
186 Type const& elt1Impl( int i) const { return this->elt(i, this->beginCols());}
190 void shift1D( int rbeg) { Base::shift(rbeg, this->beginCols());}
195 { Base::resize(I, this->cols()); return *this;}
200 { this->setValue(i, this->beginCols(), v);}
201
205 void pushBack( int n=1) { Base::pushBackRows(n);}
210 void erase( int pos, int const& n=1) { Base::eraseRows(pos, n);}
217 void insertElt(int pos, int const& n =1)
218 { Base::insertRows(pos, n);}
222 template<class Rhs>
223 SArray2DVector& operator=(ExprBase<Rhs> const& T) { return LowBase::operator=(T);}
227 SArray2DVector& operator=(SArray2DVector const& T) { return LowBase::assign(T);}
231 SArray2DVector& operator=(Type const& v) { return LowBase::setValue(v);}
232};
233
234} // namespace STK
235
236#endif // STK_SARRAY2DVECTOR_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.
Derived & setValue(TypeConst value)
set a value to this container.
template interface base class for two-dimensional arrays.
Derived & resize(Range const &I, Range const &J)
resize the array.
void pushBackRows(int n=1)
Add n rows to the array.
Col col(int j) const
access to a part of a column.
void eraseRows(int pos, int n=1)
Delete n rows at the position pos.
void shift(int rbeg, int cbeg)
Set new beginning indexes to the array.
void insertRows(int pos, int n=1)
Insert n rows at position pos in the array If pos is outside the range of a column,...
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
template one dimensional horizontal Array.
SArray2DVector(const SArray2DVector &T, bool ref=false)
Copy constructor.
IArray2D< SArray2DVector > Base
SArray2DVector & operator=(Type const &v)
set the container to a constant value.
SArray2DVector & operator=(SArray2DVector const &T)
operator = : overwrite the CArray with the Right hand side T.
Type const & elt1Impl(int i) const
hidden::Traits< SArray2DVector >::Type Type
hidden::Traits< SArray2DVector >::SubArray SubArray
void pushBack(int n=1)
Add n elements to the container.
SArray2DVector< Type > & resize1D(Range const &I)
Resize the container.
SArray2DVector(Range const &I, Type const &v)
constructor with specified range, initialization with a constant.
void setValue1D(int i, TypeConst v)
Set value at position i.
hidden::Traits< SArray2DVector >::Col Col
SArray2DVector(IArray2D< OtherArray > const &T, Range const &I, int col)
constructor by reference, ref_=1.
SArray2DVector & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
hidden::Traits< SArray2DVector >::SubVector SubVector
hidden::Traits< SArray2DVector >::TypeConst TypeConst
SArray2DVector()
Default constructor.
hidden::Traits< SArray2DVector >::Row Row
ArrayBase< SArray2DVector > LowBase
hidden::Traits< SArray2DVector >::SubRow SubRow
void erase(int pos, int const &n=1)
Delete n elements at the pos index to the container.
SArray2DVector(const SArray2DVector &T, Range const &I)
constructor by reference, ref_=1.
SArray2DVector(Range const &I)
constructor with specified range.
void shift1D(int rbeg)
New first index for the object.
SArray2DVector(Type **p_data, Range const &I, int col)
constructor by reference, ref_=1.
void insertElt(int pos, int const &n=1)
Insert n elements at the position pos of the container.
SArray2DVector(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
hidden::Traits< SArray2DVector >::SubCol SubCol
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
SArray2DVector< Real > SVectorX
final class for a Real vertical container.
@ sparse_
sparse matrix/vector/array/expression
@ vector_
column 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.
SArray2DVector< int > SVectorXi
SArray2DVector< double > SVectorXd
RemoveConst< Type >::Type const & TypeConst
SArray1D< Type, UnknownSize, UnknownSize > ColVector