STK++ 0.9.13
STK_CArrayNumber.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 * created on: 25 nov. 2011
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
35#ifndef STK_CARRAYNUMBER_H
36#define STK_CARRAYNUMBER_H
37
38#include "STK_ICArray.h"
39
40namespace STK
41{
42// forward declaration
43template< typename Type, bool Orient_ = Arrays::by_col_> class CArrayNumber;
44template< typename Type, int SizeRows_, int SizeCols_, bool Orient_> class CArray;
45template< typename Type, int Size_, bool Orient_> class CArraySquare;
46template< typename Type, int SizeCols_, bool Orient_> class CArrayPoint;
47template< typename Type, int SizeRows_, bool Orient_ > class CArrayVector;
48
49// typedef for CArrayVector Real is by default double, but can be float
53
57
58namespace hidden
59{
63template<typename Type_, bool Orient_>
64struct Traits< CArrayNumber<Type_, Orient_> >
65{
68
69 // The CAllocator have to have the same structure than the CArrayNumber
71
72 typedef Type_ Type;
73 typedef typename RemoveConst<Type>::Type const& TypeConst;
74
75 enum
76 {
77 structure_ = Arrays::number_,
78 orient_ = Orient_,
79 sizeRows_ = 1,
80 sizeCols_ = 1,
81 size_ = 1,
82 storage_ = Arrays::dense_
83 };
84};
85
86
87} // namespace hidden
88
89
93template <typename Type_, bool Orient_>
94class CArrayNumber: public ICArray < CArrayNumber<Type_, Orient_> >
95{
96 public:
99
104
105 enum
106 {
113 };
119 CArrayNumber( Type const& v): Base(1, 1, v) {}
124 CArrayNumber( CArrayNumber const& T, bool ref=false): Base(T, ref) {}
128 CArrayNumber( Type* const& q): Base(q, 1, 1) {}
132 template<class OtherAllocator>
137 template<class OtherDerived>
148 template<class Rhs>
154};
155
156} // namespace STK
157
158
159#endif /* STK_CARRAYNUMBER_H */
Interface base class for the CArray, this is an internal header file, included by other Containers li...
CArrayNumber< Type_, Orient_ > & operator=(Type const &value)
CArrayNumber< Type_, Orient_ > & setValue(TypeConst value)
set a value to this container.
CArrayNumber< Type_, Orient_ > & assign(ExprBase< Rhs > const &rhs)
specialization for the number case.
CArrayNumber(Type *const &q)
wrapper constructor for 0 based C-Array.
CArrayNumber(Type const &v)
constructor with an initial value, initialization with a constant.
hidden::Traits< CArrayNumber< Type_, Orient_ > >::Row Row
CArrayNumber(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
hidden::Traits< CArrayNumber< Type_, Orient_ > >::Col Col
~CArrayNumber()
destructor.
ArrayBase< CArrayNumber< Type_, Orient_ > > LowBase
CArrayNumber()
Default constructor.
hidden::Traits< CArrayNumber< Type_, Orient_ > >::TypeConst TypeConst
CArrayNumber & operator=(Type const &v)
operator= : set the container to a constant value.
CArrayNumber(ITContainer2D< OtherAllocator > const &allocator)
constructor by reference.
ICArray< CArrayNumber< Type_, Orient_ > > Base
hidden::Traits< CArrayNumber< Type_, Orient_ > >::Type Type
CArrayNumber & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArrayNumber with the Right hand side T.
CArrayNumber(CArrayNumber const &T, bool ref=false)
Copy constructor.
CArrayNumber & operator=(CArrayNumber const &rhs)
operator = : overwrite the CArrayNumber with the Right hand side rhs.
Allocator const & allocator() const
Get a constant reference on the main allocator.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
@ dense_
dense matrix/vector/array/expression
@ number_
(1,1) matrix/vector/array/expression (like a number)
The namespace STK is the main domain space of the Statistical ToolKit project.
CArrayNumber< int, Arrays::by_col_ > CNumberi
CArrayNumber< int, Arrays::by_row_ > CNumberByRowi
CArrayNumber< double, Arrays::by_col_ > CNumberd
CArrayNumber< Real, Arrays::by_col_ > CNumber
CArrayNumber< double, Arrays::by_row_ > CNumberByRowd
CArrayNumber< Real, Arrays::by_row_ > CNumberByRow