ambix_matrix

Various utilities to handle matrices. More...

## Topics

| ambix_matrix_multiply_data()
| Multiply a matrix with data.

## Functions

AMBIX_API ambix_matrix_t * | ambix_matrix_create (void)
| Create a matrix.
AMBIX_API void | ambix_matrix_destroy (ambix_matrix_t *mtx)
| Destroy a matrix.
AMBIX_API ambix_matrix_t * | ambix_matrix_init (uint32_t rows, uint32_t cols, ambix_matrix_t *mtx)
| Initialize a matrix.
AMBIX_API void | ambix_matrix_deinit (ambix_matrix_t *mtx)
| De-initialize a matrix.
AMBIX_API ambix_matrix_t * | ambix_matrix_fill (ambix_matrix_t *matrix, ambix_matrixtype_t type)
| Fill a matrix according to specs.
AMBIX_API ambix_err_t | ambix_matrix_fill_data (ambix_matrix_t *mtx, const float32_t *data)
| Fill a matrix with values.
AMBIX_API ambix_matrix_t * | ambix_matrix_copy (const ambix_matrix_t *src, ambix_matrix_t *dest)
| Copy a matrix to another matrix.

## Detailed Description

Various utilities to handle matrices.

## Function Documentation

## ambix_matrix_copy()

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

  src | the source matrix to copy the data from
  dest | the destination matrix (if NULL a new matrix will be created)

Returns
  pointer to the destination matrix

## ambix_matrix_create()

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_matrix_deinit()

AMBIX_API void ambix_matrix_deinit | ( | ambix_matrix_t * | mtx | ) |

De-initialize a matrix.

Frees associated resources and sets rows/columns to 0

Parameters

  mtx | matrix object to deinitialize

## ambix_matrix_destroy()

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

  mtx | matrix object to destroy

## ambix_matrix_fill()

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

  matrix | initialized matrix object to fill
  type | data specification

Returns
  pointer to the matrix object, or NULL if the type was not valid (for the input matrix)

## ambix_matrix_fill_data()

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

  mtx | initialized matrix object to copy data into
  data | pointer 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_matrix_init()

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

  rows | number of rows in the newly initialized matrix
  cols | number of columns in the newly initialized matrix
  mtx | pointer 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.