Zephyr Scientific Library (zscilib)
|
Functions used to initialise matrices. More...
Typedefs | |
typedef int(* | zsl_mtx_unary_fn_t) (struct zsl_mtx *m, size_t i, size_t j) |
Function prototype called when applying a set of component-wise unary operations to a matrix via zsl_mtx_unary_func . More... | |
typedef int(* | zsl_mtx_binary_fn_t) (struct zsl_mtx *ma, struct zsl_mtx *mb, struct zsl_mtx *mc, size_t i, size_t j) |
Function prototype called when applying a set of component-wise binary operations using a pair of symmetrical matrices via zsl_mtx_binary_func . More... | |
typedef int(* | zsl_mtx_init_entry_fn_t) (struct zsl_mtx *m, size_t i, size_t j) |
Function prototype called when populating a matrix via zsl_mtx_init . More... | |
Functions | |
int | zsl_mtx_entry_fn_empty (struct zsl_mtx *m, size_t i, size_t j) |
Assigns a zero-value to all entries in the matrix. More... | |
int | zsl_mtx_entry_fn_identity (struct zsl_mtx *m, size_t i, size_t j) |
Sets the value to '1.0' if the entry is on the diagonal (row=col), otherwise '0.0'. More... | |
int | zsl_mtx_entry_fn_random (struct zsl_mtx *m, size_t i, size_t j) |
Sets the value to a random number between -1.0 and 1.0. More... | |
int | zsl_mtx_init (struct zsl_mtx *m, zsl_mtx_init_entry_fn_t entry_fn) |
Initialises matrix 'm' using the specified entry function to assign values. More... | |
int | zsl_mtx_from_arr (struct zsl_mtx *m, zsl_real_t *a) |
Converts an array of values into a matrix. More... | |
int | zsl_mtx_copy (struct zsl_mtx *mdest, struct zsl_mtx *msrc) |
Copies the contents of matrix 'msrc' into matrix 'mdest'. More... | |
Functions used to initialise matrices.
typedef int(* zsl_mtx_binary_fn_t) (struct zsl_mtx *ma, struct zsl_mtx *mb, struct zsl_mtx *mc, size_t i, size_t j) |
Function prototype called when applying a set of component-wise binary operations using a pair of symmetrical matrices via zsl_mtx_binary_func
.
ma | Pointer to first zsl_mtx to use in the binary operation. |
mb | Pointer to second zsl_mtx to use in the binary operation. |
mc | Pointer to output zsl_mtx used to store results. |
i | The row number to write (0-based). |
j | The column number to write (0-based). |
Definition at line 156 of file matrices.h.
typedef int(* zsl_mtx_init_entry_fn_t) (struct zsl_mtx *m, size_t i, size_t j) |
Function prototype called when populating a matrix via zsl_mtx_init
.
m | Pointer to the zsl_mtx to use. |
i | The row number to write (0-based). |
j | The column number to write (0-based). |
Definition at line 168 of file matrices.h.
typedef int(* zsl_mtx_unary_fn_t) (struct zsl_mtx *m, size_t i, size_t j) |
Function prototype called when applying a set of component-wise unary operations to a matrix via zsl_mtx_unary_func
.
m | Pointer to the zsl_mtx to use. |
i | The row number to write (0-based). |
j | The column number to write (0-based). |
Definition at line 142 of file matrices.h.
Copies the contents of matrix 'msrc' into matrix 'mdest'.
mdest | Pointer to the destination matrix data will be copied to. |
msrc | Pointer to the source matrix data will be copied from. |
Definition at line 81 of file matrices.c.
Referenced by zsl_mtx_balance(), zsl_mtx_gauss_elim(), zsl_mtx_gauss_reduc(), zsl_mtx_inv(), zsl_mtx_mult(), zsl_mtx_norm_elem(), zsl_mtx_qrd(), zsl_mtx_qrd_iter(), and zsl_mtx_reduce_iter().
int zsl_mtx_entry_fn_empty | ( | struct zsl_mtx * | m, |
size_t | i, | ||
size_t | j | ||
) |
Assigns a zero-value to all entries in the matrix.
m | Pointer to the zsl_mtx to use. |
i | The row number to write (0-based). |
j | The column number to write (0-based). |
Definition at line 31 of file matrices.c.
Referenced by zsl_mtx_cholesky(), and zsl_mtx_init().
int zsl_mtx_entry_fn_identity | ( | struct zsl_mtx * | m, |
size_t | i, | ||
size_t | j | ||
) |
Sets the value to '1.0' if the entry is on the diagonal (row=col), otherwise '0.0'.
m | Pointer to the zsl_mtx to use. |
i | The row number to write (0-based). |
j | The column number to write (0-based). |
Definition at line 37 of file matrices.c.
Referenced by zsl_mtx_augm_diag(), zsl_mtx_eigenvectors(), zsl_mtx_householder(), zsl_mtx_inv(), zsl_mtx_inv_3x3(), zsl_mtx_qrd(), and zsl_sta_weighted_mult_linear_reg().
int zsl_mtx_entry_fn_random | ( | struct zsl_mtx * | m, |
size_t | i, | ||
size_t | j | ||
) |
Sets the value to a random number between -1.0 and 1.0.
m | Pointer to the zsl_mtx to use. |
i | The row number to write (0-based). |
j | The column number to write (0-based). |
Definition at line 43 of file matrices.c.
int zsl_mtx_from_arr | ( | struct zsl_mtx * | m, |
zsl_real_t * | a | ||
) |
Converts an array of values into a matrix.
The number of elements in array 'a' must match the number of elements in matrix 'm' (m.sz_rows * m.sz_cols). As such, 'm' should be a previously initialised matrix with appropriate values assigned to m.sz_rows and m.sz_cols. Assumes array values are in row-major order.
m | The matrix that the contents of array 'a' should be assigned to. The m.sz_rows and m.sz_cols dimensions must match the number of elements in 'a', meaning that the matrix should be initialised before being passed in to this function. |
a | Pointer to the array containing the values to assign to 'm' in row-major order (left-to-right, top-to-bottom). The array will be read m.sz_rows * m.sz_cols elements deep. |
Definition at line 73 of file matrices.c.
Referenced by zsl_mtx_householder(), zsl_mtx_reduce(), zsl_mtx_svd(), zsl_sta_mult_linear_reg(), and zsl_sta_weighted_mult_linear_reg().
int zsl_mtx_init | ( | struct zsl_mtx * | m, |
zsl_mtx_init_entry_fn_t | entry_fn | ||
) |
Initialises matrix 'm' using the specified entry function to assign values.
m | Pointer to the zsl_mtx to use. |
entry_fn | The zsl_mtx_init_entry_fn_t instance to call. If this is set to NULL 'zsl_mtx_entry_fn_empty' will be called. |
Definition at line 50 of file matrices.c.
Referenced by zsl_mtx_augm_diag(), zsl_mtx_cholesky(), zsl_mtx_deter(), zsl_mtx_eigenvectors(), zsl_mtx_householder(), zsl_mtx_inv(), zsl_mtx_inv_3x3(), zsl_mtx_qrd(), zsl_mtx_svd(), zsl_mtx_vec_wedge(), zsl_sta_mult_linear_reg(), and zsl_sta_weighted_mult_linear_reg().