Eigen  3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
 
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Loading...
Searching...
No Matches
SparseTranspose.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008-2015 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// IWYU pragma: private
14#include "./InternalHeaderCheck.h"
15
16namespace Eigen {
17
18namespace internal {
19template <typename MatrixType, int CompressedAccess = int(MatrixType::Flags & CompressedAccessBit)>
20class SparseTransposeImpl : public SparseMatrixBase<Transpose<MatrixType> > {};
21
22template <typename MatrixType>
23class SparseTransposeImpl<MatrixType, CompressedAccessBit> : public SparseCompressedBase<Transpose<MatrixType> > {
24 typedef SparseCompressedBase<Transpose<MatrixType> > Base;
25
26 public:
27 using Base::derived;
28 typedef typename Base::Scalar Scalar;
29 typedef typename Base::StorageIndex StorageIndex;
30
31 inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
32
33 inline const Scalar* valuePtr() const { return derived().nestedExpression().valuePtr(); }
34 inline const StorageIndex* innerIndexPtr() const { return derived().nestedExpression().innerIndexPtr(); }
35 inline const StorageIndex* outerIndexPtr() const { return derived().nestedExpression().outerIndexPtr(); }
36 inline const StorageIndex* innerNonZeroPtr() const { return derived().nestedExpression().innerNonZeroPtr(); }
37
38 inline Scalar* valuePtr() { return derived().nestedExpression().valuePtr(); }
39 inline StorageIndex* innerIndexPtr() { return derived().nestedExpression().innerIndexPtr(); }
40 inline StorageIndex* outerIndexPtr() { return derived().nestedExpression().outerIndexPtr(); }
41 inline StorageIndex* innerNonZeroPtr() { return derived().nestedExpression().innerNonZeroPtr(); }
42};
43} // namespace internal
44
45template <typename MatrixType>
46class TransposeImpl<MatrixType, Sparse> : public internal::SparseTransposeImpl<MatrixType> {
47 protected:
48 typedef internal::SparseTransposeImpl<MatrixType> Base;
49};
50
51namespace internal {
52
53template <typename ArgType>
54struct unary_evaluator<Transpose<ArgType>, IteratorBased> : public evaluator_base<Transpose<ArgType> > {
55 typedef typename evaluator<ArgType>::InnerIterator EvalIterator;
56
57 public:
58 typedef Transpose<ArgType> XprType;
59
60 inline Index nonZerosEstimate() const { return m_argImpl.nonZerosEstimate(); }
61
62 class InnerIterator : public EvalIterator {
63 public:
64 EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer)
65 : EvalIterator(unaryOp.m_argImpl, outer) {}
66
67 Index row() const { return EvalIterator::col(); }
68 Index col() const { return EvalIterator::row(); }
69 };
70
71 enum { CoeffReadCost = evaluator<ArgType>::CoeffReadCost, Flags = XprType::Flags };
72
73 explicit unary_evaluator(const XprType& op) : m_argImpl(op.nestedExpression()) {}
74
75 protected:
76 evaluator<ArgType> m_argImpl;
77};
78
79} // end namespace internal
80
81} // end namespace Eigen
82
83#endif // EIGEN_SPARSETRANSPOSE_H
internal::traits< Transpose< MatrixType > >::StorageIndex StorageIndex
Definition SparseMatrixBase.h:44
const unsigned int CompressedAccessBit
Definition Constants.h:195
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:82
constexpr Transpose< MatrixType > & derived()
Definition EigenBase.h:49
Eigen::Index Index
Definition EigenBase.h:43
Definition Constants.h:522