gsl

Package Contents

gsl.zero(entity)

Zero out the content of {entity}

gsl.fill(entity, value)

Set all entries in {entity} to {value}

gsl.msg = could not load the 'gsl' extension module
gsl.package
gsl.version
gsl.copyright
gsl.license()
class gsl.histogram(bins, data=None, **kwds)

A wrapper over a gsl histogram

bins = 0
data
uniform(self, lower, upper)

Adjust the histogram bins to cover the range [lower, upper) uniformly. The values of the bins are reset to zero

ranges(self, points)

Use {points} to define the histogram bins. {points} is expected to be an iterable of size one greater than the size of the histogram itself; the extra element is used to specify the upper value of the last bin. The entries in {points} must be monotonically increasing

reset(self)

Reset the values of all the bins to zero

increment(self, x)

Increment by one the bin whose range contains {x}

accumulate(self, x, weight)

Add {weight} to the bin whose range contains {x}

fill(self, values)

Increment my frequency counts using the contents of the vector {values}

clone(self)

Allocate a new histogram and initialize it using my values

copy(self, other)

Make me an exact copy of {other}

values(self)

Return a vector that contains the values from each of my bins. This is equivalent to

v = gsl.vector.alloc(shape=self.bins) for i in range(self.bins):

v[i] = self[i]

return v

find(self, x)

Return the index of the bin that contains the value {x}

max(self)

Return my maximum upper range

min(self)

Return my minimum lower range

range(self, i)

Return a tuple [lower, upper) that describes the range of the {i}th bin

max_bin(self)

Return the index of the bin where maximum value is contained in the histogram

max_value(self)

Return the maximum value contained in the histogram

min_bin(self)

Return the index of the bin where minimum value is contained in the histogram

min_value(self)

Return the minimum value contained in the histogram

mean(self)

Return the mean of the histogrammed variable

sdev(self)

Return the standard deviation of the histogrammed variable

sum(self)

Return the sum of all bin values

__len__(self)
__iter__(self)
__getitem__(self, index)
__iadd__(self, other)

In-place addition with the elements of {other}

__isub__(self, other)

In-place subtraction with the elements of {other}

__imul__(self, other)

In-place multiplication with the elements of {other}

__itruediv__(self, other)

In-place addition with the elements of {other}

class gsl.matrix(shape, data=None, **kwds)

A wrapper over a gsl matrix

defaultFormat = +16.7
upperTriangular = 1
lowerTriangular = 0
unitDiagonal = 1
nonUnitDiagonal = 0
opNoTrans = 0
opTrans = 1
opConjTrans = 2
sideRight = 1
sideLeft = 0
sortValueAscending = 0
sortValueDescending = 1
sortMagnitudeAscending = 2
sortMagnitudeDescending = 3
data
shape = [0, 0]
excerpt(self, communicator=None, source=0, matrix=None)

Scatter {matrix} held by the task {source} among all tasks in {communicator} and fill me with the partition values. Only {source} has to provide a {matrix}; the other tasks can use the default value.

zero(self)

Set all my elements to zero

fill(self, value)

Set all my elements to {value}

view(self, start, shape)

Build a view to my data anchored at {start} with the given {shape}

load(self, filename, binary=None)

Read my values from {filename}

This method attempts to distinguish between text and binary representations of the data, based on the parameter {mode}, or the {filename} extension if {mode} is absent

save(self, filename, binary=None, format=defaultFormat)

Write my values to {filename}

This method attempts to distinguish between text and binary representations of the data, based on the parameter {mode}, or the {filename} extension if {mode} is absent

read(self, filename)

Read my values from {filename}

write(self, filename)

Write my values to {filename}

scanf(self, filename)

Read my values from {filename}

printf(self, filename, format=defaultFormat)

Write my values to {filename}

print(self, format='{:+13.4e}', indent='', interactive=True)

Print my values using the given {format}

identity(self)

Initialize me as an identity matrix: all elements are set to zero except along the diagonal, which are set to one

random(self, pdf)

Fill me with random numbers using the probability distribution {pdf}

clone(self)

Allocate a new matrix and initialize it using my values

copy(self, other)

Fill me with values from {other}, which is assumed to be of compatible shape

tuple(self)

Build a representation of my contents as a tuple of tuples

This is suitable for converting to other matrix representations, such as numpy

transpose(self, destination=None)

Compute the transpose of a matrix.

If {destination} is {None} and the matrix is square, the operation happens in-place. Otherwise, the transpose is stored in {destination}, which is assumed to be shaped correctly.

getRow(self, index)

Return a view to the requested row

getColumn(self, index)

Return a view to the requested column

setRow(self, index, v)

Set the row at {index} to the contents of the given vector {v}

setColumn(self, index, v)

Set the column at {index} to the contents of the given vector {v}

max(self)

Compute my maximum value

min(self)

Compute my maximum value

minmax(self)

Compute my minimum and maximum values

symmetricEigensystem(self, order=sortValueAscending)

