MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::compressed2D< Value, Parameters > Class Template Reference

CSR sparse matrix: three arrays – data (values), indices (column indices), starts (row pointers of length nrows+1). More...

#include <compressed2D.hpp>

Public Types

using param_type = Parameters
using value_type = Value
using size_type = typename Parameters::size_type
using const_reference = const Value&
using reference = Value&
using memory_space = ::mtl::detail::memory_space_of_t<Parameters>
 Where the three arrays live: Parameters::memory_space, or host memory for a parameter bundle that names none (#223).
template<typename T>
using array_type = ::mtl::detail::space_vector<T, memory_space>
 The array type of ref_major() / ref_minor() (size_type) and ref_data() (Value): std::vector<T> in host memory, so host code is unchanged.

Public Member Functions

 compressed2D ()
 Default: empty 0x0 matrix.
 compressed2D (size_type nrows, size_type ncols)
 Construct empty nrows x ncols matrix.
 compressed2D (size_type nrows, size_type ncols, size_type nnz_count, const size_type *starts, const size_type *indices, const Value *data)
 Construct from raw CSR arrays (copies data).
value_type operator() (size_type r, size_type c) const
 Read-only access: binary search within row r for column c.
size_type num_rows () const
size_type num_cols () const
size_type size () const
size_type nnz () const
const array_type< size_type > & ref_major () const
array_type< size_type > & ref_major ()
const array_type< size_type > & ref_minor () const
array_type< size_type > & ref_minor ()
const array_type< Value > & ref_data () const
array_type< Value > & ref_data ()
void change_dim (size_type r, size_type c)
void make_empty ()

Detailed Description

template<typename Value, typename Parameters = parameters<>>
class mtl::compressed2D< Value, Parameters >

CSR sparse matrix: three arrays – data (values), indices (column indices), starts (row pointers of length nrows+1).

Member Typedef Documentation

◆ array_type

template<typename Value, typename Parameters = parameters<>>
template<typename T>
using mtl::mat::compressed2D< Value, Parameters >::array_type = ::mtl::detail::space_vector<T, memory_space>

The array type of ref_major() / ref_minor() (size_type) and ref_data() (Value): std::vector<T> in host memory, so host code is unchanged.

◆ const_reference

template<typename Value, typename Parameters = parameters<>>
using mtl::mat::compressed2D< Value, Parameters >::const_reference = const Value&

◆ memory_space

template<typename Value, typename Parameters = parameters<>>
using mtl::mat::compressed2D< Value, Parameters >::memory_space = ::mtl::detail::memory_space_of_t<Parameters>

Where the three arrays live: Parameters::memory_space, or host memory for a parameter bundle that names none (#223).

◆ param_type

template<typename Value, typename Parameters = parameters<>>
using mtl::mat::compressed2D< Value, Parameters >::param_type = Parameters

◆ reference

template<typename Value, typename Parameters = parameters<>>
using mtl::mat::compressed2D< Value, Parameters >::reference = Value&

◆ size_type

template<typename Value, typename Parameters = parameters<>>
using mtl::mat::compressed2D< Value, Parameters >::size_type = typename Parameters::size_type

◆ value_type

template<typename Value, typename Parameters = parameters<>>
using mtl::mat::compressed2D< Value, Parameters >::value_type = Value

Constructor & Destructor Documentation

◆ compressed2D() [1/3]

template<typename Value, typename Parameters = parameters<>>
mtl::mat::compressed2D< Value, Parameters >::compressed2D ( )
inline

Default: empty 0x0 matrix.

◆ compressed2D() [2/3]

template<typename Value, typename Parameters = parameters<>>
mtl::mat::compressed2D< Value, Parameters >::compressed2D ( size_type nrows,
size_type ncols )
inline

Construct empty nrows x ncols matrix.

◆ compressed2D() [3/3]

template<typename Value, typename Parameters = parameters<>>
mtl::mat::compressed2D< Value, Parameters >::compressed2D ( size_type nrows,
size_type ncols,
size_type nnz_count,
const size_type * starts,
const size_type * indices,
const Value * data )
inline

Construct from raw CSR arrays (copies data).

Member Function Documentation

◆ change_dim()

template<typename Value, typename Parameters = parameters<>>
void mtl::mat::compressed2D< Value, Parameters >::change_dim ( size_type r,
size_type c )
inline

◆ make_empty()

template<typename Value, typename Parameters = parameters<>>
void mtl::mat::compressed2D< Value, Parameters >::make_empty ( )
inline

◆ nnz()

template<typename Value, typename Parameters = parameters<>>
size_type mtl::mat::compressed2D< Value, Parameters >::nnz ( ) const
inline

◆ num_cols()

template<typename Value, typename Parameters = parameters<>>
size_type mtl::mat::compressed2D< Value, Parameters >::num_cols ( ) const
inline

◆ num_rows()

template<typename Value, typename Parameters = parameters<>>
size_type mtl::mat::compressed2D< Value, Parameters >::num_rows ( ) const
inline

◆ operator()()

template<typename Value, typename Parameters = parameters<>>
value_type mtl::mat::compressed2D< Value, Parameters >::operator() ( size_type r,
size_type c ) const
inline

Read-only access: binary search within row r for column c.

Returns zero if element is absent.

◆ ref_data() [1/2]

template<typename Value, typename Parameters = parameters<>>
array_type< Value > & mtl::mat::compressed2D< Value, Parameters >::ref_data ( )
inline

◆ ref_data() [2/2]

template<typename Value, typename Parameters = parameters<>>
const array_type< Value > & mtl::mat::compressed2D< Value, Parameters >::ref_data ( ) const
inline

◆ ref_major() [1/2]

template<typename Value, typename Parameters = parameters<>>
array_type< size_type > & mtl::mat::compressed2D< Value, Parameters >::ref_major ( )
inline

◆ ref_major() [2/2]

template<typename Value, typename Parameters = parameters<>>
const array_type< size_type > & mtl::mat::compressed2D< Value, Parameters >::ref_major ( ) const
inline

◆ ref_minor() [1/2]

template<typename Value, typename Parameters = parameters<>>
array_type< size_type > & mtl::mat::compressed2D< Value, Parameters >::ref_minor ( )
inline

◆ ref_minor() [2/2]

template<typename Value, typename Parameters = parameters<>>
const array_type< size_type > & mtl::mat::compressed2D< Value, Parameters >::ref_minor ( ) const
inline

◆ size()

template<typename Value, typename Parameters = parameters<>>
size_type mtl::mat::compressed2D< Value, Parameters >::size ( ) const
inline

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