aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/SparseCore4
-rw-r--r--Eigen/src/SparseCore/SparseDot.h13
-rw-r--r--Eigen/src/SparseCore/SparseRedux.h6
-rw-r--r--Eigen/src/SparseCore/SparseVector.h22
4 files changed, 43 insertions, 2 deletions
diff --git a/Eigen/SparseCore b/Eigen/SparseCore
index 4ad6f47a0..0433f4877 100644
--- a/Eigen/SparseCore
+++ b/Eigen/SparseCore
@@ -45,10 +45,10 @@ struct Sparse {};
#include "src/SparseCore/SparseCwiseBinaryOp.h"
#include "src/SparseCore/SparseTranspose.h"
#include "src/SparseCore/SparseBlock.h"
-#ifndef EIGEN_TEST_EVALUATORS
#include "src/SparseCore/SparseDot.h"
-#include "src/SparseCore/SparsePermutation.h"
#include "src/SparseCore/SparseRedux.h"
+#ifndef EIGEN_TEST_EVALUATORS
+#include "src/SparseCore/SparsePermutation.h"
#include "src/SparseCore/SparseFuzzy.h"
#include "src/SparseCore/ConservativeSparseSparseProduct.h"
#include "src/SparseCore/SparseSparseProductWithPruning.h"
diff --git a/Eigen/src/SparseCore/SparseDot.h b/Eigen/src/SparseCore/SparseDot.h
index db39c9aec..a63cb003c 100644
--- a/Eigen/src/SparseCore/SparseDot.h
+++ b/Eigen/src/SparseCore/SparseDot.h
@@ -26,7 +26,12 @@ SparseMatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
eigen_assert(size() == other.size());
eigen_assert(other.size()>0 && "you are using a non initialized vector");
+#ifndef EIGEN_TEST_EVALUATORS
typename Derived::InnerIterator i(derived(),0);
+#else
+ typename internal::evaluator<Derived>::type thisEval(derived());
+ typename internal::evaluator<Derived>::InnerIterator i(thisEval, 0);
+#endif
Scalar res(0);
while (i)
{
@@ -49,6 +54,7 @@ SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) cons
eigen_assert(size() == other.size());
+#ifndef EIGEN_TEST_EVALUATORS
typedef typename Derived::Nested Nested;
typedef typename OtherDerived::Nested OtherNested;
typedef typename internal::remove_all<Nested>::type NestedCleaned;
@@ -59,6 +65,13 @@ SparseMatrixBase<Derived>::dot(const SparseMatrixBase<OtherDerived>& other) cons
typename NestedCleaned::InnerIterator i(nthis,0);
typename OtherNestedCleaned::InnerIterator j(nother,0);
+#else
+ typename internal::evaluator<Derived>::type thisEval(derived());
+ typename internal::evaluator<Derived>::InnerIterator i(thisEval, 0);
+
+ typename internal::evaluator<OtherDerived>::type otherEval(other.derived());
+ typename internal::evaluator<OtherDerived>::InnerIterator j(otherEval, 0);
+#endif
Scalar res(0);
while (i && j)
{
diff --git a/Eigen/src/SparseCore/SparseRedux.h b/Eigen/src/SparseCore/SparseRedux.h
index f3da93a71..c6d0182d5 100644
--- a/Eigen/src/SparseCore/SparseRedux.h
+++ b/Eigen/src/SparseCore/SparseRedux.h
@@ -18,8 +18,14 @@ SparseMatrixBase<Derived>::sum() const
{
eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
Scalar res(0);
+#ifndef EIGEN_TEST_EVALUATORS
for (Index j=0; j<outerSize(); ++j)
for (typename Derived::InnerIterator iter(derived(),j); iter; ++iter)
+#else
+ typename internal::evaluator<Derived>::type thisEval(derived());
+ for (Index j=0; j<outerSize(); ++j)
+ for (typename internal::evaluator<Derived>::InnerIterator iter(thisEval,j); iter; ++iter)
+#endif
res += iter.value();
return res;
}
diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h
index cd22dfd49..81f5eb41d 100644
--- a/Eigen/src/SparseCore/SparseVector.h
+++ b/Eigen/src/SparseCore/SparseVector.h
@@ -433,6 +433,28 @@ struct sparse_vector_assign_selector<Dest,Src,SVA_Outer> {
}
};
#else // EIGEN_TEST_EVALUATORS
+
+template<typename _Scalar, int _Options, typename _Index>
+struct evaluator<SparseVector<_Scalar,_Options,_Index> >
+ : evaluator_base<SparseVector<_Scalar,_Options,_Index> >
+{
+ typedef SparseVector<_Scalar,_Options,_Index> SparseVectorType;
+ typedef typename SparseVectorType::InnerIterator InnerIterator;
+ typedef typename SparseVectorType::ReverseInnerIterator ReverseInnerIterator;
+
+ enum {
+ CoeffReadCost = NumTraits<_Scalar>::ReadCost,
+ Flags = SparseVectorType::Flags
+ };
+
+ evaluator(const SparseVectorType &mat) : m_matrix(mat) {}
+
+ operator SparseVectorType&() { return m_matrix.const_cast_derived(); }
+ operator const SparseVectorType&() const { return m_matrix; }
+
+ const SparseVectorType &m_matrix;
+};
+
template< typename Dest, typename Src>
struct sparse_vector_assign_selector<Dest,Src,SVA_Inner> {
static void run(Dest& dst, const Src& src) {