GraphAlignment/src/GA_matrix.h File Reference

Matrix types. More...

#include "GA_vector.h"

Go to the source code of this file.

Data Structures

struct  GAMatrixInt_Impl
struct  GAMatrixReal_Impl

Typedefs

typedef GAMatrixInt_Impl GAMatrixInt
typedef GAMatrixReal_Impl GAMatrixReal

Functions

GAMatrixIntGA_matrix_create_int (int rows, int cols)
GAMatrixIntGA_matrix_create_square_int (int size)
GAMatrixIntGA_matrix_ref_int (GAMatrixInt *matrix)
void GA_matrix_destroy_int (GAMatrixInt *matrix)
int * GA_matrix_get_elt_int (GAMatrixInt *matrix, int row, int col)
GAMatrixIntGA_matrix_init_from_array_int (GAMatrixInt *matrix, int *source, int srcSize)
GAMatrixIntGA_matrix_create_from_array_int (int *source, int rows, int cols)
GAMatrixIntGA_matrix_init_zero_int (GAMatrixInt *matrix)
GAMatrixIntGA_matrix_init_unit_int (GAMatrixInt *matrix)
GAMatrixIntGA_matrix_print_int (GAMatrixInt *matrix)
GAMatrixRealGA_matrix_create_real (int rows, int cols)
GAMatrixRealGA_matrix_create_square_real (int size)
GAMatrixRealGA_matrix_ref_real (GAMatrixReal *matrix)
void GA_matrix_destroy_real (GAMatrixReal *matrix)
double * GA_matrix_get_elt_real (GAMatrixReal *matrix, int row, int col)
GAMatrixRealGA_matrix_init_from_array_real (GAMatrixReal *matrix, double *source, int srcSize)
GAMatrixRealGA_matrix_create_from_array_real (double *source, int rows, int cols)
GAMatrixRealGA_matrix_init_zero_real (GAMatrixReal *matrix)
GAMatrixRealGA_matrix_init_unit_real (GAMatrixReal *matrix)
GAMatrixIntGA_matrix_to_bin_real (GAMatrixReal *matrix, GAVectorReal *lookup, GAClampMode clamp)
GAMatrixRealGA_matrix_print_real (GAMatrixReal *matrix)


Detailed Description

Matrix types.

This module provides types which represent two-dimensional matrices of integers or real numbers. Memory management for the types is handled transparently by the API functions which are provided by the module. The type includes information about the size of the matrix, so no additional variables are required.


Typedef Documentation

typedef struct GAMatrixInt_Impl GAMatrixInt

A matrix of integers.

typedef struct GAMatrixReal_Impl GAMatrixReal

A matrix of real numbers.


Function Documentation

GAMatrixInt* GA_matrix_create_from_array_int ( int *  source,
int  rows,
int  cols 
)

Create matrix from array (int).

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

Parameters:
source source array
rows number of rows of the new matrix
cols number of columns of the new matrix
Returns:
new matrix, or 0 if an error occurs

GAMatrixReal* GA_matrix_create_from_array_real ( double *  source,
int  rows,
int  cols 
)

Create matrix from array (real).

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

Parameters:
source source array
rows number of rows of the new matrix
cols number of columns of the new matrix
Returns:
new matrix, or 0 if an error occurs

GAMatrixInt* GA_matrix_create_int ( int  rows,
int  cols 
)

Create matrix (int).

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

Parameters:
rows Number of rows.
cols Number of columns.
Returns:
Pointer to a matrix, or 0 if an error occurs.
See also:
GA_matrix_destroy_int

GAMatrixReal* GA_matrix_create_real ( int  rows,
int  cols 
)

Create matrix (real).

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

Parameters:
rows Number of rows.
cols Number of columns.
Returns:
Pointer to a matrix, or 0 if an error occurs.
See also:
GA_matrix_destroy_real

GAMatrixInt* GA_matrix_create_square_int ( int  size  ) 

Create square matrix (int).

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

