Ginkgo  Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | List of all members
gko::matrix_assembly_data< ValueType, IndexType > Class Template Reference

This structure is used as an intermediate type to assemble a sparse matrix. More...

#include <ginkgo/core/base/matrix_assembly_data.hpp>

Public Types

using value_type = ValueType
 
using index_type = IndexType
 

Public Member Functions

 matrix_assembly_data (dim< 2 > size)
 
void add_value (index_type row, index_type col, value_type val)
 Sets the matrix value at (row, col). More...
 
void set_value (index_type row, index_type col, value_type val)
 Sets the matrix value at (row, col). More...
 
value_type get_value (index_type row, index_type col)
 Gets the matrix value at (row, col). More...
 
bool contains (index_type row, index_type col)
 Returns true iff the matrix contains an entry at (row, col). More...
 
dim< 2 > get_size () const noexcept
 
size_type get_num_stored_elements () const noexcept
 
matrix_data< ValueType, IndexType > get_ordered_data () const
 

Detailed Description

template<typename ValueType = default_precision, typename IndexType = int32>
class gko::matrix_assembly_data< ValueType, IndexType >

This structure is used as an intermediate type to assemble a sparse matrix.

The matrix is stored as a set of nonzero elements, where each element is a triplet of the form (row_index, column_index, value).

New values can be added by using the matrix_assembly_data::add_value or matrix_assembly_data::set_value

Template Parameters
ValueTypetype of matrix values stored in the structure
IndexTypetype of matrix indexes stored in the structure

Member Function Documentation

◆ add_value()

template<typename ValueType = default_precision, typename IndexType = int32>
void gko::matrix_assembly_data< ValueType, IndexType >::add_value ( index_type  row,
index_type  col,
value_type  val 
)
inline

Sets the matrix value at (row, col).

If there is an existing value, it will be set to the sum of the existing and new value, otherwise the value will be inserted.

Parameters
rowthe row where the value should be added
colthe column where the value should be added
valthe value to be added to (row, col)

◆ contains()

template<typename ValueType = default_precision, typename IndexType = int32>
bool gko::matrix_assembly_data< ValueType, IndexType >::contains ( index_type  row,
index_type  col 
)
inline

Returns true iff the matrix contains an entry at (row, col).

Parameters
rowthe row index
colthe column index
Returns
true if the value at (row, col) exists, false otherwise

◆ get_num_stored_elements()

template<typename ValueType = default_precision, typename IndexType = int32>
size_type gko::matrix_assembly_data< ValueType, IndexType >::get_num_stored_elements ( ) const
inlinenoexcept
Returns
the number of non-zeros in the (partially) assembled matrix

◆ get_ordered_data()

template<typename ValueType = default_precision, typename IndexType = int32>
matrix_data<ValueType, IndexType> gko::matrix_assembly_data< ValueType, IndexType >::get_ordered_data ( ) const
inline
Returns
a matrix_data instance containing the assembled non-zeros in row-major order to be used by all matrix formats.

Referenced by gko::ReadableFromMatrixData< ValueType, int32 >::read().

◆ get_size()

template<typename ValueType = default_precision, typename IndexType = int32>
dim<2> gko::matrix_assembly_data< ValueType, IndexType >::get_size ( ) const
inlinenoexcept
Returns
the dimensions of the matrix being assembled

◆ get_value()

template<typename ValueType = default_precision, typename IndexType = int32>
value_type gko::matrix_assembly_data< ValueType, IndexType >::get_value ( index_type  row,
index_type  col 
)
inline

Gets the matrix value at (row, col).

Parameters
rowthe row index
colthe column index
Returns
the value at (row, col) or 0 if it doesn't exist.

◆ set_value()

template<typename ValueType = default_precision, typename IndexType = int32>
void gko::matrix_assembly_data< ValueType, IndexType >::set_value ( index_type  row,
index_type  col,
value_type  val 
)
inline

Sets the matrix value at (row, col).

If there is an existing value, it will be overwritten by the new value.

Parameters
rowthe row index
colthe column index
valthe value to be written to (row, col)

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