LvArray
Public Types | Protected Types | Protected Member Functions | Protected Attributes | List of all members
LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > Class Template Reference

This class provides a view into a compressed row storage sparsity pattern. More...

#include <SparsityPatternView.hpp>

Inheritance diagram for LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >:
Inheritance graph

Public Types

using ColType = COL_TYPE
 The integer type used to enumerate the columns.
 
using ColTypeNC = COL_TYPE_NC
 
using IndexType = INDEX_TYPE
 The integer type used for indexing.
 

Public Member Functions

Constructors, destructor and assignment operators
 SparsityPatternView ()=default
 A constructor to create an uninitialized SparsityPatternView. More...
 
 SparsityPatternView (SparsityPatternView const &)=default
 Default copy constructor. More...
 
 SparsityPatternView (SparsityPatternView &&src)
 Move constructor. More...
 
LVARRAY_HOST_DEVICE constexpr SparsityPatternView (INDEX_TYPE const nRows, COL_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...
 
SparsityPatternView creation methods
LVARRAY_HOST_DEVICE constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > toView () const
 
LVARRAY_HOST_DEVICE constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > toViewConst () const
 
Attribute querying methods
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const numRows () const
 
LVARRAY_HOST_DEVICE constexpr COL_TYPE const numColumns () const
 
LVARRAY_HOST_DEVICE INDEX_TYPE_NC numNonZeros () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const numNonZeros (INDEX_TYPE const row) const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const nonZeroCapacity () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const nonZeroCapacity (INDEX_TYPE const row) const
 
LVARRAY_HOST_DEVICE bool empty () const
 
LVARRAY_HOST_DEVICE constexpr bool empty (INDEX_TYPE const row) const
 
LVARRAY_HOST_DEVICE bool empty (INDEX_TYPE const row, COL_TYPE const col) const
 
Methods that provide access to the data
LVARRAY_HOST_DEVICE constexpr ArraySlice< COL_TYPE const, 1, 0, INDEX_TYPE_NCgetColumns (INDEX_TYPE const row) const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const * getOffsets () const
 
LVARRAY_HOST_DEVICE constexpr COL_TYPE const * getColumns () const
 
Methods that insert or remove entries from a row.
LVARRAY_HOST_DEVICE bool insertNonZero (INDEX_TYPE const row, COL_TYPE const col) const
 Insert a non-zero entry at the given position. More...
 
template<typename ITER >
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE bool removeNonZero (INDEX_TYPE const row, COL_TYPE const col) const
 Remove a non-zero entry at the given position. More...
 
template<typename ITER >
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE 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...
 
Methods dealing with memory spaces
void move (MemorySpace const space, bool const touch=true) const
 Move this ArrayOfSets to the given memory space. More...
 

Protected Types

using COL_TYPE_NC = std::remove_const_t< COL_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.
 
- 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

 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, COL_TYPE const ncols, INDEX_TYPE_NC initialRowCapacity, BUFFERS &... buffers)
 Resize the SparsityPattern to the given size. 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...
 
