GEOSX
Classes | Public Types | Public Member Functions | List of all members
LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > Class Template Reference

This class implements a compressed row storage sparsity pattern. More...

#include <SparsityPattern.hpp>

Inheritance diagram for LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >:
Inheritance graph
[legend]

Public Types

using ColType = COL_TYPE
 The integer type used to enumerate the columns.
 

Public Member Functions

void setName (std::string const &name)
 Set the name associated with this SparsityPattern which is used in the chai callback. More...
 
Constructors and the destructor.
 SparsityPattern (INDEX_TYPE const nrows=0, INDEX_TYPE const ncols=0, INDEX_TYPE initialRowCapacity=0)
 Constructor. More...
 
 SparsityPattern (SparsityPattern const &src)
 Copy constructor, performs a deep copy. More...
 
 SparsityPattern (SparsityPattern &&)=default
 Default move constructor, performs a shallow copy.
 
 ~SparsityPattern ()
 Destructor, frees the values, sizes and offsets Buffers.
 
Methods to construct the matrix from scratch.
SparsityPatternoperator= (SparsityPattern const &src)
 Copy assignment operator, performs a deep copy. More...
 
SparsityPatternoperator= (SparsityPattern &&src)
 Default move assignment operator, performs a shallow copy. More...
 
template<typename POLICY >
void resizeFromRowCapacities (INDEX_TYPE const nRows, INDEX_TYPE const nCols, INDEX_TYPE const *const rowCapacities)
 Clears the matrix and creates a new matrix with the given number of rows and columns. More...
 
SparsityPatternView creation methods
constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > toView () const &
 
constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > toView () const &&=delete
 Overload for rvalues that is deleted. More...
 
constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > toViewConst () const &
 
constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > toViewConst () const &&=delete
 Overload for rvalues that is deleted. More...
 
Methods to change the capacity
void reserveRows (INDEX_TYPE const rowCapacity)
 Reserve space for the given number of rows. More...
 
void reserveNonZeros (INDEX_TYPE const nnz)
 Reserve space to hold at least the given total number of non zero entries without reallocation. More...
 
void reserveNonZeros (INDEX_TYPE const row, INDEX_TYPE const nnz)
 Reserve space to hold at least the given number of non zero entries in the given row without either reallocation or shifting the row offsets. More...
 
void setRowCapacity (INDEX_TYPE const row, INDEX_TYPE newCapacity)
 Set the non zero capacity of the given row. More...
 
void compress ()
 Compress the SparsityPattern so that the non-zeros of each row are contiguous with no extra capacity in between. More...
 
Methods to resize the matrix.
void resize (INDEX_TYPE const nRows, INDEX_TYPE const nCols, INDEX_TYPE const initialRowCapacity)
 Set the dimensions of the matrix. More...
 
void appendRow (INDEX_TYPE const nzCapacity=0)
 Append a row with the given capacity. More...
 
Methods to modify a row
bool insertNonZero (INDEX_TYPE const row, COL_TYPE const col)
 Insert a non zero entry in the entry (row, col). More...
 
template<typename ITER >
INDEX_TYPE insertNonZeros (INDEX_TYPE const row, ITER const first, ITER const last)
 Inserts multiple non-zero entries into the given row. More...
 
template<typename ITER >
INDEX_TYPE removeNonZeros (INDEX_TYPE const row, ITER const first, ITER const last) const
 Remove multiple non-zero entries from the given row. More...
 
Methods dealing with memory spaces
void move (MemorySpace const space, bool const touch=true) const
 Move this ArrayOfSets to the given memory space. More...
 

Additional Inherited Members

- Protected Types inherited from LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >
using ParentClass = ArrayOfSetsView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >
 An alias for the parent class.
 
using INDEX_TYPE_NC = typename ParentClass::INDEX_TYPE_NC
 Since INDEX_TYPE should always be const we need an alias for the non const version.
 
