diff options
author | Gael Guennebaud <g.gael@free.fr> | 2017-01-25 17:39:01 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2017-01-25 17:39:01 +0100 |
commit | 296d24be4dd3c700089d1d9182a843c60d68019c (patch) | |
tree | 36118200fe6a05bf4d19daf0f5b7130bc0f0b8ce /Eigen/src/Core/CoreEvaluators.h | |
parent | d06a48959abac6369336d3873d46aee78f8fbec2 (diff) |
bug #1381: fix sparse.diagonal() used as a rvalue.
The problem was that is "sparse" is not const, then sparse.diagonal() must have the
LValueBit flag meaning that sparse.diagonal().coeff(i) must returns a const reference,
const Scalar&. However, sparse::coeff() cannot returns a reference for a non-existing
zero coefficient. The trick is to return a reference to a local member of
evaluator<SparseMatrix>.
Diffstat (limited to 'Eigen/src/Core/CoreEvaluators.h')
-rw-r--r-- | Eigen/src/Core/CoreEvaluators.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index 24fc7835b..412f5a661 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -1613,9 +1613,7 @@ struct evaluator<Diagonal<ArgType, DiagIndex> > { } typedef typename XprType::Scalar Scalar; - // FIXME having to check whether ArgType is sparse here i not very nice. - typedef typename internal::conditional<!internal::is_same<typename ArgType::StorageKind,Sparse>::value, - typename XprType::CoeffReturnType,Scalar>::type CoeffReturnType; + typedef typename XprType::CoeffReturnType CoeffReturnType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index) const |