Computed my eigenvalues and eigenvectors assuming i am a real symmetric matrix

mean(self, axis=None, out=None)

Compute the mean values of a matrix axis = None, 0, or 1, along which the mean are computed

mean_sd(self, axis=None, out=None, sample=True)

Compute the mean values of matrix axis: int or None

axis along which the means are computed. None for all elements
out: tuple of two vectors (mean, sd)
vector size is 1 (axis=None), columns(axis=0), rows(axis=1)
sample: True or False
when True, the sample standard deviation is computed 1/(N-1) when False, the population standard deviation is computed 1/N
std(self, axis=None, sample=False)

Compute the standard deviation of a matrix

ndarray(self, copy=False)

Return a numpy array reference (w/ shared data) if {copy} is False, or a new copy if {copy} is {True}

__iter__(self)

Iterate over all my elements in shape order

__contains__(self, value)
__getitem__(self, index)
__setitem__(self, index, value)
__eq__(self, other)
__ne__(self, other)
__iadd__(self, other)

In-place addition with the elements of {other}

__isub__(self, other)

In-place subtraction with the elements of {other}

__imul__(self, other)

In-place multiplication with the elements of {other}

__itruediv__(self, other)

In-place addition with the elements of {other}

class gsl.permutation(shape, data=None, **kwds)

A wrapper over a gsl permutation

data
shape
init(self)

Initialize a permutation

clone(self)

Allocate a new permutation and initialize it using my values

reverse(self)

Reverse me

inverse(self)

Reverse me

swap(self, other)

Swap me with {other}

size(self)

Compute my size

next(self)

Compute the next permutation in my sequence

prev(self)

Compute the prev permutation in my sequence

__bool__(self)
__len__(self)
__iter__(self)
__getitem__(self, index)
class gsl.rng(algorithm='ranlxs2', **kwds)

Encapsulation of the pseudo-random number generators in GSL

available
rng
float(self)

Return a random float in the range [0, 1)

int(self)

Return a random integer within the range of the generator

seed(self, seed=0)

Initialize the RNG with the given seed

class gsl.vector(shape, data=None, **kwds)

A wrapper over a gsl vector

defaultFormat = +16.7
data
excerpt(self, communicator=None, source=0, vector=None)

Scatter {vector} held by the task {source} among all tasks in {communicator} and fill me with the partition values. Only {source} has to provide a {vector}; the other tasks can use the default value.

zero(self)

Set all my elements to zero

fill(self, value)

Set all my elements to {value}

basis(self, index)

Initialize me as a basis vector: all elements are set to zero except {index}, which is set to one

random(self, pdf)

Fill me with random numbers using the probability distribution {pdf}

clone(self)

Allocate a new vector and initialize it using my values

copy(self, other)

Fill me with values from {other}, which is assumed to be of compatible shape

tuple(self)

Build a representation of my contents as a tuple

view(self, start, shape)

Build a view of my from {start} to {start+shape}

load(self, filename, binary=None)

Read my values from {filename}

This method attempts to distinguish between text and binary representations of the data, based on the parameter {mode}, or the {filename} extension if {mode} is absent

save(self, filename, binary=None, format=defaultFormat)

Write my values to {filename}

This method attempts to distinguish between text and binary representations of the data, based on the parameter {mode}, or the {filename} extension if {mode} is absent

read(self, filename)

Read my values from {filename}

write(self, filename)

Write my values to {filename}

scanf(self, filename)

Read my values from {filename}

printf(self, filename, format=defaultFormat)

Write my values to {filename}

print(self, format='{:+13.4e}', indent='', interactive=True)

Print my values using the given {format}

max(self)

Compute my maximum value

min(self)

Compute my maximum value

minmax(self)

Compute my minimum and maximum values

sort(self)

In-place sort of the elements of a vector

sortIndirect(self)

Construct the permutation that would sort me in ascending order

shuffle(self, rng)

Shuffle the elements :param rng: gsl.rng handle :return: self

mean(self, weights=None)

Compute the mean value of my elements, weighted by the optional {weights}

median(self)

Compute the median value of my elements; only works on previously sorted vectors

variance(self, mean=None)

Compute the variance of my elements with respect to {mean}. If {mean} is {None}, it is computed on the fly

sdev(self, mean=None)

Compute the mean value of my elements with respect to {mean}. If {mean} is {None}, it is computed on the fly

ndarray(self, copy=False)

Return a numpy array reference (w/ shared data) if {copy} is False, or a new copy if {copy} is {True}

__len__(self)
__iter__(self)
__contains__(self, value)
__getitem__(self, index)
__setitem__(self, index, value)
__eq__(self, other)
__ne__(self, other)
__iadd__(self, other)

In-place addition with the elements of {other}

__isub__(self, other)

In-place subtraction with the elements of {other}

__imul__(self, other)

In-place multiplication with the elements of {other}

__itruediv__(self, other)

In-place addition with the elements of {other}

_slice(self, index)

Build a generator that yields the values described in the {index}