Class FormatImplementation

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class sparsebase::format::FormatImplementation : public sparsebase::format::Format

A class derived from the base Format class, mostly used for development purposes

FormatImplementation derives from the Format class. It implements some common functionality used by all formats. The Curiously recurring template pattern (CRTP) is used here for retrieving type information of the subclasses (like CSR and COO).

Under normal circumstances users should not interact with this class directly unless they are defining their own format in which case this class should be derived from by passing the newly defined format as a template parameter.

tparam FormatType

used for CRTP, should be a concrete format class (for example: CSR<int,int,int>)

Subclassed by sparsebase::format::FormatOrderOne< ValueType >, sparsebase::format::FormatOrderTwo< IDType, NNZType, ValueType >

Public Functions

inline virtual std::vector<DimensionType> get_dimensions() const

Returns the sizes of all dimensions as a vector.

inline virtual DimensionType get_num_nnz() const

Returns the number of non-zero elements stored.

inline virtual DimensionType get_order() const

Returns the number of dimensions.

inline virtual context::Context *get_context() const

Returns the context for the format instance.

inline virtual std::type_index get_id() const

Returns the type_index for the context for the format instance.

inline virtual std::shared_ptr<converter::Converter const> get_converter() const

Returns a pointer at the converter of this format instance.

inline void set_converter(std::shared_ptr<converter::Converter> converter)

Protected Attributes

DimensionType order_
std::vector<DimensionType> dimension_
DimensionType nnz_
utils::OnceSettable<std::unique_ptr<sparsebase::context::Context>> context_
std::shared_ptr<converter::Converter> converter_