STK++ 0.9.13
STK_SArray2DNumber.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 SArray2DNumber class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
36#ifndef STK_SARRAY2DNUMBER_H
37#define STK_SARRAY2DNUMBER_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 SArray2DNumber;
49
57
58namespace hidden
59{
63template<class Type_>
64struct Traits< SArray2DNumber<Type_> >
65{
72
73 typedef Type_ Type;
74 typedef typename RemoveConst<Type>::Type const& TypeConst;
75
76 enum
77 {
78 structure_ = Arrays::number_,
79 orient_ = Arrays::by_col_,
80 sizeRows_ = 1,
81 sizeCols_ = 1,
82 size_ = 1,
83 storage_ = Arrays::sparse_
84 };
86 typedef ColVector* PtrCol;
87};
88
89} // namespace hidden
90
100template<class Type_>
101class SArray2DNumber: public IArray2D< SArray2DNumber<Type_> >
102{
103 public:
106
113
116
117 enum
118 {
125 };
126
138 SArray2DNumber( SArray2DNumber const& T, bool ref =false): Base(T, ref) {}
143 template<class OtherArray>
145 : Base(T, Range(row, 1), Range(col, 1))
146 {}
150 template<class OtherDerived>
158 SArray2DNumber( Type** p_data, int row, int col)
159 : Base(p_data, Range(row, 1), Range(col, 1)) {}
164 inline Type const& elt0Impl() const { return this->data(this->beginCols())[this->beginRows()];}
167 inline Type& elt0Impl() { return this->data(this->beginCols())[this->beginRows()];}
171 void shift1D(int const& cbeg) { Base::shift(this->beginRows(), cbeg);}
175 template<class Rhs>
185};
186
187} // namespace STK
188
189#endif // STK_SARRAY2DNUMBER_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.
SArray2DNumber< Type_ > & operator=(Type const &value)
SArray2DNumber< Type_ > & setValue(TypeConst value)
set a value to this container.
SArray2DNumber< Type_ > & assign(ExprBase< Rhs > const &rhs)
template interface base class for two-dimensional arrays.
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...
template number Array.
hidden::Traits< SArray2DNumber< Type_ > >::SubCol SubCol
hidden::Traits< SArray2DNumber< Type_ > >::Col Col
SArray2DNumber(Type **p_data, int row, int col)
constructor by reference, ref_=1.
ArrayBase< SArray2DNumber< Type_ > > LowBase
hidden::Traits< SArray2DNumber< Type_ > >::SubRow SubRow
SArray2DNumber(SArray2DNumber const &T, bool ref=false)
Copy constructor.
SArray2DNumber & operator=(const SArray2DNumber &T)
operator = : overwrite the CArray with the Right hand side T.
SArray2DNumber(IArray2D< OtherArray > const &T, int row, int col)
constructor by reference, ref_=1.
hidden::Traits< SArray2DNumber< Type_ > >::TypeConst TypeConst
hidden::Traits< SArray2DNumber< Type_ > >::SubVector SubVector
hidden::Traits< SArray2DNumber< Type_ > >::Row Row
SArray2DNumber & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
SArray2DNumber(Type const &v)
constructor with specified range, initialization with a constant.
Type const & elt0Impl() const
hidden::Traits< SArray2DNumber< Type_ > >::Type Type
SArray2DNumber & operator=(Type const &v)
set the container to a constant value.
SArray2DNumber()
Default constructor.
IArray2D< SArray2DNumber< Type_ > > Base
SArray2DNumber(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
void shift1D(int const &cbeg)
New first indexes for the object.
hidden::Traits< SArray2DNumber< Type_ > >::SubArray SubArray
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
SArray2DNumber< Real > SNumberX
final class for a Real horizontal container.
@ sparse_
sparse 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.
SArray2DNumber< int > SNumberXi
SArray2DNumber< double > SNumberXd
RemoveConst< Type >::Type const & TypeConst
SArray1D< Type, UnknownSize, UnknownSize > ColVector