Here is a list of all the functions included in this module :
gsl_vector_alloc($x)
Create a vector of size $x
gsl_vector_calloc($x)
Create a vector of size $x and initializes all the elements of the vector to zero
"gsl_vector_alloc_from_block"
"gsl_vector_alloc_from_vector"
gsl_vector_free($v)
Free a previously allocated vector $v
"gsl_vector_view_array($base, $n)"
This function returns a vector view of an array reference $base. The start of the new vector is given by
$base and has $n elements. Mathematically, the i-th element of the new vector v' is given by, v'(i) =
$base->[i] where the index i runs from 0 to $n-1. The array containing the elements of v is not owned by
the new vector view. When the view goes out of scope the original array will continue to exist. The
original memory can only be deallocated by freeing the original pointer base. Of course, the original
array should not be deallocated while the view is still in use.
"gsl_vector_const_view_array($base, $n)"
This function is equivalent to gsl_vector_view_array but can be used for arrays which are declared
const.
"gsl_vector_view_array_with_stride($base, $stride, $n)"
This function returns a vector view of an array reference $base with an additional $stride argument. The
subvector is formed in the same way as for gsl_vector_view_array but the new vector has $n elements with
a step-size of $stride from one element to the next in the original array. Mathematically, the i-th
element of the new vector v' is given by, v'(i) = $base->[i*$stride] where the index i runs from 0 to
$n-1. Note that the view gives direct access to the underlying elements of the original array. A vector
view $view can be passed to any subroutine which takes a vector argument just as a directly allocated
vector would be, using $view->{vector}.
"gsl_vector_const_view_array_with_stride($base, $stride, $n)"
This function is equivalent to gsl_vector_view_array_with_stride but can be used for arrays which are
declared const.
"gsl_vector_subvector($v, $offset, $n)"
Return a vector_view type which contains a subvector of $v, with a size of $size, starting from the
$offset position
"gsl_vector_subvector_with_stride($v, $offset, $stride, $size)"
Return a vector_view type which contains a subvector of $v, with a size of $size, starting from the
$offset position and with a $stride step between each element of $v
"gsl_vector_const_subvector"
"gsl_vector_get($v, $i)"
Return the $i-th element of a raw vector $v, where $v is a Math::GSL::Vector object. For example:
my $third_element = gsl_vector_get($v->raw, 3);
"gsl_vector_set($v, $i, $x)"
Return the vector $v with his $i-th element set to $x
"gsl_vector_ptr"
"gsl_vector_const_ptr"
gsl_vector_set_zero($v)
set all the elements of $v to 0
"gsl_vector_set_all($v, $x)"
set all the elements of $v to $x
"gsl_vector_set_basis($v, $i)"
set all the elements of $v to 0 except for the $i-th element which is set to 1 and return 0 if the
operation succeeded, 1 otherwise.
"gsl_vector_fread($file, $v)"
This function reads into the vector $v from the open stream $file opened with gsl_fopen function from
the Math::GSL module in binary format. The vector $v must be preallocated with the correct length since
the function uses the size of $v to determine how many bytes to read. The return value is 0 for success
and 1 if there was a problem reading from the file.
"gsl_vector_fwrite($file, $v)"
This function writes the elements of the vector $v to the stream $file opened with gsl_fopen function
from the Math::GSL module in binary format. The return value is 0 for success and 1 if there was a
problem writing to the file. Since the data is written in the native binary format it may not be
portable between different architectures.
"gsl_vector_fscanf($file, $v)"
This function reads formatted data from the stream $file opened with gsl_fopen function from the
Math::GSL module into the vector $v. The vector $v must be preallocated with the correct length since
the function uses the size of $v to determine how many numbers to read. The function returns 0 for
success and 1 if there was a problem reading from the file.
"gsl_vector_fprintf($file, $v, $format)"
This function writes the elements of the vector $v line-by-line to the stream $file opened with
gsl_fopen function from the Math::GSL module using the format specifier $format, which should be one of
the "%g", "%e" or "%f" formats for floating point numbers and "%d" for integers. The function returns 0
for success and 1 if there was a problem writing to the file.
"gsl_vector_memcpy($dest, $src)"
This function copies the elements of the vector $src into the vector $dest and return 0 if the operation
succeeded, 1 otherwise. The two vectors must have the same length.
gsl_vector_reverse($v)
reverse the order of the elements of the vector $v and return 0 if the operation succeeded, 1 otherwise
"gsl_vector_swap($v, $v2)"
swap the values of the vectors $v and $v2 and return 0 if the operation succeeded, 1 otherwise
"gsl_vector_swap_elements($v, $i, $j)"
permute the elements at position $i and $j in the vector $v and return 0 if the operation succeeded, 1
otherwise.
gsl_vector_max($v)
return the maximum value in the vector $v
gsl_vector_min($v)
return the minimum value in the vector $v
gsl_vector_minmax($v)
return two values, the first is the minimum value in the vector $v and the second is the maximum value.
gsl_vector_max_index($v)
return the position of the maximum value in the vector $v
gsl_vector_min_index($v)
return the position of the minimum value in the vector $v
"gsl_vector_minmax_index"
return two values, the first is the position of the minimum value in the vector $v and the second is the
position of the maximum value.
"gsl_vector_add($v, $v2)"
add the elements of $v2 to the elements of $v, the two vectors must have the same length and return 0 if
the operation succeeded, 1 otherwise.
"gsl_vector_sub($v, $v2)"
subtract the elements of $v2 from the elements of $v, the two vectors must have the same length and
return 0 if the operation succeeded, 1 otherwise.
"gsl_vector_mul($v, $v2)"
multiply the elements of $v by the elements of $v2, the two vectors must have the same length and return
0 if the operation succeeded, 1 otherwise.
"gsl_vector_div($v, $v2)"
divides the elements of $v by the elements of $v2, the two vectors must have the same length and return
0 if the operation succeeded, 1 otherwise.
"gsl_vector_scale($v, $x)"
multiplty the elements of the vector $v by a constant $x and return 0 if the operation succeeded, 1
otherwise.
"gsl_vector_add_constant($v, $x)"
add a constant $x to the elements of the vector $v and return 0 if the operation succeeded, 1 otherwise.
gsl_vector_isnull($v)
verify if all the elements of the vector $v are null, return 0 if it's the case, 1 otherwise.
gsl_vector_ispos($v)
verify if all the elements of the vector $v are positive, return 0 if it's the case, 1 otherwise.
gsl_vector_isneg($v)
verify if all the elements of the vector $v are negative, return 0 if it's the case, 1 otherwise.
gsl_vector_isnonneg($v)
verify if all the elements the vector $v are not negative, return 0 if it's the case, 1 otherwise.
Precision on the vector_view type : every modification you'll make on a vector_view will also modify the
original vector. For example, the following code will zero the even elements of the vector $v of length
$size, while leaving the odd elements untouched :
"$v_even= gsl_vector_subvector_with_stride ($v, 0, 2, $size/2);"
"gsl_vector_set_zero ($v_even->{vector});"
For more information on the functions, we refer you to the GSL official documentation:
<http://www.gnu.org/software/gsl/manual/html_node/>