STK++ 0.9.13
STK_TransposeAccessor.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_TRANSPOSEACCESSOR_H
36#define STK_TRANSPOSEACCESSOR_H
37
38namespace STK
39{
40
41// forward declaration
42template< typename Array> class TransposeAccessor;
43
44namespace hidden
45{
49template<typename Lhs>
51{
52 enum
53 {
55 orient_ = !Lhs::orient_,
56 sizeRows_ = Lhs::sizeCols_,
57 sizeCols_ = Lhs::sizeRows_,
58 storage_ = Lhs::storage_
59 };
62 typedef typename Lhs::Type Type;
63 typedef typename Lhs::TypeConst TypeConst;
64};
65
66} // end namespace hidden
67
68
83template< typename Lhs>
84class TransposeAccessor: public ArrayBase< TransposeAccessor<Lhs> >, public TRef<1>
85{
86 public:
90
91 enum
92 {
98 };
105
107 inline RowRange const& rowsImpl() const { return lhs_.cols();}
109 inline ColRange const& colsImpl() const { return lhs_.rows();}
110
112 inline Lhs const& lhs() const { return lhs_; }
113
117 inline TypeConst elt2Impl(int i, int j) const { return lhs_.elt(j, i);}
121 inline TypeConst elt1Impl(int i) const { return lhs_.elt(i);}
123 inline TypeConst elt0Impl() const { return lhs_.elt();}
127 inline Type& elt2Impl(int i, int j) { return lhs_.elt(j, i);}
131 inline Type& elt1Impl(int i) { return lhs_.elt(i);}
133 inline Type& elt0Impl() { return lhs_.elt();}
134
135 protected:
137};
138
139} // namespace STK
140
141#endif /* STK_TRANSPOSEACCESSOR_H */
base class for template arrays.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Generic expression when an expression is transposed.
TRange< sizeRows_ > RowRange
Type of the Range for the rows.
ColRange const & colsImpl() const
TypeConst elt0Impl() const
access to the element of the transposed expression
TransposeAccessor(Lhs &lhs)
Constructor.
ArrayBase< TransposeAccessor< Lhs > > Base
hidden::Traits< TransposeOperator< Lhs > >::Type Type
RowRange const & rowsImpl() const
TRange< sizeCols_ > ColRange
Type of the Range for the columns.
TypeConst elt1Impl(int i) const
TypeConst elt2Impl(int i, int j) const
hidden::Traits< TransposeOperator< Lhs > >::TypeConst TypeConst
Type & elt0Impl()
access to the element of the transposed expression
Type & elt2Impl(int i, int j)
The namespace STK is the main domain space of the Statistical ToolKit project.
Base class for all referencing containers.
ColOperator< TransposeAccessor< Lhs > > Col
RowOperator< TransposeAccessor< Lhs > > Row
Helper Traits class for transposed operator.