The GSL-FFI-VECTOR module

The <gsl-vector*> type

<gsl-vector*> Type
Superclasses:

<c-struct>

Discussion:

A vector of double precision floating point numbers.

Slots:

Allocation functions

gsl-vector-alloc Function
Signature:

gsl-vector-alloc (n) => (vector)

Parameters:
  • n – An instance of <c-size-t>.

Values:
  • vector – An instance of <gsl-vector*>.

Discussion:

Allocate an array of n elements in a block of memory.

gsl-vector-calloc Function
Signature:

gsl-vector-calloc (n) => (vector)

Parameters:
  • n – An instance of <c-size-t>.

Values:
  • vector – An instance of <gsl-vector*>.

Discussion:

Allocate an array of n elements in a block of memory and initialize all elements to zero.

gsl-vector-free Function
Signature:

gsl-vector-free (vector) => ()

Parameters:
  • vector – An instance of <gsl-vector*>.

Discussion:

Free the memory allocated for the vector.

gsl-vector-ptr Function
Signature:

gsl-vector-ptr (vector, i) => (value)

Parameters:
  • vector – An instance of <gsl-vector*>.

  • i – An instance of <c-size-t>.

Values:
  • value – An instance of <c-double>.

Discussion:

Return a pointer to the i-th element of the vector.

gsl-vector-const-ptr Function
Signature:

gsl-vector-const-ptr (vector, i) => (value)

Parameters:
  • vector – An instance of <gsl-vector*>.

  • i – An instance of <c-size-t>.

Values:
  • value – An instance of <c-double>.

Discussion:

Return a pointer to the i-th element of the vector.

Initializing vector elements

gsl-vector-set-all Function
Signature:

gsl-vector-set-all (vector, value) => ()

Parameters:
  • vector – An instance of <gsl-vector*>.

  • value – An instance of <c-double>.

Discussion:

Set all elements of the vector to the given value.

gsl-vector-set-zero Function
Signature:

gsl-vector-set-zero (vector) => ()

Parameters:
  • vector – An instance of <gsl-vector*>.

Discussion:

Set all elements of the vector to zero.

gsl-vector-set-basis Function
Signature:

gsl-vector-set-basis (vector, i) => (status)

Parameters:
  • vector – An instance of <gsl-vector*>.

  • i – An instance of <c-size-t>.

Values:
  • status – An instance of <c-int>.

Discussion:

Set all elements of the vector to zero except for the i-th element which is set to one.

Exchanging elements

gsl-vector-swap-elements Function
Signature:

gsl-vector-swap-elements (vector, i, j) => ()

Parameters:
  • vector – An instance of <gsl-vector*>.

  • i – An instance of <c-size-t>.

  • j – An instance of <c-size-t>.

Discussion:

Swap the i-th and j-th elements of the vector.

gsl-vector-reverse Function
Signature:

gsl-vector-reverse (vector) => ()

Parameters:
  • vector – An instance of <gsl-vector*>.

Discussion:

Reverse the order of the elements in the vector.

Vector operations

gsl-vector-add Function
Signature:

gsl-vector-add (a, b) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • b – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Add the elements of the vector b to the elements of the vector a.

gsl-vector-sub Function
Signature:

gsl-vector-sub (a, b) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • b – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Subtract the elements of the vector b from the elements of the vector a.

gsl-vector-mul Function
Signature:

gsl-vector-mul (a, b) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • b – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Multiply the elements of the vector b by the elements of the vector a.

gsl-vector-div Function
Signature:

gsl-vector-div (a, b) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • b – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Divide the elements of the vector b by the elements of the vector a.

gsl-vector-scale Function
Signature:

gsl-vector-scale (a, value) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • value – An instance of <c-double>.

Values:
  • value – An instance of <c-int>.

Discussion:

Scale the elements of the vector a by the given value.

gsl-vector-add-constant Function
Signature:

gsl-vector-add-constant (a, value) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • value – An instance of <c-double>.

Values:
  • value – An instance of <c-int>.

Discussion:

Add the given value to the elements of the vector a.

gsl-vector-sum Function
Signature:

gsl-vector-sum (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-double>.

Discussion:

Return the sum of the elements of the vector a.

gsl-vector-axpby Function
Signature:

gsl-vector-axpby (alpha, x, beta, y) => (value)

Parameters:
  • alpha – An instance of <c-double>.

  • x – An instance of <gsl-vector*>.

  • beta – An instance of <c-double>.

  • y – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Compute the linear combination of the vectors x and y, i.e.

Finding maximum and minimum elements

gsl-vector-max Function
Signature:

gsl-vector-max (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-double>.

Discussion:

Return the maximum element of the vector a.

gsl-vector-min Function
Signature:

gsl-vector-min (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-double>.

Discussion:

Return the minimum element of the vector a.

gsl-vector-max-index Function
Signature:

gsl-vector-max-index (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-size-t>.

Discussion:

Return the index of the maximum element of the vector a.

gsl-vector-min-index Function
Signature:

gsl-vector-min-index (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-size-t>.

Discussion:

Return the index of the minimum element of the vector a.

gsl-vector-max-index Function
Signature:

gsl-vector-max-index (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-size-t>.

Discussion:

Return the index of the maximum element of the vector a.

gsl-vector-min-index Function
Signature:

gsl-vector-min-index (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-size-t>.

Discussion:

Return the index of the minimum element of the vector a.

Vector properties

gsl-vector-equal Function
Signature:

gsl-vector-equal (a, b) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

  • b – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Return true if the vectors a and b are equal.

gsl-vector-isnull Function
Signature:

gsl-vector-isnull (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Return true if the vector a is null.

gsl-vector-ispos Function
Signature:

gsl-vector-ispos (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Return true if the vector a is positive.

gsl-vector-isneg Function
Signature:

gsl-vector-isneg (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Return true if the vector a is negative.

gsl-vector-isnonneg Function
Signature:

gsl-vector-isnonneg (a) => (value)

Parameters:
  • a – An instance of <gsl-vector*>.

Values:
  • value – An instance of <c-int>.

Discussion:

Return true if the vector a is non-negative.