Go to the first, previous, next, last section, table of contents.

Vector operations

The following operations are only defined for real vectors.

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, @math{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, @math{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, @math{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, @math{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, @math{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, @math{a'_i = a_i + x}.


Go to the first, previous, next, last section, table of contents.