using SIZE_TYPE = std::conditional_t< CONST_SIZES, INDEX_TYPE const, INDEX_TYPE_NC >
 The type contained by the m_sizes buffer.
 
using ColType = COL_TYPE
 The integer type used to enumerate the columns.
 
using IndexType = INDEX_TYPE
 The integer type used for indexing.
 
- Protected Types inherited from LvArray::ArrayOfSetsView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >
using ParentClass = ArrayOfArraysView< COL_TYPE, INDEX_TYPE, std::is_const< COL_TYPE >::value, BUFFER_TYPE >
 Alias for the parent class.
 
using INDEX_TYPE_NC = typename ParentClass::INDEX_TYPE_NC
 Since INDEX_TYPE should always be const we need an alias for the non const version.
 
using SIZE_TYPE = std::conditional_t< CONST_SIZES, INDEX_TYPE const, INDEX_TYPE_NC >
 The type contained by the m_sizes buffer.
 
using ValueType = COL_TYPE
 An alias for the type contained in the inner arrays.
 
using IndexType = INDEX_TYPE
 The integer type used for indexing.
 
using value_type = COL_TYPE
 An alias for the type contained in the inner arrays, here for stl compatability.
 
using size_type = INDEX_TYPE
 The integer type used for indexing, here for stl compatability.
 
- Protected Types inherited from LvArray::ArrayOfArraysView< COL_TYPE, INDEX_TYPE, std::is_const< COL_TYPE >::value, BUFFER_TYPE >
using INDEX_TYPE_NC = std::remove_const_t< INDEX_TYPE >
 Since INDEX_TYPE should always be const we need an alias for the non const version.
 
using SIZE_TYPE = std::conditional_t< CONST_SIZES, INDEX_TYPE const, INDEX_TYPE_NC >
 The type contained by the m_sizes buffer.
 
using PairOfBuffers = std::pair< BUFFER_TYPE< U > &, BUFFER_TYPE< U > const & >
 Alias for a std::pair of buffers. More...
 
using ValueType = COL_TYPE
 An alias for the type contained in the inner arrays.
 
using IndexType = INDEX_TYPE
 The integer type used for indexing.
 
using value_type = COL_TYPE
 An alias for the type contained in the inner arrays, here for stl compatability.
 
using size_type = INDEX_TYPE
 The integer type used for indexing, here for stl compatability.
 
- Protected Member Functions inherited from LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >
 SparsityPatternView (bool)
 Protected constructor to be used by parent classes. More...
 
void assimilate (SparsityPatternView &&src)
 Steal the resources of src, clearing it in the process. More...
 
template<class ... BUFFERS>
void resize (INDEX_TYPE const nrows, INDEX_TYPE const ncols, INDEX_TYPE_NC initialRowCapacity, BUFFERS &... buffers)
 Resize the SparsityPattern to the given size. More...
 
 SparsityPatternView ()=default
 A constructor to create an uninitialized SparsityPatternView. More...
 
 SparsityPatternView (SparsityPatternView const &)=default
 Default copy constructor. More...
 
 SparsityPatternView (SparsityPatternView &&src)
 Move constructor. More...
 
constexpr SparsityPatternView (INDEX_TYPE const nRows, INDEX_TYPE const nCols, BUFFER_TYPE< INDEX_TYPE > const &offsets, BUFFER_TYPE< SIZE_TYPE > const &nnz, BUFFER_TYPE< COL_TYPE > const &columns)
 Construct a new CRSMatrixView from the given buffers. More...
 
SparsityPatternViewoperator= (SparsityPatternView const &)=default
 Default copy assignment operator, this does a shallow copy. More...
 
SparsityPatternViewoperator= (SparsityPatternView &&src)
 Move assignment operator, this does a shallow copy. More...
 
constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > toView () const
 
constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > toViewConst () const
 
constexpr INDEX_TYPE_NC numRows () const
 
constexpr INDEX_TYPE_NC numColumns () const
 
INDEX_TYPE_NC numNonZeros () const
 
