GraphAlignment/src/GA_vector.c File Reference

Vector types implementation. More...

#include <stdlib.h>
#include <stdio.h>
#include "GA_message.h"
#include "GA_vector.h"

Functions

GAVectorIntGA_vector_create_int (int size)
GAVectorIntGA_vector_ref_int (GAVectorInt *vec)
void GA_vector_destroy_int (GAVectorInt *vec)
int * GA_vector_get_elt_int (GAVectorInt *vec, int index)
GAVectorIntGA_vector_init_from_array_int (GAVectorInt *vec, int *source, int srcSize)
GAVectorIntGA_vector_create_from_array_int (int *source, int srcSize)
GAVectorIntGA_vector_init_zero_int (GAVectorInt *vec)
GAVectorIntGA_vector_print_int (GAVectorInt *vec)
GAVectorIntGA_invert_permutation_int (GAVectorInt *vec)
GAVectorRealGA_vector_create_real (int size)
GAVectorRealGA_vector_ref_real (GAVectorReal *vec)
void GA_vector_destroy_real (GAVectorReal *vec)
double * GA_vector_get_elt_real (GAVectorReal *vec, int index)
GAVectorRealGA_vector_init_from_array_real (GAVectorReal *vec, double *source, int srcSize)
GAVectorRealGA_vector_create_from_array_real (double *source, int srcSize)
GAVectorRealGA_vector_init_zero_real (GAVectorReal *vec)
int GA_get_bin_number (double x, GAVectorReal *lookup, GAClampMode clamp)
GAVectorIntGA_vector_to_bin_real (GAVectorReal *vec, GAVectorReal *lookup, GAClampMode clamp)
GAVectorRealGA_vector_print_real (GAVectorReal *vec)


Detailed Description

Vector types implementation.


Function Documentation

int GA_get_bin_number ( double  x,
GAVectorReal lookup,
GAClampMode  clamp 
)

Get bin number.

Get the bin number for the argument using the specified lookup vector. If clamp is set to GA_CLAMP_ENABLED, values which are outside of the boundaries of the lookup range will be clamped to the bins at the end of the range. If clamp is set to GA_CLAMP_DISABLED, out-of-range values will be reported as errors.

Parameters:
x number which should be binned
lookup lookup vector
clamp clamp the result to the lookup range
Returns:
bin number, or -1 if an error occurs

GAVectorInt* GA_invert_permutation_int ( GAVectorInt vec  ) 

Invert permutation.

Invert the permutation defined by the specified vector. The result will be referenced and should be destroyed by using GA_vector_destroy_int() when it is not needed anymore.

Parameters:
vec vector
Returns:
inverse of the permutation

GAVectorInt* GA_vector_create_from_array_int ( int *  source,
int  srcSize 
)

Create vector from array (int).

Create a vector of integers from an array of integers. The new vector will be referenced and should be destroyed by using GA_vector_destroy_int() when it is not needed anymore.

Parameters:
source source array
srcSize size of source array
Returns:
new vector, or 0 if an error occurs

GAVectorReal* GA_vector_create_from_array_real ( double *  source,
int  srcSize 
)

Create vector from array (real).

Create a vector of real numbers from an array of real numbers. The new vector will be referenced and should be destroyed by using GA_vector_destroy_real() when it is not needed anymore.

Parameters:
source source array
srcSize size of source array
Returns:
new vector, or 0 if an error occurs

GAVectorInt* GA_vector_create_int ( int  size  ) 

Create vector (int).

Create a vector of integers. The new vector will be referenced and should be destroyed by using GA_vector_destroy_int() when it is not needed anymore.

Parameters:
size Number of elements.
Returns:
Pointer to a vector, or 0 if an error occurs.
See also:
GA_vector_destroy_int

GAVectorReal* GA_vector_create_real ( int  size  ) 

Create vector (real).

Create a vector of real numbers. The new vector will be referenced and should be destroyed by using GA_vector_destroy_int() when it is not needed anymore.

