gko::matrix::Sellp#
Sliced ELL with permutation. Partitions rows into fixed-size slices, pads each slice independently to its own longest row, and optionally permutes rows within a slice to balance work. A middle ground between ELL’s regular layout and CSR’s storage efficiency.
-
template<typename ValueType = default_precision, typename IndexType = int32>
class Sellp # Inherits from
public gko::EnableLinOp<Sellp<default_precision, int32>>
public ConvertibleTo<Sellp<next_precision<default_precision>, int32>>
public ConvertibleTo<Sellp<next_precision<default_precision, 2>, int32>>
public ConvertibleTo<Sellp<next_precision<default_precision, 3>, int32>>
public ConvertibleTo<Dense<default_precision>>
public ConvertibleTo<Csr<default_precision, int32>>
public gko::DiagonalExtractable<default_precision>
public gko::ReadableFromMatrixData<default_precision, int32>
public gko::WritableToMatrixData<default_precision, int32>
public gko::EnableAbsoluteComputation<remove_complex<Sellp<default_precision, int32>>>
SELL-P is a matrix format similar to ELL format. The difference is that SELL-P format divides rows into smaller slices and store each slice with ELL format.
This implementation uses the column index value invalid_index<IndexType>() to mark padding entries that are not part of the sparsity pattern.
- Template Parameters:
ValueType – precision of matrix elements
IndexType – precision of matrix indexes
Public Functions
- virtual std::unique_ptr<Diagonal<ValueType>> extract_diagonal(
Extracts the diagonal entries of the matrix into a vector.
- Parameters:
diag – the vector into which the diagonal will be written
- virtual std::unique_ptr<absolute_type> compute_absolute(
Gets the AbsoluteLinOp
- Returns:
a pointer to the new absolute object
-
virtual void compute_absolute_inplace() override#
Compute absolute inplace on each element.
-
inline value_type *get_values() noexcept#
Returns the values of the matrix.
- Returns:
the values of the matrix.
-
inline const value_type *get_const_values() const noexcept#
Returns the values of the matrix.
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.
- Returns:
the values of the matrix.
-
inline index_type *get_col_idxs() noexcept#
Returns the column indexes of the matrix.
- Returns:
the column indexes of the matrix.
-
inline const index_type *get_const_col_idxs() const noexcept#
Returns the column indexes of the matrix.
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.
- Returns:
the column indexes of the matrix.
-
inline size_type *get_slice_lengths() noexcept#
Returns the lengths(columns) of slices.
- Returns:
the lengths(columns) of slices.
-
inline const size_type *get_const_slice_lengths() const noexcept#
Returns the lengths(columns) of slices.
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.
- Returns:
the lengths(columns) of slices.
-
inline size_type *get_slice_sets() noexcept#
Returns the offsets of slices.
- Returns:
the offsets of slices.
-
inline const size_type *get_const_slice_sets() const noexcept#
Returns the offsets of slices.
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.
- Returns:
the offsets of slices.
-
inline size_type get_slice_size() const noexcept#
Returns the size of a slice.
- Returns:
the size of a slice.
-
inline size_type get_stride_factor() const noexcept#
Returns the stride factor(t) of SELL-P.
- Returns:
the stride factor(t) of SELL-P.
-
inline size_type get_total_cols() const noexcept#
Returns the total column number.
- Returns:
the total column number.
-
inline size_type get_num_stored_elements() const noexcept#
Returns the number of elements explicitly stored in the matrix.
- Returns:
the number of elements explicitly stored in the matrix
- inline value_type &val_at(
- size_type row,
- size_type slice_set,
- size_type idx,
Returns the
idx-th non-zero element of therow-th row withslice_setslice set.Note
the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the CPU results in a runtime error)
- Parameters:
row – the row of the requested element in the slice
slice_set – the slice set of the slice
idx – the idx-th stored element of the row in the slice
- inline value_type val_at(
- size_type row,
- size_type slice_set,
- size_type idx,
Returns the
idx-th non-zero element of therow-th row withslice_setslice set.Note
the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the CPU results in a runtime error)
- Parameters:
row – the row of the requested element in the slice
slice_set – the slice set of the slice
idx – the idx-th stored element of the row in the slice
- inline index_type &col_at(
- size_type row,
- size_type slice_set,
- size_type idx,
Returns the
idx-th column index of therow-th row withslice_setslice set.Note
the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the CPU results in a runtime error)
- Parameters:
row – the row of the requested element in the slice
slice_set – the slice set of the slice
idx – the idx-th stored element of the row in the slice
- inline index_type col_at(
- size_type row,
- size_type slice_set,
- size_type idx,
Returns the
idx-th column index of therow-th row withslice_setslice set.Note
the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the CPU results in a runtime error)
- Parameters:
row – the row of the requested element in the slice
slice_set – the slice set of the slice
idx – the idx-th stored element of the row in the slice
-
device_view get_device_view()#
get the non-owning device view
-
const_device_view get_const_device_view() const#
get the const non-owning device view
-
Sellp &operator=(const Sellp&)#
Copy-assigns a Sellp matrix. Preserves the executor, copies the data and parameters.
-
Sellp &operator=(Sellp&&)#
Move-assigns a Sellp matrix. Preserves the executor, moves the data and parameters. The moved-from object is empty (0x0 with valid slice_sets and unchanged parameters).
Public Static Functions
- std::shared_ptr<const Executor> exec,
- const dim<2> &size = {},
- size_type total_cols = 0,
Creates an uninitialized Sellp matrix of the specified size. (The slice_size and stride_factor are set to the default values.)
- Parameters:
exec – Executor associated to the matrix
size – size of the matrix
total_cols – number of the sum of all cols in every slice.
- Returns:
A smart pointer to the newly created matrix.
- std::shared_ptr<const Executor> exec,
- const dim<2> &size,
- size_type slice_size,
- size_type stride_factor,
- size_type total_cols,
Creates an uninitialized Sellp matrix of the specified size.
- Parameters:
exec – Executor associated to the matrix
size – size of the matrix
slice_size – number of rows in each slice
stride_factor – factor for the stride in each slice (strides should be multiples of the stride_factor)
total_cols – number of the sum of all cols in every slice.
- Returns:
A smart pointer to the newly created matrix.