Loading src/TNL/Matrices/SparseMatrix.h +34 −3 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ namespace Matrices { * \tparam RealAllocator is allocator for the matrix elements values. * \tparam IndexAllocator is allocator for the matrix elements column indexes. */ template< typename Real, template< typename Real = double, typename Device = Devices::Host, typename Index = int, typename MatrixType = GeneralMatrix, Loading Loading @@ -202,14 +202,20 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > * \param realAllocator is used for allocation of matrix elements values. * \param indexAllocator is used for allocation of matrix elements column indexes. */ SparseMatrix( const IndexType rows, const IndexType columns, template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > = 0 > SparseMatrix( const Index_t rows, const Index_t columns, const RealAllocatorType& realAllocator = RealAllocatorType(), const IndexAllocatorType& indexAllocator = IndexAllocatorType() ); /** <<<<<<< HEAD * \brief Constructor with matrix rows capacities and number of columns. * ======= * \brief Constructor with matrix rows capacities given as an initializer list and a number of columns. * >>>>>>> Added SparseMatrix constructor with row capacities vector. * The number of matrix rows is given by the size of \e rowCapacities list. * * \tparam ListIndex is the initializer list values type. Loading @@ -230,6 +236,31 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > const RealAllocatorType& realAllocator = RealAllocatorType(), const IndexAllocatorType& indexAllocator = IndexAllocatorType() ); /** * \brief Constructor with matrix rows capacities given as a vector and number of columns. * * The number of matrix rows is given by the size of \e rowCapacities vector. * * \tparam RowCapacitiesVector is the row capacities vector type. Usually it is some of * \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView, \ref TNL::Containers::Vector or * \ref TNL::Containers::VectorView. * \param rowCapacities is a vector telling how many matrix elements must be * allocated in each row. * \param columns is the number of matrix columns. * \param realAllocator is used for allocation of matrix elements values. * \param indexAllocator is used for allocation of matrix elements column indexes. * * \par Example * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_rowCapacities_vector.cpp * \par Output * \include SparseMatrixExample_Constructor_rowCapacities_vector.out */ template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > = 0 > explicit SparseMatrix( const RowCapacitiesVector& rowCapacities, const IndexType columns, const RealAllocatorType& realAllocator = RealAllocatorType(), const IndexAllocatorType& indexAllocator = IndexAllocatorType() ); /** * \brief Constructor with matrix dimensions and data in initializer list. * Loading src/TNL/Matrices/SparseMatrix.hpp +22 −2 Original line number Diff line number Diff line Loading @@ -41,9 +41,10 @@ template< typename Real, typename ComputeReal, typename RealAllocator, typename IndexAllocator > template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > > SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >:: SparseMatrix( const IndexType rows, const IndexType columns, SparseMatrix( const Index_t rows, const Index_t columns, const RealAllocatorType& realAllocator, const IndexAllocatorType& indexAllocator ) : BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ), Loading Loading @@ -71,6 +72,25 @@ SparseMatrix( const std::initializer_list< ListIndex >& rowCapacities, this->setRowCapacities( RowsCapacitiesType( rowCapacities ) ); } template< typename Real, typename Device, typename Index, typename MatrixType, template< typename, typename, typename > class Segments, typename ComputeReal, typename RealAllocator, typename IndexAllocator > template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > > SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >:: SparseMatrix( const RowCapacitiesVector& rowCapacities, const IndexType columns, const RealAllocatorType& realAllocator, const IndexAllocatorType& indexAllocator ) : BaseType( rowCapacities.getSize(), columns, realAllocator ), columnIndexes( indexAllocator ) { this->setRowCapacities( rowCapacities ); } template< typename Real, typename Device, typename Index, Loading Loading
src/TNL/Matrices/SparseMatrix.h +34 −3 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ namespace Matrices { * \tparam RealAllocator is allocator for the matrix elements values. * \tparam IndexAllocator is allocator for the matrix elements column indexes. */ template< typename Real, template< typename Real = double, typename Device = Devices::Host, typename Index = int, typename MatrixType = GeneralMatrix, Loading Loading @@ -202,14 +202,20 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > * \param realAllocator is used for allocation of matrix elements values. * \param indexAllocator is used for allocation of matrix elements column indexes. */ SparseMatrix( const IndexType rows, const IndexType columns, template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > = 0 > SparseMatrix( const Index_t rows, const Index_t columns, const RealAllocatorType& realAllocator = RealAllocatorType(), const IndexAllocatorType& indexAllocator = IndexAllocatorType() ); /** <<<<<<< HEAD * \brief Constructor with matrix rows capacities and number of columns. * ======= * \brief Constructor with matrix rows capacities given as an initializer list and a number of columns. * >>>>>>> Added SparseMatrix constructor with row capacities vector. * The number of matrix rows is given by the size of \e rowCapacities list. * * \tparam ListIndex is the initializer list values type. Loading @@ -230,6 +236,31 @@ class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator > const RealAllocatorType& realAllocator = RealAllocatorType(), const IndexAllocatorType& indexAllocator = IndexAllocatorType() ); /** * \brief Constructor with matrix rows capacities given as a vector and number of columns. * * The number of matrix rows is given by the size of \e rowCapacities vector. * * \tparam RowCapacitiesVector is the row capacities vector type. Usually it is some of * \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView, \ref TNL::Containers::Vector or * \ref TNL::Containers::VectorView. * \param rowCapacities is a vector telling how many matrix elements must be * allocated in each row. * \param columns is the number of matrix columns. * \param realAllocator is used for allocation of matrix elements values. * \param indexAllocator is used for allocation of matrix elements column indexes. * * \par Example * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_rowCapacities_vector.cpp * \par Output * \include SparseMatrixExample_Constructor_rowCapacities_vector.out */ template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > = 0 > explicit SparseMatrix( const RowCapacitiesVector& rowCapacities, const IndexType columns, const RealAllocatorType& realAllocator = RealAllocatorType(), const IndexAllocatorType& indexAllocator = IndexAllocatorType() ); /** * \brief Constructor with matrix dimensions and data in initializer list. * Loading
src/TNL/Matrices/SparseMatrix.hpp +22 −2 Original line number Diff line number Diff line Loading @@ -41,9 +41,10 @@ template< typename Real, typename ComputeReal, typename RealAllocator, typename IndexAllocator > template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > > SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >:: SparseMatrix( const IndexType rows, const IndexType columns, SparseMatrix( const Index_t rows, const Index_t columns, const RealAllocatorType& realAllocator, const IndexAllocatorType& indexAllocator ) : BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ), Loading Loading @@ -71,6 +72,25 @@ SparseMatrix( const std::initializer_list< ListIndex >& rowCapacities, this->setRowCapacities( RowsCapacitiesType( rowCapacities ) ); } template< typename Real, typename Device, typename Index, typename MatrixType, template< typename, typename, typename > class Segments, typename ComputeReal, typename RealAllocator, typename IndexAllocator > template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > > SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >:: SparseMatrix( const RowCapacitiesVector& rowCapacities, const IndexType columns, const RealAllocatorType& realAllocator, const IndexAllocatorType& indexAllocator ) : BaseType( rowCapacities.getSize(), columns, realAllocator ), columnIndexes( indexAllocator ) { this->setRowCapacities( rowCapacities ); } template< typename Real, typename Device, typename Index, Loading