The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research

n-dimensional matrix with real or complex floating point values. More...

Inheritance diagram for MHASignal::matrix_t:
Inheritance graph

Public Member Functions

 matrix_t (unsigned int nrows, unsigned int ncols, bool b_is_complex=true)
 Create a two-dimensional matrix. More...
 
 matrix_t (const mha_spec_t &spec)
 Create a two-dimensional matrix from a spectrum, copy values. More...
 
 matrix_t (const MHASignal::uint_vector_t &size, bool b_is_complex=true)
 Create n-dimensional matrix, descriped by size argument. More...
 
 matrix_t (const MHASignal::matrix_t &)
 
 matrix_t (const uint8_t *buf, unsigned int len)
 Construct from memory area. More...
 
 ~matrix_t ()
 
MHASignal::matrix_toperator= (const MHASignal::matrix_t &)
 
MHASignal::matrix_toperator= (const MHA_AC::comm_var_t &v)
 Fill matrix with data of an AC variable object. More...
 
MHA_AC::comm_var_t get_comm_var ()
 Return a AC communication variable pointing to the data of the current matrix. More...
 
unsigned int dimension () const
 Return the dimension of the matrix. More...
 
unsigned int size (unsigned int k) const
 Return the size of the matrix. More...
 
unsigned int get_nelements () const
 Return total number of elements. More...
 
bool is_same_size (const MHASignal::matrix_t &)
 Test if matrix has same size as other. More...
 
bool iscomplex () const
 Return information about complexity. More...
 
mha_real_treal (const MHASignal::uint_vector_t &index)
 Access real part of an element in a n-dimensional matrix. More...
 
mha_real_timag (const MHASignal::uint_vector_t &index)
 Access imaginary part of an element in a n-dimensional matrix. More...
 
mha_complex_toperator() (const MHASignal::uint_vector_t &index)
 Access complex value of an element in a n-dimensional matrix. More...
 
const mha_real_treal (const MHASignal::uint_vector_t &index) const
 Access real part of an element in a n-dimensional matrix. More...
 
const mha_real_timag (const MHASignal::uint_vector_t &index) const
 Access imaginary part of an element in a n-dimensional matrix. More...
 
const mha_complex_toperator() (const MHASignal::uint_vector_t &index) const
 Access complex value of an element in a n-dimensional matrix. More...
 
mha_real_treal (unsigned int row, unsigned int col)
 Access real part of an element in a two-dimensional matrix. More...
 
mha_real_timag (unsigned int row, unsigned int col)
 Access imaginary part of an element in a two-dimensional matrix. More...
 
mha_complex_toperator() (unsigned int row, unsigned int col)
 Access complex value of an element in a two-dimensional matrix. More...
 
const mha_real_treal (unsigned int row, unsigned int col) const
 Access real part of an element in a two-dimensional matrix. More...
 
const mha_real_timag (unsigned int row, unsigned int col) const
 Access imaginary part of an element in a two-dimensional matrix. More...
 
const mha_complex_toperator() (unsigned int row, unsigned int col) const
 Access complex value of an element in a two-dimensional matrix. More...
 
unsigned int get_nreals () const
 
unsigned int get_index (unsigned int row, unsigned int col) const
 
unsigned int get_index (const MHASignal::uint_vector_t &index) const
 
unsigned int numbytes () const
 Return number of bytes needed to store into memory. More...
 
unsigned int write (uint8_t *buf, unsigned int len) const
 Copy to memory area. More...
 
const mha_real_tget_rdata () const
 Return pointer of real data. More...
 
const mha_complex_tget_cdata () const
 Return pointer of complex data. More...
 

Private Attributes

uint32_t complex_ofs
 
uint32_t nelements
 
union {
   mha_real_t *   rdata
 
   mha_complex_t *   cdata
 
}; 
 
- Private Attributes inherited from MHASignal::uint_vector_t
uint32_t length
 
uint32_t * data
 

Additional Inherited Members

