SparseTranspose.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_SPARSETRANSPOSE_H
11 #define EIGEN_SPARSETRANSPOSE_H
12 
13 namespace Eigen {
14 
15 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
16  : public SparseMatrixBase<Transpose<MatrixType> >
17 {
19  public:
20 
22 
23  class InnerIterator;
24  class ReverseInnerIterator;
25 
26  inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
27 };
28 
29 // NOTE: VC10 trigger an ICE if don't put typename TransposeImpl<MatrixType,Sparse>:: in front of Index,
30 // a typedef typename TransposeImpl<MatrixType,Sparse>::Index Index;
31 // does not fix the issue.
32 // An alternative is to define the nested class in the parent class itself.
33 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerIterator
34  : public _MatrixTypeNested::InnerIterator
35 {
36  typedef typename _MatrixTypeNested::InnerIterator Base;
37  typedef typename TransposeImpl::Index Index;
38  public:
39 
41  : Base(trans.derived().nestedExpression(), outer)
42  {}
43  Index row() const { return Base::col(); }
44  Index col() const { return Base::row(); }
45 };
46 
47 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
48  : public _MatrixTypeNested::ReverseInnerIterator
49 {
50  typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
51  typedef typename TransposeImpl::Index Index;
52  public:
53 
55  : Base(xpr.derived().nestedExpression(), outer)
56  {}
57  Index row() const { return Base::col(); }
58  Index col() const { return Base::row(); }
59 };
60 
61 } // end namespace Eigen
62 
63 #endif // EIGEN_SPARSETRANSPOSE_H
#define EIGEN_STRONG_INLINE
EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl &trans, typename TransposeImpl< MatrixType, Sparse >::Index outer)
#define inline
Definition: Types.h:109
Expression of the transpose of a matrix.
Definition: Transpose.h:57
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: matrix.hpp:471
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
Definition: SparseUtil.h:62
Base class of any sparse matrices or sparse expressions.
internal::traits< Derived >::Index Index
Definition: EigenBase.h:31
EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl &xpr, typename TransposeImpl< MatrixType, Sparse >::Index outer)
An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression...
RowXpr row(Index i)
Definition: BlockMethods.h:725
internal::remove_all< typename MatrixType::Nested >::type _MatrixTypeNested
ColXpr col(Index i)
Definition: BlockMethods.h:708


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:10