GNU Scientific Library – Reference Manual: Initializing vector elements

Next: Reading and writing vectors, Previous: Accessing vector elements, Up: Vectors [Index]

#### 8.3.3 Initializing vector elements

Function: void gsl_vector_set_all (gsl_vector * v, double x)

  This function sets all the elements of the vector v to the value x.

Function: void gsl_vector_set_zero (gsl_vector * v)

  This function sets all the elements of the vector v to zero.

Function: int gsl_vector_set_basis (gsl_vector * v, size_t i)

  This function makes a basis vector by setting all the elements of the vector v to zero except for the i-th element which is set to one.