tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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]

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]

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

Default constructor.

Member Data Documentation

◆ number

Number of structural non-zero elements.

◆ value

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

◆ index

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: