STK++ 0.9.13
STK_TransposeOperator.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: 17 oct. 2012
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
35#ifndef STK_TRANSPOSEOPERATOR_H
36#define STK_TRANSPOSEOPERATOR_H
37
38namespace STK
39{
40
41
42// forward declaration
43template< typename Array> class TransposeOperator;
44
45namespace hidden
46{
47
51template<typename Lhs>
53{
54 enum
55 {
57 orient_ = !Lhs::orient_,
58 sizeRows_ = Lhs::sizeCols_,
59 sizeCols_ = Lhs::sizeRows_,
60 storage_ = Lhs::storage_
61 };
64 typedef typename Lhs::Type Type;
65 typedef typename Lhs::TypeConst TypeConst;
66};
67
68} // end namespace hidden
69
70
85template< typename Lhs>
86class TransposeOperator: public ExprBase< TransposeOperator<Lhs> >, public TRef<1>
87{
88 public:
92
93 enum
94 {
100 };
106 inline TransposeOperator( Lhs const& lhs): Base(), lhs_(lhs) {}
107
109 inline RowRange const& rowsImpl() const { return lhs_.cols();}
111 inline ColRange const& colsImpl() const { return lhs_.rows();}
112
114 inline Lhs const& lhs() const { return lhs_; }
118 inline TypeConst elt2Impl(int i, int j) const { return lhs_.elt(j, i);}
122 inline TypeConst elt1Impl(int i) const { return lhs_.elt(i);}
124 inline TypeConst elt0Impl() const { return lhs_.elt();}
125
126 protected:
127 Lhs const& lhs_;
128};
129
130} // namespace STK
131
132#endif /* STK_TRANSPOSEOPERATOR_H */
base class for template evaluation expressions and visitors.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Generic expression when an expression is transposed.
hidden::Traits< TransposeOperator< Lhs > >::TypeConst TypeConst
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
TypeConst elt1Impl(int i) const
ColRange const & colsImpl() const
TypeConst elt2Impl(int i, int j) const
hidden::Traits< TransposeOperator< Lhs > >::Type Type
TransposeOperator(Lhs const &lhs)
Constructor.
RowRange const & rowsImpl() const
TypeConst elt0Impl() const
access to the element of the transposed expression
ExprBase< TransposeOperator< Lhs > > Base
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
The namespace STK is the main domain space of the Statistical ToolKit project.
Base class for all referencing containers.
ColOperator< TransposeOperator< Lhs > > Col
RowOperator< TransposeOperator< Lhs > > Row
Helper Traits class for transposed operator.