constexpr INDEX_TYPE_NC numNonZeros (INDEX_TYPE const row) const
 
constexpr INDEX_TYPE_NC nonZeroCapacity () const
 
constexpr INDEX_TYPE_NC nonZeroCapacity (INDEX_TYPE const row) const
 
bool empty () const
 
constexpr bool empty (INDEX_TYPE const row) const
 
bool empty (INDEX_TYPE const row, COL_TYPE const col) const
 
constexpr ArraySlice< COL_TYPE const, 1, 0, INDEX_TYPE_NCgetColumns (INDEX_TYPE const row) const
 
constexpr INDEX_TYPE const * getOffsets () const
 
bool insertNonZero (INDEX_TYPE const row, COL_TYPE const col) const
 Insert a non-zero entry at the given position. More...
 
template<typename ITER >
INDEX_TYPE_NC insertNonZeros (INDEX_TYPE const row, ITER const first, ITER const last) const
 Inserts multiple non-zero entries into the given row. More...
 
bool removeNonZero (INDEX_TYPE const row, COL_TYPE const col) const
 Remove a non-zero entry at the given position. More...
 
template<typename ITER >
INDEX_TYPE_NC removeNonZeros (INDEX_TYPE const row, ITER const first, ITER const last) const
 Remove multiple non-zero entries from the given row. More...
 
void move (MemorySpace const space, bool const touch=true) const
 Move this ArrayOfSets to the given memory space. More...
 
- Protected Member Functions inherited from LvArray::ArrayOfSetsView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >
 ArrayOfSetsView (bool)
 Protected constructor to be used by parent classes. More...
 
constexpr ArraySlice< COL_TYPE, 1, 0, INDEX_TYPE_NCgetSetValues (INDEX_TYPE const i) const
 
bool insertIntoSetImpl (INDEX_TYPE const i, COL_TYPE const &value, CALLBACKS &&cbacks) const
 Helper function to insert a value into the given set. More...
 
INDEX_TYPE_NC insertIntoSetImpl (INDEX_TYPE const i, ITER const first, ITER const last, CALLBACKS &&cbacks) const
 Inserts multiple values into the given set. More...
 
bool removeFromSetImpl (INDEX_TYPE const i, COL_TYPE const &value, CALLBACKS &&cbacks) const
 Helper function to remove a value from the given set. More...
 
INDEX_TYPE_NC removeFromSetImpl (INDEX_TYPE const i, ITER const first, ITER const last, CALLBACKS &&cbacks) const
 Removes multiple values from the given set. More...
 
 ArrayOfSetsView ()=default
 A constructor to create an uninitialized ArrayOfSetsView. More...
 
 ArrayOfSetsView (ArrayOfSetsView const &)=default
 Default copy constructor. Performs a shallow copy and calls the chai::ManagedArray copy constructor.
 
 ArrayOfSetsView (ArrayOfSetsView &&)=default
 Default move constructor.
 
constexpr ArrayOfSetsView (INDEX_TYPE const numArrays, BUFFER_TYPE< INDEX_TYPE > const &offsets, BUFFER_TYPE< SIZE_TYPE > const &sizes, BUFFER_TYPE< COL_TYPE > const &values)
 Construct a new ArrayOfArraysView from the given buffers. More...
 
ArrayOfSetsViewoperator= (ArrayOfSetsView const &)=default
 Default copy assignment operator, this does a shallow copy. More...
 
ArrayOfSetsViewoperator= (ArrayOfSetsView &&)=default
 Default move assignment operator, this does a shallow copy. More...
 
constexpr ArrayOfSetsView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > toView () const
 
constexpr ArrayOfSetsView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > toViewConst () const
 
constexpr ArrayOfArraysView< COL_TYPE const, INDEX_TYPE const, true, BUFFER_TYPE > toArrayOfArraysView () const
 
constexpr INDEX_TYPE_NC sizeOfSet (INDEX_TYPE const i) const
 
constexpr INDEX_TYPE_NC capacityOfSet (INDEX_TYPE const i) const
 
