STK++ 0.9.13
STK_Array2DUpperTriangular.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 Upper Triangular Array class.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 **/
31
36#ifndef STK_ARRAY2DUPPERTRIANGULAR_H
37#define STK_ARRAY2DUPPERTRIANGULAR_H
38
39#include "STK_IArray2D.h"
40#include "STK_IArray2DSlicers.h"
42
43namespace STK
44{
45// forward declaration
46template<typename> class Array2DUpperTriangular;
47template<typename> class Array2DPoint;
48template<typename> class Array2DVector;
49
58
59namespace hidden
60{
64template<typename Type_>
66{
67 private:
68 class Void {};
69 public:
75 typedef Void SubVector;
76
77 typedef Type_ Type;
78 typedef typename RemoveConst<Type>::Type const& TypeConst;
79
80 enum
81 {
83 orient_ = Arrays::by_col_,
84 sizeRows_ = UnknownSize,
85 sizeCols_ = UnknownSize,
86 storage_ = Arrays::dense_ // always dense
87 };
89};
90
91}
92
106template<typename Type_>
107class Array2DUpperTriangular: public IArray2D< Array2DUpperTriangular<Type_> >
108{
109 public:
113
120
123
124 enum
125 {
130 storage_ = Arrays::dense_ // always dense
131 };
138 Array2DUpperTriangular( Range const& I, Range const& J): Base(I, J) {}
145 Array2DUpperTriangular( Range const& I, Range const& J, Type const& v)
146 : Base(I, J)
153 : Base(T, ref) {}
159 Array2DUpperTriangular( Base const& T, Range const& I, Range const& J)
160 : Base(T, I, J) {}
166 Array2DUpperTriangular( Type** q, Range const& I, Range const& J)
167 : Base(q, I, J) {}
171 template<class OtherDerived>
179 template<class Rhs>
190 void shift1D(int beg)
191 { Base::shift(beg, beg);}
196 { Base::resize(I, I); return *this;}
197};
198
199} // namespace STK
200
201#endif
202// STK_ARRAY2DUPPERTRIANGULAR_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...
Declaration of the upper triangular matrix class.
Array2DUpperTriangular(Array2DUpperTriangular const &T, bool ref=false)
Copy constructor.
IArray2D< Array2DUpperTriangular< Type_ > > Base
Type for the Interface Class.
Array2DUpperTriangular(Base const &T, Range const &I, Range const &J)
constructor by reference in a given range, ref_=1.
Array2DUpperTriangular(Range const &I, Range const &J, Type const &v)
constructor with rows_ and rageHo_ specified, initialization with a specified value.
Array2DUpperTriangular & operator=(Type const &v)
Operator = : overwrite with a constant value.
hidden::Traits< Array2DUpperTriangular< Type_ > >::SubRow SubRow
Array2DUpperTriangular & resize1D(Range const &I)
New size for the container.
Array2DUpperTriangular(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
ArrayBase< Array2DUpperTriangular< Type_ > > LowBase
Array2DUpperTriangular & operator=(const Array2DUpperTriangular &T)
Operator = : overwrite the Array2DUpperTriangular with T.
hidden::Traits< Array2DUpperTriangular< Type_ > >::SubVector SubVector
hidden::Traits< Array2DUpperTriangular< Type_ > >::Type Type
hidden::Traits< Array2DUpperTriangular< Type_ > >::Row Row
hidden::Traits< Array2DUpperTriangular< Type_ > >::Col Col
hidden::Traits< Array2DUpperTriangular< Type_ > >::SubCol SubCol
hidden::Traits< Array2DUpperTriangular< Type_ > >::TypeConst TypeConst
Array2DUpperTriangular(Type **q, Range const &I, Range const &J)
Wrapper constructor Contruct a reference container.
void shift1D(int beg)
New beginning index for the object.
hidden::Traits< Array2DUpperTriangular< Type_ > >::SubArray SubArray
Array2DUpperTriangular & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
Array2DUpperTriangular(Range const &I, Range const &J)
constructor with specified ranges
Array2DUpperTriangular< Type_ > & operator=(Type const &value)
Array2DUpperTriangular< Type_ > & setValue(TypeConst value)
set a value to this container.
Array2DUpperTriangular< Type_ > & assign(ExprBase< Rhs > const &rhs)
template interface base class for two-dimensional arrays.
Array2DUpperTriangular< Type_ > & resize(Range const &I, Range const &J)
resize the array.
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
Array2DUpperTriangular< Real > ArrayUpperTriangularXX
Specialization of the Array2D class for Type values.
@ dense_
dense matrix/vector/array/expression
@ upper_triangular_
upper triangular 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.
Array2DUpperTriangular< double > ArrayUpperTriangularXXd
Array2DUpperTriangular< int > ArrayUpperTriangularXXi