Vector operations - GNU Scientific Library -- Reference Manual
Description: GNU Scientific Library -- Reference Manual

Next: Finding maximum and minimum elements of vectors, Previous: Exchanging elements, Up: Vectors

#### 8.3.8 Vector operations

— Function: int gsl_vector_add (gsl_vector * a, const gsl_vector * b)

> This function adds the elements of vector b to the elements of vector a, a'_i = a_i + b_i. The two vectors must have the same length.

— Function: int gsl_vector_sub (gsl_vector * a, const gsl_vector * b)

> This function subtracts the elements of vector b from the elements of vector a, a'_i = a_i - b_i. The two vectors must have the same length.

— Function: int gsl_vector_mul (gsl_vector * a, const gsl_vector * b)

> This function multiplies the elements of vector a by the elements of vector b, a'_i = a_i * b_i. The two vectors must have the same length.

— Function: int gsl_vector_div (gsl_vector * a, const gsl_vector * b)

> This function divides the elements of vector a by the elements of vector b, a'_i = a_i / b_i. The two vectors must have the same length.

— Function: int gsl_vector_scale (gsl_vector * a, const double x)

> This function multiplies the elements of vector a by the constant factor x, a'_i = x a_i.

— Function: int gsl_vector_add_constant (gsl_vector * a, const double x)

> This function adds the constant value x to the elements of the vector a, a'_i = a_i + x.

The GNU Scientific Library - a free numerical library licensed under the GNU GPL
Back to the GNU Scientific Library Homepage