tatami_stats
Matrix statistics for tatami
Loading...
Searching...
No Matches
Classes | Functions
tatami_stats::counts::zero Namespace Reference

Functions for counting zeros on each dimension. More...

Classes

struct  Options
 Zero-counting options. More...
 

Functions

template<typename Value_ , typename Index_ , typename Output_ >
void apply (bool row, const tatami::Matrix< Value_, Index_ > *p, Output_ *output, const Options &zopt)
 
template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > by_row (const tatami::Matrix< Value_, Index_ > *p, const Options &zopt)
 
template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > by_row (const tatami::Matrix< Value_, Index_ > *p)
 
template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > by_column (const tatami::Matrix< Value_, Index_ > *p, const Options &zopt)
 
template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > by_column (const tatami::Matrix< Value_, Index_ > *p)
 

Detailed Description

Functions for counting zeros on each dimension.

Function Documentation

◆ apply()

template<typename Value_ , typename Index_ , typename Output_ >
void tatami_stats::counts::zero::apply ( bool  row,
const tatami::Matrix< Value_, Index_ > *  p,
Output_ *  output,
const Options zopt 
)
Template Parameters
Value_Type of the matrix value, should be summable.
Index_Type of the row/column indices.
Output_Type of the output value. This should be at least large enough to hold the dimensions of p.
Parameters
rowWhether to obtain a count for each row.
pPointer to a tatami::Matrix.
[out]outputPointer to an array of length equal to the number of rows. On output, this will store the number of zeros in each row.
zoptCounting options.

◆ by_row() [1/2]

template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > tatami_stats::counts::zero::by_row ( const tatami::Matrix< Value_, Index_ > *  p,
const Options zopt 
)

Wrapper around apply() for row-wise zero counts.

Template Parameters
Value_Type of the matrix value, should be summable.
Index_Type of the row/column indices.
Output_Type of the output value. This should be at least large enough to hold the dimensions of p.
Parameters
pPointer to a tatami::Matrix.
zoptCounting options.

◆ by_row() [2/2]

template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > tatami_stats::counts::zero::by_row ( const tatami::Matrix< Value_, Index_ > *  p)

Overload with default options.

Template Parameters
Output_Type of the output value. This should be at least large enough to hold the dimensions of p.
Value_Type of the matrix value, should be summable.
Index_Type of the row/column indices.
Parameters
pPointer to a tatami::Matrix.
Returns
A vector of length equal to the number of rows, containing the number of zeros in each row.

◆ by_column() [1/2]

template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > tatami_stats::counts::zero::by_column ( const tatami::Matrix< Value_, Index_ > *  p,
const Options zopt 
)

Wrapper around apply() for column-wise zero counts.

Template Parameters
Output_Type of the output value. This should be at least large enough to hold the dimensions of p.
Value_Type of the matrix value, should be summable.
Index_Type of the row/column indices.
Parameters
pPointer to a tatami::Matrix.
zoptCounting options.
Returns
A vector of length equal to the number of columns, containing the number of zeros in each column.

◆ by_column() [2/2]

template<typename Output_ = int, typename Value_ , typename Index_ >
std::vector< Output_ > tatami_stats::counts::zero::by_column ( const tatami::Matrix< Value_, Index_ > *  p)
Template Parameters
Output_Type of the output value. This should be at least large enough to hold the dimensions of p.
Value_Type of the matrix value, should be summable.
Index_Type of the row/column indices.
Parameters
pPointer to a tatami::Matrix.
Returns
A vector of length equal to the number of columns, containing the number of zeros in each column.