- Private Member Functions inherited from MHASignal::uint_vector_t
 uint_vector_t (unsigned int len)
 Constructor, initializes all elements to zero. More...
 
 uint_vector_t (const uint_vector_t &)
 
 uint_vector_t (const uint8_t *buf, unsigned int len)
 Construct from memory area. More...
 
 ~uint_vector_t ()
 
bool operator== (const uint_vector_t &) const
 Check for equality. More...
 
uint_vector_toperator= (const uint_vector_t &)
 Assign from other uint_vector_t. More...
 
unsigned int get_length () const
 Return the length of the vector. More...
 
const uint32_t & operator[] (unsigned int k) const
 Read-only access to elements. More...
 
uint32_t & operator[] (unsigned int k)
 Access to elements. More...
 
unsigned int numbytes () const
 Return number of bytes needed to store into memory. More...
 
unsigned int write (uint8_t *buf, unsigned int len) const
 Copy to memory area. More...
 
const uint32_t * getdata () const
 Return pointer to the data field. More...
 

Detailed Description

n-dimensional matrix with real or complex floating point values.

Warning
The member functions imag() and operator() should only be called if the matrix is defined to hold complex values.

Constructor & Destructor Documentation

◆ matrix_t() [1/5]

MHASignal::matrix_t::matrix_t ( unsigned int  nrows,
unsigned int  ncols,
bool  b_is_complex = true 
)

Create a two-dimensional matrix.

Parameters
nrowsNumber of rows
ncolsNumber of columns
b_is_complexAdd space for complex values

◆ matrix_t() [2/5]

MHASignal::matrix_t::matrix_t ( const mha_spec_t spec)

Create a two-dimensional matrix from a spectrum, copy values.

Parameters
specSource spectrum structure

◆ matrix_t() [3/5]

MHASignal::matrix_t::matrix_t ( const MHASignal::uint_vector_t size,
bool  b_is_complex = true 
)

Create n-dimensional matrix, descriped by size argument.

Parameters
sizeSize vector
b_is_complexAdd space for complex values

◆ matrix_t() [4/5]

MHASignal::matrix_t::matrix_t ( const MHASignal::matrix_t src)

◆ matrix_t() [5/5]

MHASignal::matrix_t::matrix_t ( const uint8_t *  buf,
unsigned int  len 
)

Construct from memory area.

Warning
This constructor is not real time safe

◆ ~matrix_t()

MHASignal::matrix_t::~matrix_t ( )

Member Function Documentation

◆ operator=() [1/2]

matrix_t & MHASignal::matrix_t::operator= ( const MHASignal::matrix_t src)

◆ operator=() [2/2]

MHASignal::matrix_t & MHASignal::matrix_t::operator= ( const MHA_AC::comm_var_t v)

Fill matrix with data of an AC variable object.

Parameters
vSource AC variable (comm_var_t)
Note
The type and dimension of the AC variable must match the type and dimension of the matrix.

◆ get_comm_var()

MHA_AC::comm_var_t MHASignal::matrix_t::get_comm_var ( )

Return a AC communication variable pointing to the data of the current matrix.

Returns
AC variable object (comm_var_t), valid for the life time of the matrix.

◆ dimension()

unsigned int MHASignal::matrix_t::dimension ( ) const
inline

Return the dimension of the matrix.

Returns
Dimension of the matrix

◆ size()

unsigned int MHASignal::matrix_t::size ( unsigned int  k) const
inline

Return the size of the matrix.

Parameters
kDimension
Returns
Size of the matrix in dimension k

◆ get_nelements()

unsigned int MHASignal::matrix_t::get_nelements ( ) const

Return total number of elements.

◆ is_same_size()

bool MHASignal::matrix_t::is_same_size ( const MHASignal::matrix_t src)

Test if matrix has same size as other.

◆ iscomplex()

bool MHASignal::matrix_t::iscomplex ( ) const
inline

Return information about complexity.

◆ real() [1/4]

mha_real_t& MHASignal::matrix_t::real ( const MHASignal::uint_vector_t index)
inline

Access real part of an element in a n-dimensional matrix.

