SparseTranspose.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_SPARSETRANSPOSE_H
00011 #define EIGEN_SPARSETRANSPOSE_H
00012 
00013 namespace Eigen { 
00014 
00015 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
00016   : public SparseMatrixBase<Transpose<MatrixType> >
00017 {
00018     typedef typename internal::remove_all<typename MatrixType::Nested>::type _MatrixTypeNested;
00019   public:
00020 
00021     EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose<MatrixType> )
00022 
00023     class InnerIterator;
00024     class ReverseInnerIterator;
00025 
00026     inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
00027 };
00028 
00029 // NOTE: VC10 trigger an ICE if don't put typename TransposeImpl<MatrixType,Sparse>:: in front of Index,
00030 // a typedef typename TransposeImpl<MatrixType,Sparse>::Index Index;
00031 // does not fix the issue.
00032 // An alternative is to define the nested class in the parent class itself.
00033 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerIterator
00034   : public _MatrixTypeNested::InnerIterator
00035 {
00036     typedef typename _MatrixTypeNested::InnerIterator Base;
00037     typedef typename TransposeImpl::Index Index;
00038   public:
00039 
00040     EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
00041       : Base(trans.derived().nestedExpression(), outer)
00042     {}
00043     Index row() const { return Base::col(); }
00044     Index col() const { return Base::row(); }
00045 };
00046 
00047 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
00048   : public _MatrixTypeNested::ReverseInnerIterator
00049 {
00050     typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
00051     typedef typename TransposeImpl::Index Index;
00052   public:
00053 
00054     EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
00055       : Base(xpr.derived().nestedExpression(), outer)
00056     {}
00057     Index row() const { return Base::col(); }
00058     Index col() const { return Base::row(); }
00059 };
00060 
00061 } // end namespace Eigen
00062 
00063 #endif // EIGEN_SPARSETRANSPOSE_H


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 12:00:55