LVARRAY_HOST_DEVICE constexpr ArraySlice< COL_TYPE, 1, 0, INDEX_TYPE_NCgetSetValues (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE bool insertIntoSetImpl (INDEX_TYPE const i, COL_TYPE const &value, CALLBACKS &&cbacks) const
 Helper function to insert a value into the given set. More...
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE bool removeFromSetImpl (INDEX_TYPE const i, COL_TYPE const &value, CALLBACKS &&cbacks) const
 Helper function to remove a value from the given set. More...
 
LVARRAY_HOST_DEVICE 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.
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE constexpr ArrayOfSetsView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > toView () const
 
LVARRAY_HOST_DEVICE constexpr ArrayOfSetsView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > toViewConst () const
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< COL_TYPE const, INDEX_TYPE const, true, BUFFER_TYPE > toArrayOfArraysView () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC sizeOfSet (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC capacityOfSet (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE constexpr ArraySlice< COL_TYPE const, 1, 0, INDEX_TYPE_NCoperator[] (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE constexpr COL_TYPE const & operator() (INDEX_TYPE const i, INDEX_TYPE const j) const
 
LVARRAY_HOST_DEVICE bool insertIntoSet (INDEX_TYPE const i, COL_TYPE const &value) const
 Insert a value into the given set. More...
 
LVARRAY_HOST_DEVICE INDEX_TYPE_NC insertIntoSet (INDEX_TYPE const i, ITER const first, ITER const last) const
 Inserts multiple values into the given set. More...
 
LVARRAY_HOST_DEVICE bool removeFromSet (INDEX_TYPE const i, COL_TYPE const &value) const
 Remove a value from the given set. More...
 
LVARRAY_HOST_DEVICE 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 resizeFromOffsets (INDEX_TYPE const numSubArrays, INDEX_TYPE const *const offsets, BUFFERS &... buffers)
 Clears the array and creates a new array with the given number of sub-arrays. 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...
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView (ArrayOfArraysView &&src)
 Default move constructor. More...
 
LVARRAY_HOST_DEVICE 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...
 
LVARRAY_HOST_DEVICE ArrayOfArraysViewoperator= (ArrayOfArraysView &&src)
 Move assignment operator.. More...
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< COL_TYPE, INDEX_TYPE const, CONST_SIZES, BUFFER_TYPE > toView () const
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< COL_TYPE, INDEX_TYPE const, true, BUFFER_TYPE > toViewConstSizes () const
 
LVARRAY_HOST_DEVICE constexpr ArrayOfArraysView< COL_TYPE const, INDEX_TYPE const, true, BUFFER_TYPE > toViewConst () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC size () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE_NC sizeOfArray (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE constexpr SIZE_TYPE const * getSizes () const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const * getOffsets () const
 
LVARRAY_HOST_DEVICE constexpr COL_TYPE const * getValues () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITH_NDEBUG INDEX_TYPE_NC capacity () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK INDEX_TYPE_NC capacityOfArray (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC valueCapacity () const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK ArraySlice< COL_TYPE, 1, 0, INDEX_TYPE_NCoperator[] (INDEX_TYPE const i) const
 
LVARRAY_HOST_DEVICE CONSTEXPR_WITHOUT_BOUNDS_CHECK COL_TYPE & operator() (INDEX_TYPE const i, INDEX_TYPE const j) const
 
LVARRAY_HOST_DEVICE void emplaceBack (INDEX_TYPE const i, ARGS &&... args) const
 Append a value to an array. More...
 
LVARRAY_HOST_DEVICE void emplaceBackAtomic (INDEX_TYPE const i, ARGS &&... args) const
 Append a value to an array in a thread safe manner. More...
 
LVARRAY_HOST_DEVICE void appendToArray (INDEX_TYPE const i, ITER const first, ITER const last) const
 Append values to an array. More...
 
LVARRAY_HOST_DEVICE void emplace (INDEX_TYPE const i, INDEX_TYPE const j, ARGS &&... args) const
 Insert a value into an array. More...
 
LVARRAY_HOST_DEVICE void insertIntoArray (INDEX_TYPE const i, INDEX_TYPE const j, ITER const first, ITER const last) const
 Insert values into an array. More...
 
LVARRAY_HOST_DEVICE 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

COL_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::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >

This class provides a view into a compressed row storage sparsity pattern.

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

When INDEX_TYPE is const m_offsets is not copied between memory spaces. INDEX_TYPE should always be const since SparsityPatternView is not allowed to modify the offsets.

When COL_TYPE is const and INDEX_TYPE is const you cannot insert or remove from the View and neither the offsets, sizes, or columns are copied between memory spaces.

Constructor & Destructor Documentation

◆ SparsityPatternView() [1/5]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::SparsityPatternView ( )
default

A constructor to create an uninitialized SparsityPatternView.

Note
An uninitialized SparsityPatternView should not be used until it is assigned to.

◆ SparsityPatternView() [2/5]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::SparsityPatternView ( SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > const &  )
inlinedefault

Default copy constructor.

Note
The copy constructor will trigger the copy constructor for
Template Parameters
BUFFER_TYPE

◆ SparsityPatternView() [3/5]

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

Move constructor.

Parameters
srcThe SparsityPatternView to move from.

◆ SparsityPatternView() [4/5]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::SparsityPatternView ( INDEX_TYPE const  nRows,
COL_TYPE const  nCols,
BUFFER_TYPE< INDEX_TYPE > const &  offsets,
BUFFER_TYPE< SIZE_TYPE > const &  nnz,
BUFFER_TYPE< COL_TYPE > const &  columns 
)
inline

Construct a new CRSMatrixView from the given buffers.

Parameters
nRowsThe number of rows.
nColsThe number of columns
offsetsThe offsets buffer, of size nRows + 1.
nnzThe buffer containing the number of non zeros in each row, of size nRows.
columnsThe columns buffer, of size offsets[ nRows ].

◆ SparsityPatternView() [5/5]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::SparsityPatternView ( bool  )
inlineprotected

Protected constructor to be used by parent classes.

Note
The unused boolean parameter is to distinguish this from the default constructor.

Member Function Documentation

◆ assimilate()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::assimilate ( SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > &&  src)
inlineprotected

Steal the resources of src, clearing it in the process.

Parameters
srcThe SparsityPatternView to steal from.

◆ empty() [1/3]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE bool LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::empty ( ) const
inline
Returns
Return true iff the matrix is all zeros.

◆ empty() [2/3]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr bool LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::empty ( INDEX_TYPE const  row) const
inline
Returns
Return true iff the given row is all zeros.
Parameters
rowthe row to query.

◆ empty() [3/3]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE bool LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::empty ( INDEX_TYPE const  row,
COL_TYPE const  col 
) const
inline
Returns
Return true iff the given entry is in the matrix.
Parameters
rowthe row to query.
colthe col to query.

◆ getColumns() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr ArraySlice< COL_TYPE const, 1, 0, INDEX_TYPE_NC > LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::getColumns ( INDEX_TYPE const  row) const
inline
Returns
Return an ArraySlice1d to the columns of the given row.
Parameters
rowthe row to access.

◆ getColumns() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr COL_TYPE const* LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::getColumns ( ) const
inline
Returns
Return a pointer to the array of values, this array has length numRows().

◆ getOffsets()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE const* LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::getOffsets ( ) const
inline
Returns
Return a pointer to the array of offsets, this array has length numRows() + 1.

◆ insertNonZero()

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

Insert a non-zero entry at the given position.

Parameters
rowthe row to insert in.
colthe column to insert.
Returns
True iff the column was inserted (the entry was zero before).
Precondition
Since the SparsityPatternView can't do reallocation or shift the offsets it is up to the user to ensure that the given row has enough space for the new entries.

◆ insertNonZeros()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ITER >
LVARRAY_HOST_DEVICE INDEX_TYPE_NC LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::insertNonZeros ( INDEX_TYPE const  row,
ITER const  first,
ITER const  last 
) const
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.
Precondition
The columns to insert [ first, last ) must be sorted and contain no duplicates.
Since the SparsityPatternview can't do reallocation or shift the offsets it is up to the user to ensure that the given row has enough space for the new entries.

◆ move()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
void LvArray::SparsityPatternView< 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.

◆ nonZeroCapacity() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::nonZeroCapacity ( ) const
inline
Returns
Return the total number of non zero entries able to be stored without a reallocation.

◆ nonZeroCapacity() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::nonZeroCapacity ( INDEX_TYPE const  row) const
inline
Returns
Return the total number of non zero entries able to be stored in a given row without increasing its capacity.
Parameters
rowthe row to query.

◆ numColumns()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr COL_TYPE const LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::numColumns ( ) const
inline
Returns
Return the number of columns in the matrix.

◆ numNonZeros() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE INDEX_TYPE_NC LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::numNonZeros ( ) const
inline
Returns
Return the total number of non zero entries in the matrix.

◆ numNonZeros() [2/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::numNonZeros ( INDEX_TYPE const  row) const
inline
Returns
Return the total number of non zero entries in the given row.
Parameters
rowthe row to query.

◆ numRows()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr INDEX_TYPE_NC const LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::numRows ( ) const
inline
Returns
Return the number of rows in the matrix.

◆ operator=() [1/2]

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
SparsityPatternView& LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::operator= ( SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE > const &  )
inlinedefault

Default copy assignment operator, this does a shallow copy.

Returns
*this.

◆ operator=() [2/2]

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

Move assignment operator, this does a shallow copy.

Parameters
srcThe SparsityPatternView to move from.
Returns
*this.

◆ removeNonZero()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE bool LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::removeNonZero ( INDEX_TYPE const  row,
COL_TYPE const  col 
) const
inline

Remove a non-zero entry at the given position.

Parameters
rowthe row to remove from.
colthe column to remove.
Returns
True iff the column was removed (the entry was non zero before).

◆ removeNonZeros()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<typename ITER >
DISABLE_HD_WARNING LVARRAY_HOST_DEVICE INDEX_TYPE_NC LvArray::SparsityPatternView< 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.

◆ resize()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
template<class ... BUFFERS>
void LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::resize ( INDEX_TYPE const  nrows,
COL_TYPE const  ncols,
INDEX_TYPE_NC  initialRowCapacity,
BUFFERS &...  buffers 
)
inlineprotected

Resize the SparsityPattern to the given size.

Template Parameters
BUFFERSA variadic pack of buffer types.
Parameters
nrowsThe number of rows in the matrix.
ncolsThe number of columns in the matrix.
initialRowCapacityThe initial capacity of any newly created rows.
buffersA variadic pack of buffers to resize along with the columns.

◆ toView()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr SparsityPatternView< COL_TYPE, INDEX_TYPE const, BUFFER_TYPE > LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::toView ( ) const
inline
Returns
A new SparsityPatternView< COL_TYPE, INDEX_TYPE const >.

◆ toViewConst()

template<typename COL_TYPE, typename INDEX_TYPE, template< typename > class BUFFER_TYPE>
LVARRAY_HOST_DEVICE constexpr SparsityPatternView< COL_TYPE const, INDEX_TYPE const, BUFFER_TYPE > LvArray::SparsityPatternView< COL_TYPE, INDEX_TYPE, BUFFER_TYPE >::toViewConst ( ) const
inline
Returns
A new SparsityPatternView< COL_TYPE const, INDEX_TYPE const >.

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