bool contains (INDEX_TYPE const i, COL_TYPE const &value) const
 
void consistencyCheck () const
 Verify that the capacity of each set is greater than or equal to the size and that each set is sorted unique. More...
 
constexpr ArraySlice< COL_TYPE const, 1, 0, INDEX_TYPE_NCoperator[] (INDEX_TYPE const i) const
 
constexpr COL_TYPE const & operator() (INDEX_TYPE const i, INDEX_TYPE const j) const
 
bool insertIntoSet (INDEX_TYPE const i, COL_TYPE const &value) const
 Insert a value into the given set. More...
 
INDEX_TYPE_NC insertIntoSet (INDEX_TYPE const i, ITER const first, ITER const last) const
 Inserts multiple values into the given set. More...
 
bool removeFromSet (INDEX_TYPE const i, COL_TYPE const &value) const
 Remove a value from the given set. More...
 
INDEX_TYPE_NC removeFromSet (INDEX_TYPE const i, ITER const first, ITER const last) const
 Removes multiple values from the given set. More...
 
void move (MemorySpace const space, bool const touch=true) const
 Move this ArrayOfSets to the given memory space. More...
 
- Protected Member Functions inherited from LvArray::ArrayOfArraysView< COL_TYPE, INDEX_TYPE, std::is_const< COL_TYPE >::value, BUFFER_TYPE >
 ArrayOfArraysView (bool)
 Protected constructor to be used by parent classes. More...
 
void resize (INDEX_TYPE const newSize, INDEX_TYPE const defaultArrayCapacity=0)
 Set the number of arrays. More...
 
void reserve (INDEX_TYPE const newCapacity)
 Reserve space for the given number of arrays. More...
 
void reserveValues (INDEX_TYPE const newValueCapacity, BUFFERS &... buffers)
 Reserve space for the given number of values. More...
 
void compress (BUFFERS &... buffers)
 Compress the arrays so that the values of each array are contiguous with no extra capacity in between. More...
 
void resizeFromCapacities (INDEX_TYPE const numSubArrays, INDEX_TYPE const *const capacities, BUFFERS &... buffers)
 Clears the array and creates a new array with the given number of sub-arrays. More...
 
void assimilate (ArrayOfArraysView< COL_TYPE, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > &&src)
 Steal the resources of src, clearing it in the process. More...
 
void resizeImpl (INDEX_TYPE const newSize, INDEX_TYPE const defaultArrayCapacity, BUFFERS &... buffers)
 Set the number of arrays. More...
 
void free (BUFFERS &... buffers)
 Destroy all the objects held by this array and free all associated memory. More...
 
void setEqualTo (INDEX_TYPE const srcNumArrays, INDEX_TYPE const srcMaxOffset, BUFFER_TYPE< INDEX_TYPE > const &srcOffsets, BUFFER_TYPE< INDEX_TYPE > const &srcSizes, BUFFER_TYPE< COL_TYPE > const &srcValues, PAIRS_OF_BUFFERS &&... pairs)
 Set this ArrayOfArraysView equal to the provided arrays. More...
 
void setCapacityOfArray (INDEX_TYPE const i, INDEX_TYPE const newCapacity, BUFFERS &... buffers)
 Set the capacity of the given array. More...
 
void setName (std::string const &name)
 Set the name to be displayed whenever the underlying Buffer's user call back is called. More...
 
 ArrayOfArraysView ()=default
 A constructor to create an uninitialized ArrayOfArraysView. More...
 
 ArrayOfArraysView (ArrayOfArraysView const &)=default
 Default copy constructor. More...
 
constexpr ArrayOfArraysView (ArrayOfArraysView &&src)
 Default move constructor. More...
 
constexpr ArrayOfArraysView (INDEX_TYPE const numArrays, BUFFER_TYPE< INDEX_TYPE > const &offsets, BUFFER_TYPE< SIZE_TYPE > const &sizes, BUFFER_TYPE< COL_TYPE > const &values)
 Construct a new ArrayOfArraysView from the given buffers. More...
 
