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   public:
00038 
00039     EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
00040       : Base(trans.derived().nestedExpression(), outer)
00041     {}
00042     inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
00043     inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
00044 };
00045 
00046 template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
00047   : public _MatrixTypeNested::ReverseInnerIterator
00048 {
00049     typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
00050   public:
00051 
00052     EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
00053       : Base(xpr.derived().nestedExpression(), outer)
00054     {}
00055     inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
00056     inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
00057 };
00058 
00059 } // end namespace Eigen
00060 
00061 #endif // EIGEN_SPARSETRANSPOSE_H


win_eigen
Author(s): Daniel Stonier
autogenerated on Mon Oct 6 2014 12:26:27