From 91b5371c2f1491ee6914b08dcf378335a31bff21 Mon Sep 17 00:00:00 2001
From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz>
Date: Tue, 4 Feb 2020 10:38:06 +0100
Subject: [PATCH] All binary sparse matrix unit tests pass well.

---
 src/TNL/Matrices/SparseMatrixView.hpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/TNL/Matrices/SparseMatrixView.hpp b/src/TNL/Matrices/SparseMatrixView.hpp
index 5b043753f8..afc21788a9 100644
--- a/src/TNL/Matrices/SparseMatrixView.hpp
+++ b/src/TNL/Matrices/SparseMatrixView.hpp
@@ -454,7 +454,10 @@ forRows( IndexType first, IndexType last, Function& function )
    const IndexType paddingIndex_ = this->getPaddingIndex();
    auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable {
       if( isBinary() )
-         function( rowIdx, localIdx, columns_view[ globalIdx ], 1, compute );
+      {
+         RealType one( columns_view[ globalIdx ] != paddingIndex_ );
+         function( rowIdx, localIdx, columns_view[ globalIdx ], one, compute );
+      }
       else
          function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ], compute );
    };
-- 
GitLab