ArrayOfArraysViewoperator= (ArrayOfArraysView const &)=default
 Default copy assignment operator. More...
 
ArrayOfArraysViewoperator= (ArrayOfArraysView &&src)
 Move assignment operator.. More...
 
constexpr ArrayOfArraysView< COL_TYPE, INDEX_TYPE const, CONST_SIZES, BUFFER_TYPE > toView () const
 
constexpr ArrayOfArraysView< COL_TYPE, INDEX_TYPE const, true, BUFFER_TYPE > toViewConstSizes () const
 
constexpr ArrayOfArraysView< COL_TYPE const, INDEX_TYPE const, true, BUFFER_TYPE > toViewConst () const
 
constexpr INDEX_TYPE_NC size () const
 
constexpr INDEX_TYPE_NC sizeOfArray (INDEX_TYPE const i) const
 
CONSTEXPR_WITH_NDEBUG INDEX_TYPE_NC capacity () const
 
constexpr INDEX_TYPE_NC capacityOfArray (INDEX_TYPE const i) const
 
constexpr INDEX_TYPE_NC valueCapacity () const
 
constexpr ArraySlice< COL_TYPE, 1, 0, INDEX_TYPE_NCoperator[] (INDEX_TYPE const i) const
 
constexpr COL_TYPE & operator() (INDEX_TYPE const i, INDEX_TYPE const j) const
 
void emplaceBack (INDEX_TYPE const i, ARGS &&... args) const
 Append a value to an array. More...
 
void emplaceBackAtomic (INDEX_TYPE const i, ARGS &&... args) const
 Append a value to an array in a thread safe manner. More...
 
void appendToArray (INDEX_TYPE const i, ITER const first, ITER const last) const
 Append values to an array. More...
 
void emplace (INDEX_TYPE const i, INDEX_TYPE const j, ARGS &&... args) const
 Insert a value into an array. More...
 
void insertIntoArray (INDEX_TYPE const i, INDEX_TYPE const j, ITER const first, ITER const last) const
 Insert values into an array. More...
 
void eraseFromArray (INDEX_TYPE const i, INDEX_TYPE const j, INDEX_TYPE const n=1) const
 Erase values from an array. More...
 
void registerTouch (MemorySpace const space) const
 Touch the memory in space. More...
 
void move (MemorySpace const space, bool touch=true) const
 Move this ArrayOfArrays to the given memory space. More...
 
- Protected Attributes inherited from LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >
INDEX_TYPE_NC m_numCols
 The number of columns in the matrix.
 
- Protected Attributes inherited from LvArray::ArrayOfArraysView< COL_TYPE, INDEX_TYPE, std::is_const< COL_TYPE >::value, BUFFER_TYPE >
INDEX_TYPE_NC m_numArrays
 The number of arrays contained.
 
BUFFER_TYPE< INDEX_TYPE > m_offsets
 
BUFFER_TYPE< SIZE_TYPEm_sizes
 Holds the size of each array.
 
BUFFER_TYPE< COL_TYPE > m_values
 

Detailed Description

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
class LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >

This class implements a compressed row storage sparsity pattern.

Template Parameters
COL_TYPEthe integer used to enumerate the columns.
INDEX_TYPEthe integer to use for indexing.

Definition at line 22 of file CRSMatrix.hpp.

Constructor & Destructor Documentation

◆ SparsityPattern() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::SparsityPattern ( INDEX_TYPE const  nrows = 0,
INDEX_TYPE const  ncols = 0,
INDEX_TYPE  initialRowCapacity = 0 
)
inline

Constructor.

Parameters
nrowsthe number of rows in the matrix.
ncolsthe number of columns in the matrix.
initialRowCapacitythe initial non zero capacity of each row.

Definition at line 52 of file SparsityPattern.hpp.

◆ SparsityPattern() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::SparsityPattern ( SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > const &  src)
inline

