RADLib
RADical C++ application framework
RADDsp::MatrixF Class Reference

Row-major dense floating-point matrix for DSP transforms and small linear algebra. More...

#include <RADDsp.h>

Public Member Functions

 MatrixF ()=default
 Creates an empty matrix. More...
 
 MatrixF (size_t rows, size_t columns, float value=0.0f)
 Creates a rows x columns matrix initialized to value. More...
 
 MatrixF (size_t rows, size_t columns, const std::vector< float > &rowMajor)
 Creates a rows x columns matrix from row-major values; missing values are zero-filled. More...
 
size_t rows () const
 Returns the number of rows. More...
 
size_t columns () const
 Returns the number of columns. More...
 
bool empty () const
 Returns true when either dimension is zero. More...
 
const std::vector< float > & data () const
 Returns the matrix backing storage in row-major order. More...
 
std::vector< float > & data ()
 Returns the mutable matrix backing storage in row-major order. More...
 
void resize (size_t rows, size_t columns, float value=0.0f)
 Resizes the matrix and fills all values with value. More...
 
float & operator() (size_t row, size_t column)
 Fast unchecked element access for hot DSP loops. More...
 
float operator() (size_t row, size_t column) const
 Fast unchecked element access for hot DSP loops. More...
 
float get (size_t row, size_t column) const
 Safely reads one value, returning 0 for invalid indices. More...
 
bool set (size_t row, size_t column, float value)
 Safely writes one value and returns false for invalid indices. More...
 

Detailed Description

Row-major dense floating-point matrix for DSP transforms and small linear algebra.

Constructor & Destructor Documentation

◆ MatrixF() [1/3]

RADDsp::MatrixF::MatrixF ( )
default

Creates an empty matrix.

◆ MatrixF() [2/3]

RADDsp::MatrixF::MatrixF ( size_t  rows,
size_t  columns,
float  value = 0.0f 
)

Creates a rows x columns matrix initialized to value.

◆ MatrixF() [3/3]

RADDsp::MatrixF::MatrixF ( size_t  rows,
size_t  columns,
const std::vector< float > &  rowMajor 
)

Creates a rows x columns matrix from row-major values; missing values are zero-filled.

Member Function Documentation

◆ columns()

size_t RADDsp::MatrixF::columns ( ) const

Returns the number of columns.

◆ data() [1/2]

std::vector<float>& RADDsp::MatrixF::data ( )

Returns the mutable matrix backing storage in row-major order.

◆ data() [2/2]

const std::vector<float>& RADDsp::MatrixF::data ( ) const

Returns the matrix backing storage in row-major order.

◆ empty()

bool RADDsp::MatrixF::empty ( ) const

Returns true when either dimension is zero.

◆ get()

float RADDsp::MatrixF::get ( size_t  row,
size_t  column 
) const

Safely reads one value, returning 0 for invalid indices.

◆ operator()() [1/2]

float& RADDsp::MatrixF::operator() ( size_t  row,
size_t  column 
)

Fast unchecked element access for hot DSP loops.

◆ operator()() [2/2]

float RADDsp::MatrixF::operator() ( size_t  row,
size_t  column 
) const

Fast unchecked element access for hot DSP loops.

◆ resize()

void RADDsp::MatrixF::resize ( size_t  rows,
size_t  columns,
float  value = 0.0f 
)

Resizes the matrix and fills all values with value.

◆ rows()

size_t RADDsp::MatrixF::rows ( ) const

Returns the number of rows.

◆ set()

bool RADDsp::MatrixF::set ( size_t  row,
size_t  column,
float  value 
)

Safely writes one value and returns false for invalid indices.


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