STK++ 0.9.13
STK_Array2DSquare.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 Array2DSquare class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
35
36#ifndef STK_ARRAY2DSQUARE_H
37#define STK_ARRAY2DSQUARE_H
38
39#include "STK_IArray2D.h"
40#include "STK_IArray2DSlicers.h"
42
43namespace STK
44{
45// forward declaration
46template< typename Type> class Array2DSquare;
47template< typename Type> class Array2D;
48template< typename Type> class Array2DPoint;
49template< typename Type> class Array2DVector;
50
54
55namespace hidden
56{
60template<class Type_>
87
88} // namespace hidden
89
99template<class Type_>
100class Array2DSquare: public IArray2D< Array2DSquare<Type_> >
101{
102 public:
106
113
116
117 enum
118 {
125 };
126
132 Array2DSquare( Range const& I): Base(I, I) {}
138 Array2DSquare( Range const& I, Type const& v): Base(I, I)
139 { LowBase::setValue(v);}
140
144 Array2DSquare( Array2DSquare const&T, bool ref=false): Base(T, ref) {}
149 Array2DSquare( Array2DSquare const& T, Range const& I): Base(T, I, I) {}
153 template<class OtherDerived>
156
161 void shift1D(int beg)
162 { Base::shift(beg, beg);}
163
167 { Base::resize(I, I); return *this;}
168
171 void insert( int pos, int n =1)
172 {
173 Base::insertRows(pos, n);
174 Base::insertCols(pos, n);
175 }
176
180 void erase( int pos, int n=1)
181 {
182 Base::eraseCols(pos, n);
183 Base::eraseRows(pos, n);
184 }
185
188 void pushBack(int n=1)
189 {
192 }
193
196 void popBack(int n=1)
197 {
200 }
201
204 template<class Rhs>
214};
215
216} // namespace STK
217
218
219#endif
220// STK_ARRAY2DSQUARE_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 Arrays.
template one dimensional horizontal Array.
Derivation of the Array2DSquare class for square arrays of Real.
hidden::Traits< Array2DSquare< Type > >::Row Row
IArray2D< Array2DSquare< Type > > Base
void pushBack(int n=1)
Add n rows and columns to the container.
void popBack(int n=1)
Delete n rows and columns at the end of the container.
hidden::Traits< Array2DSquare< Type > >::SubArray SubArray
hidden::Traits< Array2DSquare< Type > >::Type Type
void insert(int pos, int n=1)
Insert n rows and column at the given position to the container.
hidden::Traits< Array2DSquare< Type > >::SubVector SubVector
Array2DSquare(Range const &I, Type const &v)
constructor with cols_and rows_ givens, initialization with a constant.
Array2DSquare(Array2DSquare const &T, Range const &I)
constructor by reference, ref_=1 in the range given by I.
Array2DSquare(Range const &I)
Default constructor with specified Range.
hidden::Traits< Array2DSquare< Type > >::SubCol SubCol
Array2DSquare & operator=(Array2DSquare const &T)
overwrite the Array2D with T.
Array2DSquare(Array2DSquare const &T, bool ref=false)
Copy constructor.
hidden::Traits< Array2DSquare< Type > >::SubRow SubRow
hidden::Traits< Array2DSquare< Type > >::TypeConst TypeConst
hidden::Traits< Array2DSquare< Type > >::Col Col
Array2DSquare & operator=(Type const &v)
set the container to a constant value.
ArrayBase< Array2DSquare< Type > > LowBase
Array2DSquare & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
Array2DSquare()
Default constructor with cols_=(1:0) and rows_=(1:0).
void shift1D(int beg)
New beginning index for the object.
Array2DSquare(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
Array2DSquare & resize1D(Range const &I)
New size for the container.
void erase(int pos, int n=1)
Delete n rows and columns at the specified position to the container.
~Array2DSquare()
destructor.
template one dimensional horizontal Array.
template two dimensional column (vertically) oriented Array.
base class for template arrays.
Array2DSquare< Type_ > & operator=(Type const &value)
Array2DSquare< Type_ > & setValue(TypeConst value)
Array2DSquare< Type_ > & assign(ExprBase< Rhs > const &rhs)
base class for template evaluation expressions and visitors.
Array2DSquare< Type_ > & resize(Range const &I, Range const &J)
@ dense_
dense 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 hidden namespace enclose the classes and methods which are used internally by the STK++ classes.
The namespace STK is the main domain space of the Statistical ToolKit project.
Array2DSquare< Real > ArraySquareX
Array2DSquare< double > ArraySquareXd
Array2DSquare< int > ArraySquareXi
TRange< UnknownSize > Range
Definition STK_Range.h:59
std::remove_const< typenamestd::remove_reference< Type_ >::type >::type Type
RemoveConst< Type >::Type const & TypeConst