Copy constructor, performs a deep copy.

Parameters
srcthe SparsityPattern to copy.

Definition at line 66 of file SparsityPattern.hpp.

Member Function Documentation

◆ appendRow()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::appendRow ( INDEX_TYPE const  nzCapacity = 0)
inline

Append a row with the given capacity.

Parameters
nzCapacityThe non zero capacity of the row.

Definition at line 302 of file SparsityPattern.hpp.

◆ compress()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::compress ( )
inline

Compress the SparsityPattern so that the non-zeros of each row are contiguous with no extra capacity in between.

Note
This method doesn't free any memory.

Definition at line 273 of file SparsityPattern.hpp.

◆ insertNonZero()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
bool LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::insertNonZero ( INDEX_TYPE const  row,
COL_TYPE const  col 
)
inline

Insert a non zero entry in the entry (row, col).

Parameters
rowthe row of the entry to insert.
colthe column of the entry to insert.
Returns
True iff the entry was previously empty.

Definition at line 326 of file SparsityPattern.hpp.

◆ insertNonZeros()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ITER >
INDEX_TYPE LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::insertNonZeros ( INDEX_TYPE const  row,
ITER const  first,
ITER const  last 
)
inline

Inserts multiple non-zero entries into the given row.

Template Parameters
ITERAn iterator type.
Parameters
rowThe row to insert into.
firstAn iterator to the first column to insert.
lastAn iterator to the end of the columns to insert.
Returns
The number of columns inserted.
Note
The columns to insert [ first, last ) must be sorted and contain no duplicates.

Definition at line 340 of file SparsityPattern.hpp.

◆ move()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::move ( MemorySpace const  space,
bool const  touch = true 
) const
inline

Move this ArrayOfSets to the given memory space.

Parameters
spaceThe memory space to move to.
touchIf true touch the values, sizes and offsets in the new space.
Note
When moving to the GPU since the offsets can't be modified on device they are not touched.
This is just a wrapper around the ArrayOfArraysView method. The reason it isn't pulled in with a using statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC.
This is just a wrapper around the ArrayOfSetsView method. The reason it isn't pulled in with a using statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC.
This is just a wrapper around the ArrayOfSetsView method. The reason it isn't pulled in with a using statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC.
This is just a wrapper around the SparsityPatternView method. The reason it isn't pulled in with a using statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC.

Definition at line 367 of file SparsityPattern.hpp.

◆ operator=() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
SparsityPattern& LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::operator= ( SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > const &  src)
inline

Copy assignment operator, performs a deep copy.

Parameters
srcthe SparsityPattern to copy.
Returns
*this.

Definition at line 96 of file SparsityPattern.hpp.

◆ operator=() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
SparsityPattern& LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::operator= ( SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > &&  src)
inline

Default move assignment operator, performs a shallow copy.

Parameters
srcThe SparsityPattern to be moved from.
Returns
*this.

Definition at line 113 of file SparsityPattern.hpp.

◆ removeNonZeros()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ITER >
INDEX_TYPE LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::removeNonZeros ( INDEX_TYPE const  row,
ITER const  first,
ITER const  last 
) const
inline

Remove multiple non-zero entries from the given row.

Template Parameters
ITERAn iterator type.
Parameters
rowThe row to remove from.
firstAn iterator to the first column to remove.
lastAn iterator to the end of the columns to remove.
Returns
The number of columns removed.
Precondition
The columns to remove [ first, last ) must be sorted and contain no duplicates.
Note
This is not brought in with a using statement because it breaks doxygen.

Definition at line 351 of file SparsityPattern.hpp.

◆ reserveNonZeros() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::reserveNonZeros ( INDEX_TYPE const  nnz)
inline

Reserve space to hold at least the given total number of non zero entries without reallocation.

Parameters
nnzthe number of no zero entries to reserve space for.

Definition at line 234 of file SparsityPattern.hpp.