Parameters:
size Size of the matrix.
Returns:
Pointer to a matrix, or 0 if an error occurs.
See also:
GA_matrix_destroy_int

GAMatrixReal* GA_matrix_create_square_real ( int  size  ) 

Create square matrix (real).

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

Parameters:
size Size of the matrix.
Returns:
Pointer to a matrix, or 0 if an error occurs.
See also:
GA_matrix_destroy_real

void GA_matrix_destroy_int ( GAMatrixInt matrix  ) 

Destroy matrix.

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

Parameters:
matrix Matrix.

void GA_matrix_destroy_real ( GAMatrixReal matrix  ) 

Destroy matrix.

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

Parameters:
matrix Matrix.

int* GA_matrix_get_elt_int ( GAMatrixInt matrix,
int  row,
int  col 
)

Get matrix element (int).

Get the element of the matrix with the specified indices. An error will be reported if one of the indices is out of range.

Parameters:
matrix matrix
row row index
col column index
Returns:
specified element, or 0 if the index is out of range

double* GA_matrix_get_elt_real ( GAMatrixReal matrix,
int  row,
int  col 
)

Get matrix element (real).

Get the element of the matrix with the specified indices. An error will be reported if one of the indices is out of range.

Parameters:
matrix matrix
row row index
col column index
Returns:
specified element, or 0 if the index is out of range

GAMatrixInt* GA_matrix_init_from_array_int ( GAMatrixInt matrix,
int *  source,
int  srcSize 
)

Initialize matrix from array (int).

Initialize a matrix of integers from an array of integers.

Parameters:
matrix matrix
source source array
srcSize size of source array
Returns:
the matrix

GAMatrixReal* GA_matrix_init_from_array_real ( GAMatrixReal matrix,
double *  source,
int  srcSize 
)

Initialize matrix from array (real).

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

Parameters:
matrix matrix
source source array
srcSize size of source array
Returns:
the matrix

GAMatrixInt* GA_matrix_init_unit_int ( GAMatrixInt matrix  ) 

Initialize matrix to unit.

Set the elements of a matrix to the elements of the unit matrix of the appropriate size.

Parameters:
matrix Matrix.
Returns:
The matrix.

GAMatrixReal* GA_matrix_init_unit_real ( GAMatrixReal matrix  ) 

Initialize matrix to unit.

Set the elements of a matrix to the elements of the unit matrix of the appropriate size.

Parameters:
matrix Matrix.
Returns:
The matrix.

GAMatrixInt* GA_matrix_init_zero_int ( GAMatrixInt matrix  ) 

Initialize matrix to zero.

Set all elements of a matrix to zero.

Parameters:
matrix Matrix.
Returns:
The matrix.

GAMatrixReal* GA_matrix_init_zero_real ( GAMatrixReal matrix  ) 

Initialize matrix to zero.

Set all elements of a matrix to zero.

Parameters:
matrix Matrix.
Returns:
The matrix.

GAMatrixInt* GA_matrix_print_int ( GAMatrixInt matrix  ) 

Print matrix (int).

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

Parameters:
matrix matrix
Returns:
the matrix

GAMatrixReal* GA_matrix_print_real ( GAMatrixReal matrix  ) 

Print matrix (real).

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

Parameters:
matrix matrix
Returns:
the matrix

GAMatrixInt* GA_matrix_ref_int ( GAMatrixInt matrix  ) 

Add reference.

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

Parameters:
matrix Matrix.
Returns:
The matrix.
See also:
GA_matrix_destroy_int

GAMatrixReal* GA_matrix_ref_real ( GAMatrixReal matrix  ) 

Add reference.

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

Parameters:
matrix Matrix.
Returns:
The matrix.
See also:
GA_matrix_destroy_real

GAMatrixInt* GA_matrix_to_bin_real ( GAMatrixReal matrix,
GAVectorReal lookup,
GAClampMode  clamp 
)

Convert to bin matrix (real).

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

Parameters:
matrix Matrix
lookup Lookup vector.
clamp clamp values to the lookup range
Returns:
Matrix 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