#include "GA_vector.h"
Go to the source code of this file.
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 struct GAMatrixInt_Impl GAMatrixInt |
A matrix of integers.
typedef struct GAMatrixReal_Impl GAMatrixReal |
A matrix of real numbers.
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.
source | source array | |
rows | number of rows of the new matrix | |
cols | number of columns of the new matrix |
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.
source | source array | |
rows | number of rows of the new matrix | |
cols | number of columns of the new matrix |
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.
rows | Number of rows. | |
cols | Number of columns. |
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.
rows | Number of rows. | |
cols | Number of columns. |
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.
size | Size of the matrix. |
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.
size | Size of the matrix. |
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.
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.
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.
matrix | matrix | |
row | row index | |
col | column index |
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.
matrix | matrix | |
row | row index | |
col | column index |
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.
matrix | matrix | |
source | source array | |
srcSize | size of source array |
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.
matrix | matrix | |
source | source array | |
srcSize | size of source array |
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.
matrix | 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.
matrix | Matrix. |
GAMatrixInt* GA_matrix_init_zero_int | ( | GAMatrixInt * | matrix | ) |
Initialize matrix to zero.
Set all elements of a matrix to zero.
matrix | Matrix. |
GAMatrixReal* GA_matrix_init_zero_real | ( | GAMatrixReal * | matrix | ) |
Initialize matrix to zero.
Set all elements of a matrix to zero.
matrix | Matrix. |
GAMatrixInt* GA_matrix_print_int | ( | GAMatrixInt * | matrix | ) |
Print matrix (int).
Print a matrix of integers in a nice, readable way.
matrix | matrix |
GAMatrixReal* GA_matrix_print_real | ( | GAMatrixReal * | matrix | ) |
Print matrix (real).
Print a matrix of integers in a nice, readable way.
matrix | 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().
matrix | Matrix. |
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().
matrix | Matrix. |
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.
matrix | Matrix | |
lookup | Lookup vector. | |
clamp | clamp values to the lookup range |