tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
tatami::SparseRange< Value_, Index_ > Struct Template Reference

A range of a sparse vector. More...

#include <SparseRange.hpp>

Public Member Functions

 SparseRange (Index_ number, const Value_ *value=NULL, const Index_ *index=NULL)
 
 SparseRange ()=default
 

Public Attributes

Index_ number = 0
 
const Value_ * value = NULL
 
const Index_ * index = NULL
 

Detailed Description

template<typename Value_, typename Index_>
struct tatami::SparseRange< Value_, Index_ >

A range of a sparse vector.

This class defines a range along a sparse vector. It records the number of structural "non-zero" elements within this range, and contains pointers to their values and indices.

When a SparseRange is created by methods like MyopicSparseExtractor::fetch(), each of its indices refers to a position on the non-target dimension of the original Matrix. For example, when iterating over the rows, the indices would correspond to the columns.

Note that the elements in value are not guaranteed to be non-zero. If zeroes are explicitly initialized in the underlying structure, they will be reported here. However, one can safely assume that all indices not reported in index have values of zero.

Template Parameters
Value_Data value type, should be numeric.
Index_Row/column index type, should be integer.

Constructor & Destructor Documentation

◆ SparseRange() [1/2]

template<typename Value_ , typename Index_ >
tatami::SparseRange< Value_, Index_ >::SparseRange ( Index_ number,
const Value_ * value = NULL,
const Index_ * index = NULL )
inline
Parameters
numberNumber of structural non-zero values.
valuePointer to the values. This should have at least number addressible elements.
indexPointer to the indices. This should have at least number addressible elements.

◆ SparseRange() [2/2]

template<typename Value_ , typename Index_ >
tatami::SparseRange< Value_, Index_ >::SparseRange ( )
default

Default constructor.

Member Data Documentation

◆ number

template<typename Value_ , typename Index_ >
Index_ tatami::SparseRange< Value_, Index_ >::number = 0

Number of structural non-zero elements.

◆ value

template<typename Value_ , typename Index_ >
const Value_* tatami::SparseRange< Value_, Index_ >::value = NULL

Pointer to an array containing the values of the structural non-zeros. If non-NULL, this has at least number addressible entries.

◆ index

template<typename Value_ , typename Index_ >
const Index_* tatami::SparseRange< Value_, Index_ >::index = NULL

Pointer to an array containing the indices of the structural non-zeros. If non-NULL, this has at least number addressible entries.


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