Parameters:
size Number of elements.
Returns:
Pointer to a vector, or 0 if an error occurs.
See also:
GA_vector_destroy_real

void GA_vector_destroy_int ( GAVectorInt vec  ) 

Destroy vector (int).

Remove a reference from a vector. If the reference count drops to zero, all resources allocated for the vector will be freed and the vector itself will be destroyed.

Parameters:
vec Vector.

void GA_vector_destroy_real ( GAVectorReal vec  ) 

Destroy vector (real).

Remove a reference from a vector. If the reference count drops to zero, all resources allocated for the vector will be freed and the vector itself will be destroyed.

Parameters:
vec vector.

int* GA_vector_get_elt_int ( GAVectorInt vec,
int  index 
)

Get vector element (int).

Get the element of the vector with the specified index. An error will be reported if the index is out of range.

Parameters:
vec vector
index index
Returns:
specified element, or 0 if the index is out of range

double* GA_vector_get_elt_real ( GAVectorReal vec,
int  index 
)

Get vector element (real).

Get the element of the vector with the specified index. An error will be reported if the index is out of range.

Parameters:
vec vector
index index
Returns:
specified element, or 0 if the index is out of range

GAVectorInt* GA_vector_init_from_array_int ( GAVectorInt vec,
int *  source,
int  srcSize 
)

Initialize vector from array (int).

Initialize a vector of integers from an array of integers.

Parameters:
vec vector
source source array
srcSize size of source array
Returns:
the vector

GAVectorReal* GA_vector_init_from_array_real ( GAVectorReal vec,
double *  source,
int  srcSize 
)

Initialize vector from array (real).

Initialize a vector of real numbers from an array of real numbers.

Parameters:
vec vector
source source array
srcSize size of source array
Returns:
the vector

GAVectorInt* GA_vector_init_zero_int ( GAVectorInt vec  ) 

Initialize vector to zero (int).

Set all elements of a vector to zero.

Parameters:
vec vector
Returns:
the vector

GAVectorReal* GA_vector_init_zero_real ( GAVectorReal vec  ) 

Initialize vector to zero (real).

Set all elements of a vector to zero.

Parameters:
vec vector
Returns:
the vector

GAVectorInt* GA_vector_print_int ( GAVectorInt vec  ) 

Print vector (int).

Print a vector of integers in a nice, readable way.

Parameters:
vec vector
Returns:
the vector

GAVectorReal* GA_vector_print_real ( GAVectorReal vec  ) 

Print vector (real).

Print a vector of real numbers in a nice, readable way.

Parameters:
vec vector
Returns:
the vector

GAVectorInt* GA_vector_ref_int ( GAVectorInt vec  ) 

Add reference (int).

Add a reference for a vector. The user of this function is responsible for removing the reference using GA_vector_destroy_int().

Parameters:
vec Vector.
Returns:
The vector.
See also:
GA_vector_destroy_int

GAVectorReal* GA_vector_ref_real ( GAVectorReal vec  ) 

Add reference (real).

Add a reference for a vector. The user of this function is responsible for removing the reference using GA_vector_destroy_real().

Parameters:
vec Vector.
Returns:
The vector.
See also:
GA_vector_destroy_real

GAVectorInt* GA_vector_to_bin_real ( GAVectorReal vec,
GAVectorReal lookup,
GAClampMode  clamp 
)

Convert to bin vector (real).

Convert a vector of real numbers to a vector of integer bin numbers according to the specified lookup vector. The new vector will be referenced and should be destroyed by using GA_vector_destroy_int() when it is not needed anymore.

Parameters:
vec vector
lookup lookup vector
clamp clamp values to the lookup range
Returns:
vector of bin numbers
See also:
GA_get_bin_number()


Generated on Thu Aug 16 15:28:41 2007 for Graphalignment(Rpackage) by  doxygen 1.5.1