Zephyr Scientific Library (zscilib)
|
Basic mathematical operations for matrices (add, substract, etc.). More...
Functions | |
int | zsl_mtx_add (struct zsl_mtx *ma, struct zsl_mtx *mb, struct zsl_mtx *mc) |
Adds matrices 'ma' and 'mb', assigning the output to 'mc'. Matrices 'ma', 'mb' and 'mc' must all be identically shaped. More... | |
int | zsl_mtx_add_d (struct zsl_mtx *ma, struct zsl_mtx *mb) |
Adds matrices 'ma' and 'mb', assigning the output to 'ma'. Matrices 'ma', and 'mb' must be identically shaped. More... | |
int | zsl_mtx_sum_rows_d (struct zsl_mtx *m, size_t i, size_t j) |
Adds the values of row 'j' to row 'i' in matrix 'm'. This operation is destructive for row 'i'. More... | |
int | zsl_mtx_sum_rows_scaled_d (struct zsl_mtx *m, size_t i, size_t j, zsl_real_t s) |
This function takes the coefficients of row 'j' and multiplies them by scalar 's', then adds the resulting coefficient to the parallel element in row 'i'. Row 'i' will be modified in this operation. More... | |
int | zsl_mtx_sub (struct zsl_mtx *ma, struct zsl_mtx *mb, struct zsl_mtx *mc) |
Subtracts matrices 'mb' from 'ma', assigning the output to 'mc'. Matrices 'ma', 'mb' and 'mc' must all be identically shaped. More... | |
int | zsl_mtx_sub_d (struct zsl_mtx *ma, struct zsl_mtx *mb) |
Subtracts matrix 'mb' from 'ma', assigning the output to 'ma'. Matrices 'ma', and 'mb' must be identically shaped. More... | |
int | zsl_mtx_mult (struct zsl_mtx *ma, struct zsl_mtx *mb, struct zsl_mtx *mc) |
Multiplies matrix 'ma' by 'mb', assigning the output to 'mc'. Matrices 'ma' and 'mb' must be compatibly shaped, meaning that 'ma' must have the same numbers of columns as there are rows in 'mb'. More... | |
int | zsl_mtx_mult_d (struct zsl_mtx *ma, struct zsl_mtx *mb) |
Multiplies matrix 'ma' by 'mb', assigning the output to 'ma'. Matrices 'ma' and 'mb' must be compatibly shaped, meaning that 'ma' must have the same numbers of columns as there are rows in 'mb'. To use this function, 'mb' must be a square matrix. This function is destructive. More... | |
int | zsl_mtx_scalar_mult_d (struct zsl_mtx *m, zsl_real_t s) |
Multiplies all elements in matrix 'm' by scalar value 's'. More... | |
int | zsl_mtx_scalar_mult_row_d (struct zsl_mtx *m, size_t i, zsl_real_t s) |
Multiplies the elements of row 'i' in matrix 'm' by scalar 's'. More... | |
Basic mathematical operations for matrices (add, substract, etc.).
Adds matrices 'ma' and 'mb', assigning the output to 'mc'. Matrices 'ma', 'mb' and 'mc' must all be identically shaped.
ma | Pointer to the first input zsl_mtx. |
mb | Pointer to the second input zsl_mtx. |
mc | Pointer to the output zsl_mtx. |
Definition at line 375 of file matrices.c.
Referenced by zsl_mtx_householder().
Adds matrices 'ma' and 'mb', assigning the output to 'ma'. Matrices 'ma', and 'mb' must be identically shaped.
ma | Pointer to the first input zsl_mtx. This matrix will be overwritten with the results of the addition operations! |
mb | Pointer to the second input zsl_mtx. |
Definition at line 381 of file matrices.c.
Referenced by zsl_mtx_eigenvectors().
Multiplies matrix 'ma' by 'mb', assigning the output to 'mc'. Matrices 'ma' and 'mb' must be compatibly shaped, meaning that 'ma' must have the same numbers of columns as there are rows in 'mb'.
ma | Pointer to the first input zsl_mtx. |
mb | Pointer to the second input zsl_mtx. |
mc | Pointer to the output zsl_mtx. |
Definition at line 434 of file matrices.c.
Referenced by zsl_mtx_householder(), zsl_mtx_mult_d(), zsl_mtx_pinv(), zsl_mtx_qrd(), zsl_mtx_qrd_iter(), zsl_mtx_svd(), zsl_mtx_vec_wedge(), zsl_sta_mult_linear_reg(), zsl_sta_quad_fit(), and zsl_sta_weighted_mult_linear_reg().
Multiplies matrix 'ma' by 'mb', assigning the output to 'ma'. Matrices 'ma' and 'mb' must be compatibly shaped, meaning that 'ma' must have the same numbers of columns as there are rows in 'mb'. To use this function, 'mb' must be a square matrix. This function is destructive.
Definition at line 468 of file matrices.c.
int zsl_mtx_scalar_mult_d | ( | struct zsl_mtx * | m, |
zsl_real_t | s | ||
) |
Multiplies all elements in matrix 'm' by scalar value 's'.
m | Pointer to the zsl_mtz to adjust. |
s | The scalar value to multiply elements in matrix 'm' with. |
Definition at line 488 of file matrices.c.
Referenced by zsl_mtx_eigenvectors(), zsl_mtx_householder(), zsl_mtx_inv_3x3(), and zsl_mtx_svd().
int zsl_mtx_scalar_mult_row_d | ( | struct zsl_mtx * | m, |
size_t | i, | ||
zsl_real_t | s | ||
) |
Multiplies the elements of row 'i' in matrix 'm' by scalar 's'.
m | Pointer to the zsl_mtx to use. |
i | The row number to multiply by scalar 's' (0-based). |
s | The scalar to use when multiplying elements of row 'i'. |
Definition at line 498 of file matrices.c.
Referenced by zsl_mtx_norm_elem(), and zsl_sta_weighted_mult_linear_reg().
Subtracts matrices 'mb' from 'ma', assigning the output to 'mc'. Matrices 'ma', 'mb' and 'mc' must all be identically shaped.
ma | Pointer to the first input zsl_mtx. |
mb | Pointer to the second input zsl_mtx. |
mc | Pointer to the output zsl_mtx. |
Definition at line 422 of file matrices.c.
Referenced by zsl_sta_mult_linear_reg(), and zsl_sta_weighted_mult_linear_reg().
Subtracts matrix 'mb' from 'ma', assigning the output to 'ma'. Matrices 'ma', and 'mb' must be identically shaped.
ma | Pointer to the first input zsl_mtx. This matrix will be overwritten with the results of the subtraction operations! |
mb | Pointer to the second input zsl_mtx. |
Definition at line 428 of file matrices.c.
int zsl_mtx_sum_rows_d | ( | struct zsl_mtx * | m, |
size_t | i, | ||
size_t | j | ||
) |
Adds the values of row 'j' to row 'i' in matrix 'm'. This operation is destructive for row 'i'.
m | Pointer to the zsl_mtx to use. |
i | The first row number to add (0-based). |
j | The second row number to add (0-based). |
Definition at line 387 of file matrices.c.
Referenced by zsl_mtx_gauss_reduc().
int zsl_mtx_sum_rows_scaled_d | ( | struct zsl_mtx * | m, |
size_t | i, | ||
size_t | j, | ||
zsl_real_t | s | ||
) |
This function takes the coefficients of row 'j' and multiplies them by scalar 's', then adds the resulting coefficient to the parallel element in row 'i'. Row 'i' will be modified in this operation.
This function implements a key mechanism of Gauss–Jordan elimination, as can be seen in zsl_mtx_gauss_elim.
m | Pointer to the zsl_mtx to use. |
i | The row number to update (0-based). |
j | The row number to scale and then add to 'i' (0-based). |
s | The scalar value to apply to the values in row 'j'. |
Definition at line 403 of file matrices.c.
Referenced by zsl_mtx_gauss_elim().