Zephyr Scientific Library (zscilib)
Functions
Initialisation

Vector initisialisation. More...

Functions

int zsl_vec_init (struct zsl_vec *v)
 
int zsl_vec_from_arr (struct zsl_vec *v, zsl_real_t *a)
 Converts an array of values into a vector. The number of elements in array 'a' must match the number of elements in vector 'v'. As such, 'v' should be previously initialised with an appropriate value assigned to v.sz. More...
 
int zsl_vec_copy (struct zsl_vec *vdest, struct zsl_vec *vsrc)
 Copies the contents of vector 'vsrc' into vector 'vdest'. More...
 

Detailed Description

Vector initisialisation.

Function Documentation

◆ zsl_vec_copy()

int zsl_vec_copy ( struct zsl_vec vdest,
struct zsl_vec vsrc 
)

Copies the contents of vector 'vsrc' into vector 'vdest'.

Parameters
vdestPointer to the destination vector data will be copied to.
vsrcPointer to the source vector data will be copied from.
Returns
0 on success, and non-zero error code on failure

Definition at line 33 of file vectors.c.

Referenced by zsl_mtx_householder(), zsl_sta_demean(), and zsl_vec_project().

◆ zsl_vec_from_arr()

int zsl_vec_from_arr ( struct zsl_vec v,
zsl_real_t a 
)

Converts an array of values into a vector. The number of elements in array 'a' must match the number of elements in vector 'v'. As such, 'v' should be previously initialised with an appropriate value assigned to v.sz.

Parameters
vThe vector that the contents of array 'a' should be assigned to. The v.sz value must match the number of elements in 'a', meaning that the vector should be initialised before being passed in to this function.
aPointer to the array containing the values to assign to 'v'. The array will be read v.sz elements deep.
Returns
0 on success, and non-zero error code on failure

Definition at line 26 of file vectors.c.

Referenced by zsl_mtx_svd(), zsl_mtx_vec_wedge(), zsl_sta_mult_linear_reg(), zsl_sta_quad_fit(), and zsl_sta_weighted_mult_linear_reg().

◆ zsl_vec_init()

int zsl_vec_init ( struct zsl_vec v)

Initialises vector 'v' with 0.0 values.

Parameters
vPointer to the zsl_vec to initialise/clear.
Returns
0 on success, and non-zero error code on failure

Definition at line 19 of file vectors.c.

Referenced by zsl_mtx_eigenvalues(), zsl_mtx_eigenvectors(), zsl_mtx_gram_schmidt(), zsl_mtx_householder(), zsl_sta_mode(), zsl_sta_percentile(), zsl_sta_trim_mean(), zsl_sta_weighted_median(), zsl_vec_sort(), and zsl_vec_to_unit().