◆ reserveNonZeros() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::reserveNonZeros ( INDEX_TYPE const  row,
INDEX_TYPE const  nnz 
)
inline

Reserve space to hold at least the given number of non zero entries in the given row without either reallocation or shifting the row offsets.

Parameters
rowthe row to reserve space in.
nnzthe number of no zero entries to reserve space for.

Definition at line 244 of file SparsityPattern.hpp.

◆ reserveRows()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::reserveRows ( INDEX_TYPE const  rowCapacity)
inline

Reserve space for the given number of rows.

Parameters
rowCapacityThe new minimum capacity for the number of rows.

Definition at line 226 of file SparsityPattern.hpp.

◆ resize()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::resize ( INDEX_TYPE const  nRows,
INDEX_TYPE const  nCols,
INDEX_TYPE const  initialRowCapacity 
)
inline

Set the dimensions of the matrix.

Parameters
nRowsthe new number of rows.
nColsthe new number of columns.
initialRowCapacitythe default capacity for each new array.
Note
When shrinking the number of columns this method doesn't get rid of any existing entries. This can leave the matrix in an invalid state where a row has more columns than the matrix or where a specific column is greater than the number of columns in the matrix. If you will be constructing the matrix from scratch it is reccomended to clear it first.

Definition at line 293 of file SparsityPattern.hpp.

◆ resizeFromRowCapacities()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename POLICY >
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::resizeFromRowCapacities ( INDEX_TYPE const  nRows,
INDEX_TYPE const  nCols,
INDEX_TYPE const *const  rowCapacities 
)
inline

Clears the matrix and creates a new matrix with the given number of rows and columns.

Template Parameters
POLICYThe RAJA policy used to convert rowCapacities into the offsets array. Should NOT be a device policy.
Parameters
nRowsThe new number of rows.
nColsThe new number of columns.
rowCapacitiesA pointer to an array of length nRows containing the capacity of each new row.

Definition at line 130 of file SparsityPattern.hpp.

◆ setName()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::setName ( std::string const &  name)
inline

Set the name associated with this SparsityPattern which is used in the chai callback.

Parameters
namethe of the SparsityPattern.

Definition at line 376 of file SparsityPattern.hpp.

◆ setRowCapacity()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::setRowCapacity ( INDEX_TYPE const  row,
INDEX_TYPE  newCapacity 
)
inline

Set the non zero capacity of the given row.

Parameters
rowthe row to modify.
newCapacitythe new capacity of the row.
Note
If the given capacity is less than the current number of non zero entries the entries are truncated.
Since a row can hold at most numColumns() entries the resulting capacity is min(newCapacity, numColumns()).

Definition at line 261 of file SparsityPattern.hpp.

◆ toView() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::toView ( ) const &
inline

Returns
A new SparsityPatternView< COL_TYPE, INDEX_TYPE const >.
Note
This is just a wrapper around the SparsityPatternView method. The reason it isn't pulled in with a using statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC.

Definition at line 155 of file SparsityPattern.hpp.

◆ toView() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::toView ( ) const &&
inlinedelete

Overload for rvalues that is deleted.

Returns
A null SparsityPatternView.
Note
This cannot be called on a rvalue since the SparsityPatternView would contain the buffers of the current SparsityPattern that is about to be destroyed. This overload prevents that from happening.

◆ toViewConst() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::toViewConst ( ) const &
inline

Returns
A new SparsityPatternView< COL_TYPE const, INDEX_TYPE const >.
Note
This is just a wrapper around the SparsityPatternView method. The reason it isn't pulled in with a using statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC.

Definition at line 177 of file SparsityPattern.hpp.

◆ toViewConst() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > LvArray::SparsityPattern< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::toViewConst ( ) const &&
inlinedelete

Overload for rvalues that is deleted.

Returns
A null SparsityPatternView.
Note
This cannot be called on a rvalue since the SparsityPatternView would contain the buffers of the current SparsityPattern that is about to be destroyed. This overload prevents that from happening.

The documentation for this class was generated from the following files: