STK++ 0.9.13
STK_SArray2DUpperTriangular.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_SARRAY2DUPPERTRIANGULAR_H
37#define STK_SARRAY2DUPPERTRIANGULAR_H
38
39#include "STK_SArray1D.h"
40
41#include "STK_IArray2D.h"
42#include "STK_IArray2DSlicers.h"
44
45namespace STK
46{
47// forward declaration
48template<typename> class SArray2DUpperTriangular;
49template<typename> class SArray2DPoint;
50template<typename> class SArray2DVector;
51
60
61namespace hidden
62{
66template<typename Type_>
68{
69 private:
70 class Void {};
71 public:
77 typedef Void SubVector;
78
79 typedef Type_ Type;
80 typedef typename RemoveConst<Type>::Type const& TypeConst;
81
82 enum
83 {
85 orient_ = Arrays::by_col_,
86 sizeRows_ = UnknownSize,
87 sizeCols_ = UnknownSize,
88 storage_ = Arrays::sparse_
89 };
91};
92
93} // namespace hidden
94
108template<typename Type_>
109class SArray2DUpperTriangular: public IArray2D< SArray2DUpperTriangular<Type_> >
110{
111 public:
115
122
125
126 enum
127 {
132 storage_ = Arrays::dense_ // always dense
133 };
139 SArray2DUpperTriangular( Range const& I, Range const& J): Base(I, J) {}
145 SArray2DUpperTriangular( Range const& I, Range const& J, Type const& v)
146 : Base(I, J)
147 { LowBase::setValue(v);}
153 : Base(T, ref) {}
159 SArray2DUpperTriangular( Base const& T, Range const& I, Range const& J)
160 : Base(T, I, J) {}
167 : Base(q, I, J) {}
171 template<class OtherDerived>
173 { LowBase::operator=(T);}
179 template<class Rhs>
181 { return LowBase::operator=(T);}
184 { return LowBase::assign(T);}
186 SArray2DUpperTriangular& operator=(Type const& v) { return LowBase::setValue(v);}
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_SARRAY2DUPPERTRIANGULAR_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.
template interface base class for two-dimensional arrays.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Declaration of the upper triangular matrix class.
SArray2DUpperTriangular(Base const &T, Range const &I, Range const &J)
constructor by reference in a given range, ref_=1.
hidden::Traits< SArray2DUpperTriangular >::SubArray SubArray
hidden::Traits< SArray2DUpperTriangular >::SubVector SubVector
hidden::Traits< SArray2DUpperTriangular >::SubCol SubCol
SArray2DUpperTriangular(Range const &I, Range const &J)
constructor with specified ranges
SArray2DUpperTriangular & operator=(ExprBase< Rhs > const &T)
operator = : overwrite the CArray with the Right hand side T.
SArray2DUpperTriangular & resize1D(Range const &I)
New size for the container.
SArray2DUpperTriangular(Type **q, Range const &I, Range const &J)
Wrapper constructor Contruct a reference container.
SArray2DUpperTriangular(SArray2DUpperTriangular const &T, bool ref=false)
Copy constructor.
IArray2D< SArray2DUpperTriangular > Base
Type for the Interface Class.
hidden::Traits< SArray2DUpperTriangular >::Row Row
hidden::Traits< SArray2DUpperTriangular >::Col Col
hidden::Traits< SArray2DUpperTriangular >::TypeConst TypeConst
SArray2DUpperTriangular & operator=(Type const &v)
Operator = : overwrite with a constant value.
SArray2DUpperTriangular(Range const &I, Range const &J, Type const &v)
constructor with rows_ and rageHo_ specified, initialization with a specified value.
SArray2DUpperTriangular(ExprBase< OtherDerived > const &T)
Copy constructor using an expression.
SArray2DUpperTriangular & operator=(const SArray2DUpperTriangular &T)
Operator = : overwrite the SArray2DUpperTriangular with T.
hidden::Traits< SArray2DUpperTriangular >::Type Type
void shift1D(int beg)
New beginning index for the object.
hidden::Traits< SArray2DUpperTriangular >::SubRow SubRow
ArrayBase< SArray2DUpperTriangular > LowBase
Index sub-vector region: Specialization when the size is unknown.
Definition STK_Range.h:265
SArray2DUpperTriangular< Real > SArrayUpperTriangularXX
Specialization of the SArray2D class for Type values.
@ sparse_
sparse matrix/vector/array/expression
@ 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.
SArray2DUpperTriangular< int > SArrayUpperTriangularXXi
SArray2DUpperTriangular< double > SArrayUpperTriangularXXd