Zephyr Scientific Library (zscilib)
Functions
Data Access

Functions used to access or modify matrix rows, columns or coefficients. More...

Functions

int zsl_mtx_get (struct zsl_mtx *m, size_t i, size_t j, zsl_real_t *x)
 Gets a single value from the specified row (i) and column (j). More...
 
int zsl_mtx_set (struct zsl_mtx *m, size_t i, size_t j, zsl_real_t x)
 Sets a single value at the specified row (i) and column (j). More...
 
int zsl_mtx_get_row (struct zsl_mtx *m, size_t i, zsl_real_t *v)
 Gets the contents of row 'i' from matrix 'm', assigning the array of data to 'v'. More...
 
int zsl_mtx_set_row (struct zsl_mtx *m, size_t i, zsl_real_t *v)
 Sets the contents of row 'i' in matrix 'm', assigning the values found in array 'v'. More...
 
int zsl_mtx_get_col (struct zsl_mtx *m, size_t j, zsl_real_t *v)
 Gets the contents of column 'j' from matrix 'm', assigning the array of data to 'v'. More...
 
int zsl_mtx_set_col (struct zsl_mtx *m, size_t j, zsl_real_t *v)
 Sets the contents of column 'j' in matrix 'm', assigning the values found in array 'v'. More...
 

Detailed Description

Functions used to access or modify matrix rows, columns or coefficients.

Function Documentation

◆ zsl_mtx_get()

int zsl_mtx_get ( struct zsl_mtx m,
size_t  i,
size_t  j,
zsl_real_t x 
)

Gets a single value from the specified row (i) and column (j).

Parameters
mPointer to the zsl_mtx to use.
iThe row number to read (0-based).
jThe column number to read (0-based).
xPointer to where the value should be stored.
Returns
0 if everything executed correctly, or -EINVAL on an out of bounds error.

Definition at line 99 of file matrices.c.

Referenced by zsl_mtx_augm_diag(), zsl_mtx_cholesky(), zsl_mtx_deter(), zsl_mtx_eigenvalues(), zsl_mtx_eigenvectors(), zsl_mtx_gauss_elim(), zsl_mtx_gauss_reduc(), zsl_mtx_get_col(), zsl_mtx_get_row(), zsl_mtx_is_sym(), zsl_mtx_norm_elem(), zsl_mtx_pinv(), zsl_mtx_print(), zsl_mtx_reduce(), and zsl_mtx_svd().

◆ zsl_mtx_get_col()

int zsl_mtx_get_col ( struct zsl_mtx m,
size_t  j,
zsl_real_t v 
)

Gets the contents of column 'j' from matrix 'm', assigning the array of data to 'v'.

Parameters
mPointer to the zsl_mtx to use.
jThe column number to read (0-based).
vPointer to the array where the column vector should be written. Must be at least m->sz_rows elements long!
Returns
0 if everything executed correctly, otherwise an appropriate error code.

Definition at line 159 of file matrices.c.

Referenced by zsl_mtx_cols_norm(), zsl_mtx_eigenvectors(), zsl_mtx_gauss_reduc(), zsl_mtx_gram_schmidt(), zsl_mtx_householder(), zsl_mtx_svd(), zsl_sta_covar_mtx(), zsl_sta_mult_linear_reg(), and zsl_sta_weighted_mult_linear_reg().

◆ zsl_mtx_get_row()

int zsl_mtx_get_row ( struct zsl_mtx m,
size_t  i,
zsl_real_t v 
)

Gets the contents of row 'i' from matrix 'm', assigning the array of data to 'v'.

Parameters
mPointer to the zsl_mtx to use.
iThe row number to read (0-based).
vPointer to the array where the row vector should be written. Must be at least m->sz_cols elements long!
Returns
0 if everything executed correctly, otherwise an appropriate error code.

Definition at line 127 of file matrices.c.

Referenced by zsl_mtx_trans(), zsl_mtx_vec_wedge(), and zsl_sta_quad_fit().

◆ zsl_mtx_set()

int zsl_mtx_set ( struct zsl_mtx m,
size_t  i,
size_t  j,
zsl_real_t  x 
)

Sets a single value at the specified row (i) and column (j).

Parameters
mPointer to the zsl_mtx to use.
iThe row number to update (0-based).
jThe column number to update (0-based).
xThe value to assign.
Returns
0 if everything executed correctly, or -EINVAL on an out of bounds error.

Definition at line 113 of file matrices.c.

Referenced by zsl_mtx_adjoint(), zsl_mtx_augm_diag(), zsl_mtx_cholesky(), zsl_mtx_eigenvectors(), zsl_mtx_entry_fn_empty(), zsl_mtx_entry_fn_identity(), zsl_mtx_entry_fn_random(), zsl_mtx_pinv(), zsl_mtx_set_col(), zsl_mtx_set_row(), and zsl_mtx_svd().

◆ zsl_mtx_set_col()

int zsl_mtx_set_col ( struct zsl_mtx m,
size_t  j,
zsl_real_t v 
)

Sets the contents of column 'j' in matrix 'm', assigning the values found in array 'v'.

Parameters
mPointer to the zsl_mtx to use.
jThe column number to write to (0-based).
vPointer to the array where the column vector data is stored. Must be at least m->sz_rows elements long!
Returns
0 if everything executed correctly, otherwise an appropriate error code.

Definition at line 176 of file matrices.c.

Referenced by zsl_mtx_cols_norm(), zsl_mtx_eigenvectors(), zsl_mtx_gram_schmidt(), zsl_mtx_svd(), zsl_mtx_trans(), zsl_sta_mult_linear_reg(), and zsl_sta_weighted_mult_linear_reg().

◆ zsl_mtx_set_row()

int zsl_mtx_set_row ( struct zsl_mtx m,
size_t  i,
zsl_real_t v 
)

Sets the contents of row 'i' in matrix 'm', assigning the values found in array 'v'.

Parameters
mPointer to the zsl_mtx to use.
iThe row number to write to (0-based).
vPointer to the array where the row vector data is stored. Must be at least m->sz_cols elements long!
Returns
0 if everything executed correctly, otherwise an appropriate error code.

Definition at line 144 of file matrices.c.

Referenced by zsl_mtx_vec_wedge(), and zsl_sta_quad_fit().