STK++ 0.9.13
STK_Array2DNumber.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 Array2DNumber class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
36#ifndef STK_ARRAY2DNUMBER_H
37#define STK_ARRAY2DNUMBER_H
38
39#include "STK_IArray2D.h"
40#include "STK_IArray2DSlicers.h"
42
43namespace STK
44{
45
46template<typename> class Array2DNumber;
47
56
57namespace hidden
58{
62template<class Type_>
63struct Traits< Array2DNumber<Type_> >
64{
71
72 typedef Type_ Type;
73 typedef typename RemoveConst<Type>::Type const& TypeConst;
74
75 enum
76 {
77 structure_ = Arrays::number_,
78 orient_ = Arrays::by_col_,
79 sizeRows_ = 1,
80 sizeCols_ = 1,
81 size_ = 1,
82 storage_ = Arrays::dense_ // always dense
83 };
85 typedef ColVector* PtrCol;
86};
87
88} // namespace hidden
89
99template<class Type_>
100class Array2DNumber: public IArray2D< Array2DNumber<Type_> >
101{
102 public:
105
112
115
116 enum
117 {
124 };
125
131 Array2DNumber( Type const& v): Base(Range(1), Range(1))
137 Array2DNumber( Array2DNumber const& T, bool ref =false): Base(T, ref) {}
142 template<class OtherArray>
144 : Base(T, Range(row, 1), Range(col, 1))
145 {}
149 template<class OtherDerived>
157 Array2DNumber( Type** p_data, int row, int col)
158 : Base(p_data, Range(row, 1), Range(col, 1)) {}
162 inline Type const& elt0Impl() const
163 { return (this->allocator_.elt(this->beginCols()))->elt(this->beginRows());}
165 inline Type& elt0Impl()
166 { return (this->allocator_.elt(this->beginCols()))->elt(this->beginRows());}
170 void shift1D(int const& cbeg) { Base::shift(this->beginRows(), cbeg);}
174 template<class Rhs>
184};
185
186} // namespace STK
187
188#endif // STK_ARRAY2DNUMBER_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 number Array.
hidden::Traits< Array2DNumber< Type_ > >::SubCol SubCol
hidden::Traits< Array2DNumber< Type_ > >::SubArray SubArray
ArrayBase< Array2DNumber< Type_ > > LowBase
Array2DNumber(Type const &v)
constructor with specified range, initialization with a constant.
Array2DNumber(IArray2D< OtherArray > const &T, int row, int col)
constructor by reference, ref_=1.
~Array2DNumber()
destructor.
Array2DNumber(Array2DNumber const &T, bool ref=false)
Copy constructor.
hidden::Traits< Array2DNumber< Type_ > >::SubVector SubVector
Array2DNumber()
Default constructor.
hidden::Traits< Array2DNumber< Type_ > >::Type Type
Type const & elt0Impl() const
Array2DNumber & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
hidden::Traits< Array2DNumber< Type_ > >::SubRow SubRow
hidden::Traits< Array2DNumber< Type_ > >::Row Row
Array2DNumber & operator=(const Array2DNumber &T)
operator = : overwrite the CArray with the Right hand side T.
IArray2D< Array2DNumber< Type_ > > Base
Array2DNumber & operator=(Type const &v)
set the container to a constant value.
Array2DNumber(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
hidden::Traits< Array2DNumber< Type_ > >::Col Col
Array2DNumber(Type **p_data, int row, int col)
constructor by reference, ref_=1.
hidden::Traits< Array2DNumber< Type_ > >::TypeConst TypeConst
void shift1D(int const &cbeg)
New first indexes for the object.
Array2DNumber< Type_ > & operator=(Type const &value)
Array2DNumber< Type_ > & setValue(TypeConst value)
set a value to this container.
Array2DNumber< Type_ > & assign(ExprBase< Rhs > const &rhs)
template interface base class for two-dimensional arrays.
Allocator allocator_
allocator of the column data set
Col col(int j) const
access to a part of a column.
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.
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
Array2DNumber< Real > Number
final class for a Real horizontal container.
@ dense_
dense matrix/vector/array/expression
@ number_
(1,1) matrix/vector/array/expression (like a number)
@ by_col_
storage by column
The namespace STK is the main domain space of the Statistical ToolKit project.
Array2DNumber< Real > NumberX
Array2DNumber< int > NumberXi
Array2DNumber< double > NumberXd
TypeConst elt(int pos) const
Get the const element number pos.
RemoveConst< Type >::Type const & TypeConst