From 24dc07651955fe2cba73cdd952246918c01bb224 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Fri, 12 Oct 2018 10:22:19 +0200 Subject: [PATCH 1/2] Explicitly convert 0 to Scalar for custom types --- Eigen/src/SparseCore/SparseMatrix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index 8bfa5f6b8..eedae47e8 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -893,7 +893,7 @@ public: Index p = m_outerIndex[outer] + m_innerNonZeros[outer]++; m_data.index(p) = convert_index(inner); - return (m_data.value(p) = 0); + return (m_data.value(p) = Scalar(0)); } private: @@ -1274,7 +1274,7 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar& m_innerNonZeros[outer]++; m_data.index(p) = inner; - return (m_data.value(p) = 0); + return (m_data.value(p) = Scalar(0)); } template @@ -1381,7 +1381,7 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_StorageIndex>::Scalar& } m_data.index(p) = inner; - return (m_data.value(p) = 0); + return (m_data.value(p) = Scalar(0)); } namespace internal { From 0ed811a9c1e663a1125adbe1d5ce8c19491928ac Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 12 Oct 2018 13:41:57 -0700 Subject: [PATCH 2/2] Suppress unused variable compiler warning in sparse subtest 3. --- test/sparse_basic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index e26febe0e..87e171aeb 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -643,6 +643,7 @@ template void sparse_basic(const SparseMatrixType& re template void big_sparse_triplet(Index rows, Index cols, double density) { + g_dense_op_sparse_count = 0; // Suppresses compiler warning. typedef typename SparseMatrixType::StorageIndex StorageIndex; typedef typename SparseMatrixType::Scalar Scalar; typedef Triplet TripletType;