libambix
the AMBIsonics eXchange library
Modules | Functions
ambix_matrix

Various utilities to handle matrices. More...

Modules

 ambix_matrix_multiply_data()
 Multiply a matrix with dataMultiply a [rows*cols] matrix with an array of [cols*frames] source data to get [rows*frames] dest data.
 

Functions

AMBIX_API ambix_matrix_tambix_matrix_create (void)
 Create a matrix. More...
 
AMBIX_API void ambix_matrix_destroy (ambix_matrix_t *mtx)
 Destroy a matrix. More...
 
AMBIX_API ambix_matrix_tambix_matrix_init (uint32_t rows, uint32_t cols, ambix_matrix_t *mtx)
 Initialize a matrix. More...
 
AMBIX_API void ambix_matrix_deinit (ambix_matrix_t *mtx)
 De-initialize a matrix. More...
 
AMBIX_API ambix_matrix_tambix_matrix_fill (ambix_matrix_t *matrix, ambix_matrixtype_t type)
 Fill a matrix according to specs. More...
 
AMBIX_API ambix_err_t ambix_matrix_fill_data (ambix_matrix_t *mtx, const float32_t *data)
 Fill a matrix with values. More...
 
AMBIX_API ambix_matrix_tambix_matrix_copy (const ambix_matrix_t *src, ambix_matrix_t *dest)
 Copy a matrix to another matrix. More...
 

Detailed Description

Various utilities to handle matrices.

Function Documentation

AMBIX_API ambix_matrix_t* ambix_matrix_copy ( const ambix_matrix_t src,
ambix_matrix_t dest 
)

Copy a matrix to another matrix.

Copy a matrix, possibly resizing or creating the destination

Parameters
srcthe source matrix to copy the data from
destthe destination matrix (if NULL a new matrix will be created)
Returns
pointer to the destination matrix
AMBIX_API ambix_matrix_t* ambix_matrix_create ( void  )

Create a matrix.

Allocates a new (empty) matrix object. It's equivalent to calling ambix_matrix_init(0, 0, NULL) ;

Returns
a new matrix object or NULL
AMBIX_API void ambix_matrix_deinit ( ambix_matrix_t mtx)

De-initialize a matrix.

Frees associated resources and sets rows/columns to 0

Parameters
mtxmatrix object to deinitialize
AMBIX_API void ambix_matrix_destroy ( ambix_matrix_t mtx)

Destroy a matrix.

Frees all resources allocated for the matrix object. It's a shortcut for ambix_matrix_deinit(mtx), free(mtx)

Parameters
mtxmatrix object to destroy
AMBIX_API ambix_matrix_t* ambix_matrix_fill ( ambix_matrix_t matrix,
ambix_matrixtype_t  type 
)

Fill a matrix according to specs.

Fill a properly initialized matrix according to type. You can use this to generate standard matrices (e.g. using AMBIX_MATRIX_ONE will set all elements of the matrix to 1.0). Since this call will not change the matrix layout (e.g. the dimension), it is the responsibility of the caller to ensure that the matrix has a proper layout for the requested type (e.g. it is an error to fill a Furse-Malham matrix into a matrix that holds more than 3rd order ambisonics).

Parameters
matrixinitialized matrix object to fill
typedata specification
Returns
pointer to the matrix object, or NULL if the type was not valid (for the input matrix)
AMBIX_API ambix_err_t ambix_matrix_fill_data ( ambix_matrix_t mtx,
const float32_t data 
)

Fill a matrix with values.

Fill data into a properly initialized matrix

Parameters
mtxinitialized matrix object to copy data into
datapointer to at least (mtx->rows*mtx->cols) values; data is ordered row-by-row with no padding (A[0,0], A[0,1], .., A[0,cols-1], A[1, 0], .. A[rows-1, cols-1])
Returns
an error code indicating success
AMBIX_API ambix_matrix_t* ambix_matrix_init ( uint32_t  rows,
uint32_t  cols,
ambix_matrix_t mtx 
)

Initialize a matrix.

Allocates memory for matrix-data of given dimensions

Parameters
rowsnumber of rows in the newly initialized matrix
colsnumber of columns in the newly initialized matrix
mtxpointer to a matrix object; if NULL a new matrix object will be created, else the given matrix object will be re-initialized.
Returns
pointer to a newly initialized (and/or allocated) matrix, or NULL on error.