STK++ 0.9.13
STK_SArray2DSquare.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 SArray2DSquare class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
36#ifndef STK_SARRAY2DSQUARE_H
37#define STK_SARRAY2DSQUARE_H
38
39#include "STK_SArray1D.h"
40
41#include "STK_IArray2D.h"
42#include "STK_IArray2DSlicers.h"
44
45namespace STK
46{
47// forward declaration
48template< typename Type> class SArray2DSquare;
49template< typename Type> class SArray2D;
50template< typename Type> class SArray2DPoint;
51template< typename Type> class SArray2DVector;
52
56
57namespace hidden
58{
62template<class Type_>
63struct Traits<SArray2DSquare<Type_> >
64{
65 private:
66 class Void {};
67 public:
73 typedef Void SubVector;
74
75 typedef Type_ Type;
76 typedef typename RemoveConst<Type>::Type const& TypeConst;
77
78 enum
79 {
80 structure_ = Arrays::square_,
81 orient_ = Arrays::by_col_,
82 sizeRows_ = UnknownSize,
83 sizeCols_ = UnknownSize,
84 size_ = UnknownSize,
85 storage_ = Arrays::sparse_
86 };
88};
89
90} // namespace hidden
91
101template<class Type_>
102class SArray2DSquare: public IArray2D< SArray2DSquare<Type_> >
103{
104 public:
108
115
118
119 enum
120 {
127 };
128
134 SArray2DSquare( Range const& I): Base(I, I) {}
140 SArray2DSquare( Range const& I, Type const& v): Base(I, I)
146 SArray2DSquare( SArray2DSquare const&T, bool ref=false): Base(T, ref) {}
151 SArray2DSquare( SArray2DSquare const& T, Range const& I): Base(T, I, I) {}
155 template<class OtherDerived>
163 void shift1D(int beg)
164 { Base::shift(beg, beg);}
169 { Base::resize(I, I); return *this;}
173 void insert( int pos, int n =1)
174 {
175 Base::insertRows(pos, n);
176 Base::insertCols(pos, n);
177 }
182 void erase( int pos, int n=1)
183 {
184 Base::eraseCols(pos, n);
185 Base::eraseRows(pos, n);
186 }
190 void pushBack(int n=1)
191 {
194 }
198 void popBack(int n=1)
199 {
202 }
206 template<class Rhs>
216};
217
218} // namespace STK
219
220
221#endif
222// STK_SARRAY2DSQUARE_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.
SArray2DSquare< Type_ > & operator=(Type const &value)
SArray2DSquare< Type_ > & setValue(TypeConst value)
set a value to this container.
SArray2DSquare< 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.
SArray2DSquare< 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.
void popBackCols(int n=1)
Delete last columns of the array.
void pushBackRows(int n=1)
Add n rows to the array.
void eraseRows(int pos, int n=1)
Delete n rows at the position pos.
void popBackRows(int n=1)
Delete n latest rows of the array.
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,...
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...
Derivation of the SArray2DSquare class for square arrays of Real.
SArray2DSquare(Range const &I, Type const &v)
constructor with cols_and rows_ givens, initialization with a constant.
SArray2DSquare & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
void erase(int pos, int n=1)
Delete n rows and columns at the specified position to the container.
void insert(int pos, int n=1)
Insert n rows and column at the given position to the container.
hidden::Traits< SArray2DSquare< Type_ > >::SubRow SubRow
hidden::Traits< SArray2DSquare< Type_ > >::Type Type
SArray2DSquare(SArray2DSquare const &T, Range const &I)
constructor by reference, ref_=1 in the range given by I.
SArray2DSquare & operator=(Type const &v)
set the container to a constant value.
SArray2DSquare & resize1D(Range const &I)
New size for the container.
IArray2D< SArray2DSquare< Type_ > > Base
Type for the Interface Class.
ArrayBase< SArray2DSquare< Type_ > > LowBase
SArray2DSquare(SArray2DSquare const &T, bool ref=false)
Copy constructor.
hidden::Traits< SArray2DSquare< Type_ > >::Col Col
hidden::Traits< SArray2DSquare< Type_ > >::SubCol SubCol
SArray2DSquare & operator=(SArray2DSquare const &T)
overwrite the SArray2D with T.
SArray2DSquare()
Default constructor with cols_=(1:0) and rows_=(1:0).
hidden::Traits< SArray2DSquare< Type_ > >::SubVector SubVector
hidden::Traits< SArray2DSquare< Type_ > >::Row Row
SArray2DSquare(Range const &I)
Default constructor with specified Range.
void popBack(int n=1)
Delete n rows and columns at the end of the container.
void shift1D(int beg)
New beginning index for the object.
SArray2DSquare(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
hidden::Traits< SArray2DSquare< Type_ > >::TypeConst TypeConst
void pushBack(int n=1)
Add n rows and columns to the container.
hidden::Traits< SArray2DSquare< Type_ > >::SubArray SubArray
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
@ sparse_
sparse matrix/vector/array/expression
@ square_
square matrix/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.
SArray2DSquare< double > SArraySquareXd
SArray2DSquare< Real > SArraySquareX
SArray2DSquare< int > SArraySquareXi
RemoveConst< Type >::Type const & TypeConst
SArray1D< Type, UnknownSize, UnknownSize > ColVector