Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

Utilities Interface.
[libgnn]


Detailed Description

This module contains miscelaneous utilities, like vector operations not available in the original GSL specification, access to an application-wide random number generator, etc.

Defines

#define GNN_MIN(x, y)   ( ((x) < (y))? (x) : (y) )
 gets the minimum of two values.

#define GNN_MAX(x, y)   ( ((x) > (y))? (x) : (y) )
 gets the maximum of two values.

#define GNN_SIGN(x)   ( ((x) > 0)? 1 : -1 )
 gets the sign of a value.

#define GNN_SHIFT2(a, b, c)   (a)=(b);(b)=(c);
 shifts two to the left.

#define GNN_SHIFT3(a, b, c, d)   (a)=(b);(b)=(c);(c)=(d);
 shifts three to the left.

#define GNN_USE_SIGN(a, b)   ( (b) >= 0.0 ? fabs(a) : -fabs(a) )
 use b's sign for a.


Functions

gsl_rng * gnn_get_rng ()
 Get the global random number generator.

int gnn_vector_resize (gsl_vector **vector, int new_size)
 Resize a vector.

int gnn_vector_sum_elements (gsl_vector *v)
 Compute the sum of the vector's elements.

double gnn_vector_euclidian_dist (const gsl_vector *v, const gsl_vector *u)
 Compute the euclidian distance between to vectors.

int gnn_matrix_check_sizes_from_stream (FILE *stream, size_t *m, size_t *n)
 Compute matrix size from a stream.

gsl_vector * gnn_vector_load (const char *filename)
 Load a vector from a file.

int gnn_vector_save (const char *filename, gsl_vector *v)
 Saves a vector to a file.

gsl_matrix * gnn_matrix_load (const char *filename)
 Load a matrix from a file.

int gnn_matrix_save (const char *filename, gsl_matrix *A)
 Saves a matrix to a file.


Define Documentation

#define GNN_MAX x,
     ( ((x) > (y))? (x) : (y) )
 

Definition at line 50 of file gnn_utilities.h.

#define GNN_MIN x,
     ( ((x) < (y))? (x) : (y) )
 

Definition at line 44 of file gnn_utilities.h.

#define GNN_SHIFT2 a,
b,
     (a)=(b);(b)=(c);
 

Definition at line 62 of file gnn_utilities.h.

#define GNN_SHIFT3 a,
b,
c,
     (a)=(b);(b)=(c);(c)=(d);
 

Definition at line 68 of file gnn_utilities.h.

#define GNN_SIGN      ( ((x) > 0)? 1 : -1 )
 

Definition at line 56 of file gnn_utilities.h.

#define GNN_USE_SIGN a,
     ( (b) >= 0.0 ? fabs(a) : -fabs(a) )
 

Definition at line 74 of file gnn_utilities.h.


Function Documentation

gsl_rng* gnn_get_rng  
 

This function returns a pointer to an application-wide GSL random number generator. It allocates a new one if not defined yet.

The type of the random number generator is given by the constant libgnn Global Definitions..

Note: This function is not thread safe.

Returns:
A pointer to the random number generator.

Definition at line 69 of file gnn_utilities.c.

int gnn_matrix_check_sizes_from_stream FILE *    stream,
size_t *    m,
size_t *    n
 

Todo:
Make this function check for the integrity of the matrix.

This function reads a stream until it reaches EOF, and makes an estimation of the contained matrix size.

Parameters:
stream  A file stream.
m  A pointer to the variable to store the number of rows.
n  A pointer to the variable to store the number of columns.
Returns:
Returns 0 if succeeded.

Definition at line 201 of file gnn_utilities.c.

gsl_matrix* gnn_matrix_load const char *    filename
 

This function loads a matrix from a file. It creates a gsl_matrix of the correct size.

Parameters:
filename  The file name from where the matrix should be loaded.
Returns:
A pointer to a new gsl_matrix.

Definition at line 321 of file gnn_utilities.c.

int gnn_matrix_save const char *    filename,
gsl_matrix *    A
 

This function saves a matrix to a file.

Parameters:
filename  The file name from where the matrix should be loaded.
A  A gsl_matrix which should be saved.
Returns:
Returns 0 if suceeded.

Definition at line 369 of file gnn_utilities.c.

double gnn_vector_euclidian_dist const gsl_vector *    v,
const gsl_vector *    u
 

This function computes the euclidian distance between to vectors, given by:

Parameters:
v  A pointer to a vector of size .
u  A pointer to a vector of size .
Returns:
Returns the distance.

Definition at line 172 of file gnn_utilities.c.

gsl_vector* gnn_vector_load const char *    filename
 

This function loads a vector from a file. It creates a gsl_vector of the correct size.

Parameters:
filename  The file name from where the vector should be loaded.
Returns:
A pointer to a new gsl_vector.

Definition at line 248 of file gnn_utilities.c.

int gnn_vector_resize gsl_vector **    vector,
int    new_size
 

This function resizes a vector and tries to preserve all posible values, i.e.

where is the vector before and is the vector after resizing, and .

Parameters:
vector  A vector.
new_size  The new size ( in the explanation above).
Returns:
Returns 0 if succeeded.

Definition at line 98 of file gnn_utilities.c.

int gnn_vector_save const char *    filename,
gsl_vector *    v
 

This function saves a vector to a file.

Parameters:
filename  The file name from where the vector should be loaded.
A  A gsl_vector which should be saved.
Returns:
Returns 0 if suceeded.

Definition at line 296 of file gnn_utilities.c.

int gnn_vector_sum_elements gsl_vector *    v
 

This function computes the sum of the vector's elements, that is:

Parameters:
v  A pointer to a vector of size .
Returns:
Returns the sum of its elements.

Definition at line 150 of file gnn_utilities.c.


Generated on Sun Jun 13 20:51:43 2004 for libgnn Gradient Retropropagation Machine Library by doxygen1.2.18