2009-01-14 14:24:10 +00:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
2009-05-22 20:25:33 +02:00
|
|
|
// for linear algebra.
|
2009-01-14 14:24:10 +00:00
|
|
|
//
|
2010-06-24 23:21:58 +02:00
|
|
|
// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
2009-01-14 14:24:10 +00:00
|
|
|
//
|
2012-07-13 14:42:47 -04:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2009-01-14 14:24:10 +00:00
|
|
|
|
|
|
|
|
#ifndef EIGEN_SPARSETRANSPOSE_H
|
|
|
|
|
#define EIGEN_SPARSETRANSPOSE_H
|
|
|
|
|
|
2012-04-15 11:06:28 +01:00
|
|
|
namespace Eigen {
|
|
|
|
|
|
2009-11-16 18:19:08 +01:00
|
|
|
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
|
|
|
|
|
: public SparseMatrixBase<Transpose<MatrixType> >
|
2009-01-14 14:24:10 +00:00
|
|
|
{
|
2010-10-26 16:47:01 +02:00
|
|
|
typedef typename internal::remove_all<typename MatrixType::Nested>::type _MatrixTypeNested;
|
2009-01-14 14:24:10 +00:00
|
|
|
public:
|
|
|
|
|
|
2012-06-28 21:01:02 +02:00
|
|
|
EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose<MatrixType> )
|
2009-01-14 14:24:10 +00:00
|
|
|
|
|
|
|
|
class InnerIterator;
|
|
|
|
|
class ReverseInnerIterator;
|
|
|
|
|
|
2010-05-30 16:00:58 -04:00
|
|
|
inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
|
2009-01-14 14:24:10 +00:00
|
|
|
};
|
|
|
|
|
|
2012-01-18 17:42:13 +01:00
|
|
|
// NOTE: VC10 trigger an ICE if don't put typename TransposeImpl<MatrixType,Sparse>:: in front of Index,
|
|
|
|
|
// a typedef typename TransposeImpl<MatrixType,Sparse>::Index Index;
|
|
|
|
|
// does not fix the issue.
|
|
|
|
|
// An alternative is to define the nested class in the parent class itself.
|
2010-06-25 10:26:24 +02:00
|
|
|
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerIterator
|
|
|
|
|
: public _MatrixTypeNested::InnerIterator
|
2009-01-14 14:24:10 +00:00
|
|
|
{
|
2010-06-25 10:26:24 +02:00
|
|
|
typedef typename _MatrixTypeNested::InnerIterator Base;
|
2009-01-14 14:24:10 +00:00
|
|
|
public:
|
|
|
|
|
|
2012-01-18 17:42:13 +01:00
|
|
|
EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
2009-11-17 16:04:19 +01:00
|
|
|
: Base(trans.derived().nestedExpression(), outer)
|
2009-01-14 14:24:10 +00:00
|
|
|
{}
|
2012-01-18 17:42:13 +01:00
|
|
|
inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
|
|
|
|
|
inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
|
2009-01-14 14:24:10 +00:00
|
|
|
};
|
|
|
|
|
|
2010-06-25 10:26:24 +02:00
|
|
|
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
|
|
|
|
|
: public _MatrixTypeNested::ReverseInnerIterator
|
2009-01-14 14:24:10 +00:00
|
|
|
{
|
2010-06-25 10:26:24 +02:00
|
|
|
typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
|
2009-01-14 14:24:10 +00:00
|
|
|
public:
|
|
|
|
|
|
2012-01-18 17:42:13 +01:00
|
|
|
EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
2009-11-17 16:04:19 +01:00
|
|
|
: Base(xpr.derived().nestedExpression(), outer)
|
2009-01-14 14:24:10 +00:00
|
|
|
{}
|
2012-01-18 17:42:13 +01:00
|
|
|
inline typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
|
|
|
|
|
inline typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
|
2009-01-14 14:24:10 +00:00
|
|
|
};
|
|
|
|
|
|
2012-04-15 11:06:28 +01:00
|
|
|
} // end namespace Eigen
|
|
|
|
|
|
2009-01-14 14:24:10 +00:00
|
|
|
#endif // EIGEN_SPARSETRANSPOSE_H
|