Parameters
indexIndex vector

◆ imag() [1/4]

mha_real_t& MHASignal::matrix_t::imag ( const MHASignal::uint_vector_t index)
inline

Access imaginary part of an element in a n-dimensional matrix.

Parameters
indexIndex vector

◆ operator()() [1/4]

mha_complex_t& MHASignal::matrix_t::operator() ( const MHASignal::uint_vector_t index)
inline

Access complex value of an element in a n-dimensional matrix.

Parameters
indexIndex vector

◆ real() [2/4]

const mha_real_t& MHASignal::matrix_t::real ( const MHASignal::uint_vector_t index) const
inline

Access real part of an element in a n-dimensional matrix.

Parameters
indexIndex vector

◆ imag() [2/4]

const mha_real_t& MHASignal::matrix_t::imag ( const MHASignal::uint_vector_t index) const
inline

Access imaginary part of an element in a n-dimensional matrix.

Parameters
indexIndex vector

◆ operator()() [2/4]

const mha_complex_t& MHASignal::matrix_t::operator() ( const MHASignal::uint_vector_t index) const
inline

Access complex value of an element in a n-dimensional matrix.

Parameters
indexIndex vector

◆ real() [3/4]

mha_real_t& MHASignal::matrix_t::real ( unsigned int  row,
unsigned int  col 
)
inline

Access real part of an element in a two-dimensional matrix.

Parameters
rowRow number of element
colColumn number of element

◆ imag() [3/4]

mha_real_t& MHASignal::matrix_t::imag ( unsigned int  row,
unsigned int  col 
)
inline

Access imaginary part of an element in a two-dimensional matrix.

Parameters
rowRow number of element
colColumn number of element

◆ operator()() [3/4]

mha_complex_t& MHASignal::matrix_t::operator() ( unsigned int  row,
unsigned int  col 
)
inline

Access complex value of an element in a two-dimensional matrix.

Parameters
rowRow number of element
colColumn number of element

◆ real() [4/4]

const mha_real_t& MHASignal::matrix_t::real ( unsigned int  row,
unsigned int  col 
) const
inline

Access real part of an element in a two-dimensional matrix.

Parameters
rowRow number of element
colColumn number of element

◆ imag() [4/4]

const mha_real_t& MHASignal::matrix_t::imag ( unsigned int  row,
unsigned int  col 
) const
inline

Access imaginary part of an element in a two-dimensional matrix.

Parameters
rowRow number of element
colColumn number of element

◆ operator()() [4/4]

const mha_complex_t& MHASignal::matrix_t::operator() ( unsigned int  row,
unsigned int  col 
) const
inline

Access complex value of an element in a two-dimensional matrix.

Parameters
rowRow number of element
colColumn number of element

◆ get_nreals()

unsigned int MHASignal::matrix_t::get_nreals ( ) const
inline

◆ get_index() [1/2]

unsigned int MHASignal::matrix_t::get_index ( unsigned int  row,
unsigned int  col 
) const

◆ get_index() [2/2]

unsigned int MHASignal::matrix_t::get_index ( const MHASignal::uint_vector_t index) const

◆ numbytes()

unsigned int MHASignal::matrix_t::numbytes ( ) const

Return number of bytes needed to store into memory.

◆ write()

unsigned int MHASignal::matrix_t::write ( uint8_t *  buf,
unsigned int  len 
) const

Copy to memory area.

◆ get_rdata()

const mha_real_t* MHASignal::matrix_t::get_rdata ( ) const
inline

Return pointer of real data.

◆ get_cdata()

const mha_complex_t* MHASignal::matrix_t::get_cdata ( ) const
inline

Return pointer of complex data.

Member Data Documentation

◆ complex_ofs

uint32_t MHASignal::matrix_t::complex_ofs
private

◆ nelements

uint32_t MHASignal::matrix_t::nelements
private

◆ rdata

mha_real_t* MHASignal::matrix_t::rdata

◆ cdata

mha_complex_t* MHASignal::matrix_t::cdata

◆ 

union { ... }

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