Plain two-dimensional floating-point matrix.
float matrices and vectors
Typedefs | |
| typedef struct fmat | fmat_t |
| The fmat data type. | |
Functions | |
| float * | fmat_lock (fmat_t *fmat) |
| Get a thread-safe shared pointer to the raw float data vector of an fmat. | |
| void | fmat_unlock (fmat_t *fmat) |
| Unlock an fmat after a previous lock. | |
| int | fmat_get_m (fmat_t *fmat) |
| Get number of rows of an fmat. | |
| int | fmat_get_n (fmat_t *fmat) |
| Get number of columns of an fmat. | |
| FTS_API fmat_t * | fmat_create (int m, int n) |
| Create an fmat with a given dimensions (number of rows and columns). | |
| FTS_API fts_schema_t * | fmat_get_schema (fmat_t *self, int dim) |
| Get row or column schema of fmat. | |
| FTS_API void | fmat_set_schema (fmat_t *self, int dim, fts_schema_t *schema) |
| Get row or column schema of fmat. | |
| FTS_API int | fmat_reshape_nogrow (fmat_t *self, int m, int n) |
| Get pointer to values of redimensioned fmat. (The contained data is not rearranged to fit the new dimensions). | |
| FTS_API int | fmat_set_size_nogrow (fmat_t *self, int m, int n) |
| Change matrix dimensions (number of rows and columns). | |
| FTS_API int | fmat_set_m_nogrow (fmat_t *self, int m) |
| Change number of rows of an fmat. | |
| FTS_API int | fmat_set_n_nogrow (fmat_t *self, int n) |
| Change number of columns of an fmat. | |
| FTS_API int | fmat_insert_rows_nogrow (fmat_t *self, int pos, int num) |
| Insert (zeroed) columns at given column index to an fmat. | |
| FTS_API int | fmat_insert_columns_nogrow (fmat_t *self, int pos, int num) |
| Insert (zeroed) rows at given row index to an fmat. | |
| FTS_API int | fmat_delete_rows (fmat_t *self, int start_idx, int numrows) |
| Delete given number of rows from given index. | |
| FTS_API int | fmat_delete_columns (fmat_t *self, int start_idx, int numcols) |
| Delete given numner of columns from given index. | |
| float * | fmat_get_element (fmat_t *fmat, int i, int j) |
| Get the value at given index (row and column) of an fmat. | |
| void | fmat_set_element (fmat_t *fmat, int i, int j, float val) |
| Set value at given index (row and column) to given value of an fmat. | |
| void | fmat_set_onset (fmat_t *fmat, double onset) |
| Set fractional onset of an fmat. | |
| double | fmat_get_onset (fmat_t *fmat) |
| Get fractional onset of an fmat. | |
| void | fmat_set_domain (fmat_t *fmat, double domain) |
| Set floating-point size (domain) of an fmat. | |
| double | fmat_get_domain (fmat_t *fmat) |
| Set floating-point size (domain) of an fmat. | |
| FTS_API int | fmat_or_fvec_vector (fts_object_t *obj, float **ptr, int *size, int *stride) |
| Check class and get dimensions of an fmat or fvec vector. | |
| FTS_API int | fmat_or_fvec_vector_lock (fts_object_t *obj, float **ptr, int *size, int *stride) |
| Check class and get dimensions of an fmat or fvec vector. | |
| FTS_API int | fmat_or_fvec_lock (fts_object_t *obj) |
| Check class, and lock an fmat or fvec vector. | |
| FTS_API void | fmat_or_fvec_unlock (fts_object_t *obj) |
| Unlock object after call to fmat_or_fvec_lock(), fmat_or_fvec_vector_lock(), or fmat_or_fvec_matrix_lock(). | |
| FTS_API void | fmat_set_const (fmat_t *mat, float c) |
| Set all values of an fmat to a constant value. | |
| FTS_API void | fmat_set_from_atoms (fmat_t *fmat, int onset, int step, int ac, const fts_atom_t *at) |
| Set fmat values from list of atoms starting from given index and unsing given stride. | |
| FTS_API void | fmat_copy_locked (fmat_t *orig, fmat_t *copy) |
| Copy fmat values (and dimensions) to another with both locked. | |
| FTS_API void | fmat_resample_locked (fmat_t *in, fmat_t *out, double factor) |
| Copy fmat values to another applying resampling. | |
| FTS_API void | fmat_sort_ascending (fmat_t *fmat, int col) |
| Sort fmat rows according to the values of a given column in ascending order. | |
| FTS_API void | fmat_sort_descending (fmat_t *fmat, int col) |
| Sort fmat rows according to the values of a given column in descending order. | |
Variables | |
| FTS_API fts_class_t * | fmat_class |
| The fmat class identifier (pointer to class instance). | |
| FTS_API fmat_t * | fmat_null |
| Empty fmat constant. | |
Copy fmat values (and dimensions) to another with both locked.
| orig | the original fmat | |
| copy | the copy fmat |
| FTS_API fmat_t* fmat_create | ( | int | m, | |
| int | n | |||
| ) |
Create an fmat with a given dimensions (number of rows and columns).
| m | number of rows | |
| n | number of columns |
| FTS_API int fmat_delete_columns | ( | fmat_t * | self, | |
| int | start_idx, | |||
| int | numcols | |||
| ) |
Delete given numner of columns from given index.
| self | the fmat | |
| start_idx | start index | |
| numcols | number of columns to delete |
| FTS_API int fmat_delete_rows | ( | fmat_t * | self, | |
| int | start_idx, | |||
| int | numrows | |||
| ) |
Delete given number of rows from given index.
| self | the fmat | |
| start_idx | start index | |
| numrows | number of rows to delete |
| double fmat_get_domain | ( | fmat_t * | fmat | ) |
Set floating-point size (domain) of an fmat.
| fmat | the fmat |
| float* fmat_get_element | ( | fmat_t * | fmat, | |
| int | i, | |||
| int | j | |||
| ) |
Get the value at given index (row and column) of an fmat.
| fmat | the fmat | |
| i | the row | |
| j | the column |
| int fmat_get_m | ( | fmat_t * | fmat | ) |
Get number of rows of an fmat.
| fmat | the fmat |
| int fmat_get_n | ( | fmat_t * | fmat | ) |
Get number of columns of an fmat.
| fmat | the fmat |
| double fmat_get_onset | ( | fmat_t * | fmat | ) |
Get fractional onset of an fmat.
| fmat | the fmat |
| FTS_API fts_schema_t* fmat_get_schema | ( | fmat_t * | self, | |
| int | dim | |||
| ) |
Get row or column schema of fmat.
| dim | get row schema if dim == 1, column schema if dim == 2 |
| FTS_API int fmat_insert_columns_nogrow | ( | fmat_t * | self, | |
| int | pos, | |||
| int | num | |||
| ) |
Insert (zeroed) rows at given row index to an fmat.
| self | the fmat | |
| pos | index where insert new rows | |
| num | number of rows to insert |
| FTS_API int fmat_insert_rows_nogrow | ( | fmat_t * | self, | |
| int | pos, | |||
| int | num | |||
| ) |
Insert (zeroed) columns at given column index to an fmat.
| self | the fmat | |
| pos | index where insert new cols | |
| num | number of columns to insert |
| float* fmat_lock | ( | fmat_t * | fmat | ) |
Get a thread-safe shared pointer to the raw float data vector of an fmat.
This function puts a shared lock (read lock) on the fmat. The fmat has to be unlocked by a call to fmat_unlock().
| fmat | the fmat |
| FTS_API int fmat_or_fvec_lock | ( | fts_object_t * | obj | ) |
Check class, and lock an fmat or fvec vector.
This function puts a shared lock (read lock) on the object (fmat ro fvec). The object has be unlocked by a call to fmat_or_fvec_unlock().
| obj | the object |
| FTS_API void fmat_or_fvec_unlock | ( | fts_object_t * | obj | ) |
Unlock object after call to fmat_or_fvec_lock(), fmat_or_fvec_vector_lock(), or fmat_or_fvec_matrix_lock().
| obj | the object |
| FTS_API int fmat_or_fvec_vector | ( | fts_object_t * | obj, | |
| float ** | ptr, | |||
| int * | size, | |||
| int * | stride | |||
| ) |
Check class and get dimensions of an fmat or fvec vector.
The functions returns 1 for fvec, 2 for fmat or 0 for any other object.
float *ptr int size; int stride; if(fmat_or_fvec_vector(obj, &ptr, &size, &stride) != 0) { int i; for(i=0, j=0; i<size; i++, j+=stride) { out[i] = ptr[j]; } }
| obj | the object | |
| ptr | return pointer to raw floating point values. | |
| size | return size | |
| stride | return size |
| FTS_API int fmat_or_fvec_vector_lock | ( | fts_object_t * | obj, | |
| float ** | ptr, | |||
| int * | size, | |||
| int * | stride | |||
| ) |
Check class and get dimensions of an fmat or fvec vector.
This function puts a shared lock (read lock) on the object (fmat ro fvec). The object has be unlocked by a call to fmat_or_fvec_unlock().
| obj | the object | |
| ptr | return pointer to raw floating point values. | |
| size | return size | |
| stride | return size |
Copy fmat values to another applying resampling.
| in | the input fmat | |
| out | the output fmat | |
| factor | resampling factor (downsampling factor > 1) |
| FTS_API int fmat_reshape_nogrow | ( | fmat_t * | self, | |
| int | m, | |||
| int | n | |||
| ) |
Get pointer to values of redimensioned fmat. (The contained data is not rearranged to fit the new dimensions).
| self | the fmat | |
| m | number of rows | |
| n | number of columns |
| FTS_API void fmat_set_const | ( | fmat_t * | mat, | |
| float | c | |||
| ) |
Set all values of an fmat to a constant value.
| mat | the object (fmat or fvec) | |
| c | the const value |
| void fmat_set_domain | ( | fmat_t * | fmat, | |
| double | domain | |||
| ) |
Set floating-point size (domain) of an fmat.
| fmat | the fmat | |
| domain | floating-point size (domain) |
| void fmat_set_element | ( | fmat_t * | fmat, | |
| int | i, | |||
| int | j, | |||
| float | val | |||
| ) |
Set value at given index (row and column) to given value of an fmat.
| fmat | the fmat | |
| i | the row | |
| j | the column | |
| val | new value |
| FTS_API void fmat_set_from_atoms | ( | fmat_t * | fmat, | |
| int | onset, | |||
| int | step, | |||
| int | ac, | |||
| const fts_atom_t * | at | |||
| ) |
Set fmat values from list of atoms starting from given index and unsing given stride.
| fmat | the fmat | |
| onset | starting index | |
| step | stride | |
| ac | number of values | |
| at | values |
| FTS_API int fmat_set_m_nogrow | ( | fmat_t * | self, | |
| int | m | |||
| ) |
Change number of rows of an fmat.
| self | the fmat | |
| m | new number of rows |
| FTS_API int fmat_set_n_nogrow | ( | fmat_t * | self, | |
| int | n | |||
| ) |
Change number of columns of an fmat.
| self | the fmat | |
| n | new number of columns |
| void fmat_set_onset | ( | fmat_t * | fmat, | |
| double | onset | |||
| ) |
Set fractional onset of an fmat.
| fmat | the fmat | |
| onset | fractional onset [0 ... 1[ |
| FTS_API void fmat_set_schema | ( | fmat_t * | self, | |
| int | dim, | |||
| fts_schema_t * | schema | |||
| ) |
Get row or column schema of fmat.
| schema | pointer to schema | |
| dim | set row schema if dim == 1, column schema if dim == 2 |
| FTS_API int fmat_set_size_nogrow | ( | fmat_t * | self, | |
| int | m, | |||
| int | n | |||
| ) |
Change matrix dimensions (number of rows and columns).
This function re-arranges the matrix values corresponing to the new dimensions. Additional rows and/or colums will be zeroed.
| self | the fmat | |
| m | number of rows | |
| n | number of columns |
| FTS_API void fmat_sort_ascending | ( | fmat_t * | fmat, | |
| int | col | |||
| ) |
Sort fmat rows according to the values of a given column in ascending order.
| fmat | the fmat | |
| col | reference column |
| FTS_API void fmat_sort_descending | ( | fmat_t * | fmat, | |
| int | col | |||
| ) |
Sort fmat rows according to the values of a given column in descending order.
| fmat | the fmat | |
| col | reference column |
| void fmat_unlock | ( | fmat_t * | fmat | ) |
Unlock an fmat after a previous lock.
This function has to be calles after a call to fmat_lock().
| fmat | the fmat |
1.5.6