Sparse matrix object (similar to MacKay, Davey, Lafferty convention)
Public Functions
smatrixf | smatrixf_create( |
smatrixf | smatrixf_create_array( |
int | smatrixf_destroy( |
int | smatrixf_print( |
int | smatrixf_print_expanded( |
int | smatrixf_size( |
int | smatrixf_clear( |
int | smatrixf_reset( |
int | smatrixf_isset( |
int | smatrixf_insert( |
int | smatrixf_delete( |
int | smatrixf_set( |
float | smatrixf_get( |
int | smatrixf_eye( |
int | smatrixf_mul( |
int | smatrixf_vmul( |
Interfaces
smatrixf smatrixf_create(
Create \(M \times N\) sparse matrix, initialized with zeros
- _m : number of rows in matrix
- _n : number of columns in matrix
smatrixf smatrixf_create_array(
Create \(M \times N\) sparse matrix, initialized on array
- _x : input matrix, shape: (_m, _n)
- _m : number of rows in input matrix
- _n : number of columns in input matrix
int smatrixf_destroy(
Destroy object, freeing all internal memory
int smatrixf_print(
Print sparse matrix in compact form to stdout
int smatrixf_print_expanded(
Print sparse matrix in expanded form to stdout
int smatrixf_size(
Get size of sparse matrix (number of rows and columns)
- _q : sparse matrix object
- _m : number of rows in matrix
- _n : number of columns in matrix
int smatrixf_clear(
Zero all elements and retain allocated memory
int smatrixf_reset(
Zero all elements and clear memory
int smatrixf_isset(
Determine if value has been set (allocated memory)
- _q : sparse matrix object
- _m : row index of value to query
- _n : column index of value to query
int smatrixf_insert(
Insert an element at index, allocating memory as necessary
- _q : sparse matrix object
- _m : row index of value to insert
- _n : column index of value to insert
- _v : value to insert
int smatrixf_delete(
Delete an element at index, freeing memory
- _q : sparse matrix object
- _m : row index of value to delete
- _n : column index of value to delete
int smatrixf_set(
Set the value in matrix at specified row and column, allocating memory if needed
- _q : sparse matrix object
- _m : row index of value to set
- _n : column index of value to set
- _v : value to set in matrix
float smatrixf_get(
Get the value from matrix at specified row and column
- _q : sparse matrix object
- _m : row index of value to get
- _n : column index of value to get
int smatrixf_eye(
Initialize to identity matrix; set all diagonal elements to 1, all others to 0. This is done with both square and non-square matrices.
int smatrixf_mul(
Multiply two sparse matrices, \( \vec{Z} = \vec{X} \vec{Y} \)
- _x : sparse matrix object (input)
- _y : sparse matrix object (input)
- _z : sparse matrix object (output)
int smatrixf_vmul(
Multiply sparse matrix by vector
- _q : sparse matrix
- _x : input vector, shape: (_n, 1)
- _y : output vector, shape: (_m, 1)