Loading src/TNL/Matrices/Sandbox/SparseSandboxMatrix.h +3 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ namespace TNL { namespace Matrices { /** * \brief Namespace for sandbox matrices. */ namespace Sandbox { /** Loading src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ SparseSandboxMatrixRowView( IndexType rowIdx, IndexType size, const ValuesViewType& values, const ColumnsIndexesViewType& columnIndexes ) : rowIdx( rowIdx ), offset( offset ), size( size ), values( values ), columnIndexes( columnIndexes ) : rowIdx( rowIdx ), size( size ), offset( offset ), values( values ), columnIndexes( columnIndexes ) { } Loading src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp +6 −2 Original line number Diff line number Diff line Loading @@ -426,7 +426,11 @@ vectorProduct( const InVector& inVector, const auto end = rowPointers[ rowIdx + 1 ]; RealType sum( 0.0 ); for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) sum += this->values[ globalIdx ] * inVector[ this->columnIndexes[ globalIdx ] ]; { const auto columnIdx = this->columnIndexes[ globalIdx ]; if( columnIdx != paddingIndex ) sum += this->values[ globalIdx ] * inVector[ columnIdx ]; } // SANDBOX_TODO:The following is quite inefficient, its better to specialized the code for cases when // `outVectorMultiplicator` is zero or `matrixMultiplicator` is one - see. the full implementation bellow. outVector[ rowIdx ] = outVector[ rowIdx ] * outVectorMultiplicator + matrixMultiplicator * sum; Loading @@ -440,7 +444,7 @@ vectorProduct( const InVector& inVector, const auto end = rowPointersView[ rowIdx + 1 ]; RealType sum( 0.0 ); for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) sum + valuesView[ globalIdx ] * inVectorView[ columnIndexesView[ globalIdx ] ]; sum += valuesView[ globalIdx ] * inVectorView[ columnIndexesView[ globalIdx ] ]; outVectorView[ rowIdx ] = outVectorView[ rowIdx ] * outVectorMultiplicator + matrixMultiplicator * sum; }; TNL::Algorithms::ParallelFor< DeviceType >::exec( firstRow, lastRow, f ); Loading Loading
src/TNL/Matrices/Sandbox/SparseSandboxMatrix.h +3 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ namespace TNL { namespace Matrices { /** * \brief Namespace for sandbox matrices. */ namespace Sandbox { /** Loading
src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ SparseSandboxMatrixRowView( IndexType rowIdx, IndexType size, const ValuesViewType& values, const ColumnsIndexesViewType& columnIndexes ) : rowIdx( rowIdx ), offset( offset ), size( size ), values( values ), columnIndexes( columnIndexes ) : rowIdx( rowIdx ), size( size ), offset( offset ), values( values ), columnIndexes( columnIndexes ) { } Loading
src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp +6 −2 Original line number Diff line number Diff line Loading @@ -426,7 +426,11 @@ vectorProduct( const InVector& inVector, const auto end = rowPointers[ rowIdx + 1 ]; RealType sum( 0.0 ); for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) sum += this->values[ globalIdx ] * inVector[ this->columnIndexes[ globalIdx ] ]; { const auto columnIdx = this->columnIndexes[ globalIdx ]; if( columnIdx != paddingIndex ) sum += this->values[ globalIdx ] * inVector[ columnIdx ]; } // SANDBOX_TODO:The following is quite inefficient, its better to specialized the code for cases when // `outVectorMultiplicator` is zero or `matrixMultiplicator` is one - see. the full implementation bellow. outVector[ rowIdx ] = outVector[ rowIdx ] * outVectorMultiplicator + matrixMultiplicator * sum; Loading @@ -440,7 +444,7 @@ vectorProduct( const InVector& inVector, const auto end = rowPointersView[ rowIdx + 1 ]; RealType sum( 0.0 ); for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) sum + valuesView[ globalIdx ] * inVectorView[ columnIndexesView[ globalIdx ] ]; sum += valuesView[ globalIdx ] * inVectorView[ columnIndexesView[ globalIdx ] ]; outVectorView[ rowIdx ] = outVectorView[ rowIdx ] * outVectorMultiplicator + matrixMultiplicator * sum; }; TNL::Algorithms::ParallelFor< DeviceType >::exec( firstRow, lastRow, f ); Loading