From a9b950345444d96529da156f7dc7157f0a7dda04 Mon Sep 17 00:00:00 2001
From: Lukas Cejka <cejkaluk@fjfi.cvut.cz>
Date: Fri, 30 Nov 2018 13:02:31 +0100
Subject: [PATCH] Tried using std::vector to avoid having to implement
 DeviceType into SparseRow. Commiting for backup purposes.

---
 src/TNL/Matrices/SparseRow_impl.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/TNL/Matrices/SparseRow_impl.h b/src/TNL/Matrices/SparseRow_impl.h
index 2f0d87d5eb..bac51dfe80 100644
--- a/src/TNL/Matrices/SparseRow_impl.h
+++ b/src/TNL/Matrices/SparseRow_impl.h
@@ -13,6 +13,10 @@
 #include <TNL/Matrices/SparseRow.h>
 #include <TNL/ParallelFor.h>
 
+// Following includes are here to enable usage of std::vector and std::cout. To avoid having to include Device type (HOW would this be done anyway)
+#include <iostream>
+#include <vector>
+
 namespace TNL {
 namespace Matrices {   
 
@@ -115,6 +119,7 @@ SparseRow< Real, Index >::
 getNonZeroElementsCount() const
 {
     using NonConstIndex = typename std::remove_const< Index >::type;
+    // using DeviceType = typename TNL::Matrices::Matrix::DeviceType;
     
     NonConstIndex elementCount ( 0 );
     
@@ -126,9 +131,14 @@ getNonZeroElementsCount() const
    
 //    ParallelFor< Device >::exec( ( NonConstIndex ) 0, length, computeNonzeros );
 //    The ParallelFor::exec() function needs a < DeviceType >, how to get this into SparseRow?
+    /*
+     
+     */
+    
+    // std::vector< Real > vls = values; // Size of values should be something like: (sizeof(this->values)/sizeof(*this->values)) from https://stackoverflow.com/questions/4108313/how-do-i-find-the-length-of-an-array
    
-    for( NonConstIndex i = 0; i < length; i++ )
-        if( getElementValue( i ) != 0 ) // This returns the same amount of elements in a row as does getRowLength(). WHY?
+    for( NonConstIndex i = 0; i < length; i++ ) // this->values doesn't have anything similar to getSize().
+        if( this->values[ i * step ] != 0.0 ) // This returns the same amount of elements in a row as does getRowLength(). WHY?
             elementCount++;
     
     return elementCount;
-- 
GitLab