From 537628295e5e7127f5d202e3f73a61103acaad15 Mon Sep 17 00:00:00 2001
From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz>
Date: Wed, 15 Jan 2020 14:42:18 +0100
Subject: [PATCH] Avoiding Matrix::getCompressedRowLengths.

---
 src/Python/pytnl/tnl/SparseMatrix.h |  2 +-
 src/TNL/Matrices/Matrix.h           |  2 +-
 src/TNL/Matrices/Matrix.hpp         | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/Python/pytnl/tnl/SparseMatrix.h b/src/Python/pytnl/tnl/SparseMatrix.h
index b4cc0fc1a5..e4064e1a41 100644
--- a/src/Python/pytnl/tnl/SparseMatrix.h
+++ b/src/Python/pytnl/tnl/SparseMatrix.h
@@ -51,7 +51,7 @@ void export_Matrix( py::module & m, const char* name )
 
     using VectorType = TNL::Containers::Vector< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
 
-    void (Matrix::* _getCompressedRowLengths)(typename Matrix::CompressedRowLengthsVector&) const = &Matrix::getCompressedRowLengths;
+    void (Matrix::* _getCompressedRowLengths)(typename Matrix::CompressedRowLengthsVectorView) const = &Matrix::getCompressedRowLengths;
 
     auto matrix = py::class_< Matrix, TNL::Object >( m, name )
         .def(py::init<>())
diff --git a/src/TNL/Matrices/Matrix.h b/src/TNL/Matrices/Matrix.h
index 0b34a5a57f..a5f2b6b8ff 100644
--- a/src/TNL/Matrices/Matrix.h
+++ b/src/TNL/Matrices/Matrix.h
@@ -57,7 +57,7 @@ public:
 
    // TODO: implementation is not parallel
    // TODO: it would be nice if padding zeros could be stripped
-   void getCompressedRowLengths( CompressedRowLengthsVector& rowLengths ) const;
+   //void getCompressedRowLengths( CompressedRowLengthsVector& rowLengths ) const;
 
    virtual void getCompressedRowLengths( CompressedRowLengthsVectorView rowLengths ) const;
 
diff --git a/src/TNL/Matrices/Matrix.hpp b/src/TNL/Matrices/Matrix.hpp
index 4ddbacde5f..0710ca829d 100644
--- a/src/TNL/Matrices/Matrix.hpp
+++ b/src/TNL/Matrices/Matrix.hpp
@@ -56,7 +56,7 @@ void Matrix< Real, Device, Index, RealAllocator >::setDimensions( const IndexTyp
    this->columns = columns;
 }
 
-template< typename Real,
+/*template< typename Real,
           typename Device,
           typename Index,
           typename RealAllocator >
@@ -64,7 +64,7 @@ void Matrix< Real, Device, Index, RealAllocator >::getCompressedRowLengths( Comp
 {
    rowLengths.setSize( this->getRows() );
    getCompressedRowLengths( rowLengths.getView() );
-}
+}*/
 
 template< typename Real,
           typename Device,
@@ -72,9 +72,9 @@ template< typename Real,
           typename RealAllocator >
 void Matrix< Real, Device, Index, RealAllocator >::getCompressedRowLengths( CompressedRowLengthsVectorView rowLengths ) const
 {
-   //TNL_ASSERT_EQ( rowLengths.getSize(), this->getRows(), "invalid size of the rowLengths vector" );
-   //for( IndexType row = 0; row < this->getRows(); row++ )
-   //   rowLengths.setElement( row, this->getRowLength( row ) );
+   TNL_ASSERT_EQ( rowLengths.getSize(), this->getRows(), "invalid size of the rowLengths vector" );
+   for( IndexType row = 0; row < this->getRows(); row++ )
+      rowLengths.setElement( row, this->getRowLength( row ) );
 }
 
 template< typename Real,
-- 
GitLab