diff --git a/src/TNL/Matrices/SparseMatrixView.h b/src/TNL/Matrices/SparseMatrixView.h index ba73ea651f5fd36fdf72a524139043d9ad3cbef5..29371c802840c2badda8f69ca8f5c6e1c7152aa2 100644 --- a/src/TNL/Matrices/SparseMatrixView.h +++ b/src/TNL/Matrices/SparseMatrixView.h @@ -98,7 +98,7 @@ class SparseMatrixView : public MatrixView< Real, Device, Index > /** * \brief The type of matrix elements. */ - using RealType = Real; + using RealType = std::remove_const_t< Real >; using ComputeRealType = ComputeReal; @@ -942,7 +942,7 @@ class SparseMatrixView : public MatrixView< Real, Device, Index > } }; -} // namespace Conatiners + } // namespace Matrices } // namespace TNL #include <TNL/Matrices/SparseMatrixView.hpp> diff --git a/src/TNL/Matrices/SparseMatrixView.hpp b/src/TNL/Matrices/SparseMatrixView.hpp index 72377f8478ab73443383899d7fc7371965d2b458..63220888affebab801edbce497034b2b8ca6f175 100644 --- a/src/TNL/Matrices/SparseMatrixView.hpp +++ b/src/TNL/Matrices/SparseMatrixView.hpp @@ -80,8 +80,8 @@ getConstView() const -> ConstViewType return ConstViewType( this->getRows(), this->getColumns(), this->getValues().getConstView(), - this->getColumnsIndexes().getConstView(), - this->segments.getConstView() ); + this->getColumnIndexes().getConstView(), + const_cast< SparseMatrixView* >( this )->segments.getView() ); } template< typename Real, @@ -862,14 +862,12 @@ SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >:: operator==( const Matrix& m ) const { const auto& view1 = *this; - // FIXME: getConstView does not work - //const auto view2 = m.getConstView(); - const auto view2 = m.getView(); + const auto view2 = m.getConstView(); auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> bool { return view1.getRow( i ) == view2.getRow( i ); }; - return Algorithms::reduce< DeviceType >( (IndexType) 0, this->getRows(), fetch, std::logical_and<>{}, true ); + return Algorithms::reduce< DeviceType >( ( IndexType ) 0, this->getRows(), fetch, std::logical_and<>{}, true ); } template< typename Real, @@ -896,7 +894,7 @@ void SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >:: save( File& file ) const { - MatrixView< RealType, DeviceType, IndexType >::save( file ); + MatrixView< Real, Device, Index >::save( file ); file << this->columnIndexes; this->segments.save( file ); }