Main Page   Modules   Compound List   File List   Compound Members   File Members  

General Size Matrices
[General Size Matrices and Vectors]


Modules

Set Attributes of a General Size Matrix
Fill a General Size Matrix with Values
Read Elements of a General Size Matrix
Threshold Elements of a General Size Matrix
Invert a General Size Matrix
General Size Matrix/Matrix Product
Allocate/Free a General Size Matrix
Norms of a General Size Matrix
Copy a General Size Matrix
Multiply/Divide a General Size Matrix by a Scalar
Transpose a General Size Matrix
Add General Size Matrices
Subtract General Size Matrices
General Size Matrix/Vector Product
Insert Part of a General Size Matrix in Another
Extract Part of a General Size Matrix
General Size Matrix I/O
Access an Element of a General Size Matrix
Test a General Size Matrix
Get Dimensions of General Size Matrix
Eigendecomposition of a General Size Matrix
LQ Decomposition of a General Size Matrix
QR Decomposition of a General Size Matrix
General Size Matrix Triple Product
Cholesky Factorisation of a General Size Matrix
Convert a General Size Matrix
Singular Value Decomposition of a General Size Matrix
Pseudo-Inverse of a General Size Matrix

Compounds

struct  Gan_Matrix
 Structure definition for double precision general size matrix. More...

struct  Gan_Matrix_f
 Structure definition for single precision general size matrix. More...

struct  Gan_SquMatrix
 Structure definition for double precision general size square matrix. More...

struct  Gan_SquMatrix_f
 Structure definition for single precision general size square matrix. More...

struct  Gan_SquMatrixFFuncs
 Structure containing type-specific functions. More...

struct  Gan_SquMatrixFuncs
 Structure containing type-specific functions. More...


Defines

#define GAN_MATRIX_STRUCT_DEFINED
#define gan_mat_realloc(A, rows, cols)   gan_mat_realloc_gen(A,rows,cols)
#define GAN_SQUMATRIX_STRUCT_DEFINED
#define GAN_MATRIXF_STRUCT_DEFINED
#define gan_matf_realloc(A, rows, cols)   gan_matf_realloc_gen(A,rows,cols)
#define GAN_SQUMATRIXF_STRUCT_DEFINED

Typedefs

typedef Gan_Matrix Gan_Matrix
 Structure definition for double precision general size matrix.

typedef Gan_SquMatrixFuncs Gan_SquMatrixFuncs
 Structure containing type-specific functions.

typedef Gan_SquMatrix Gan_SquMatrix
 Structure definition for double precision general size square matrix.

typedef Gan_Matrix_f Gan_Matrix_f
 Structure definition for single precision general size matrix.

typedef Gan_SquMatrixFFuncs Gan_SquMatrixFFuncs
 Structure containing type-specific functions.

typedef Gan_SquMatrix_f Gan_SquMatrix_f
 Structure definition for single precision general size square matrix.


Enumerations

enum  Gan_TposeFlag { GAN_NOTRANSPOSE = 0, GAN_TRANSPOSE = 1 }
 Whether or not matrix is (to be) transposed. More...

enum  Gan_InvertFlag { GAN_NOINVERT = 0, GAN_INVERT = 1 }
 Whether or not matrix is (to be) inverted. More...

enum  Gan_UpLoFlag { GAN_LOWER, GAN_UPPER }
 Whether matrix is upper or lower triangular. More...

enum  Gan_UnitFlag { GAN_NOUNIT = 0, GAN_UNIT = 1 }
 Whether triangular matrix is unit along the diagonal. More...

enum  Gan_SideFlag { GAN_LEFTMULT = 0, GAN_RIGHTMULT = 1 }
 Whether product is on left or right side. More...

enum  Gan_SquMatrixType {
  GAN_SYMMETRIC_MATRIX, GAN_DIAGONAL_MATRIX, GAN_SCALED_IDENT_MATRIX, GAN_LOWER_TRI_MATRIX,
  GAN_UPPER_TRI_MATRIX, GAN_ZERO_SQUARE_MATRIX
}
 Types of square matrix. More...


Functions

Gan_SquMatrixgan_diagmat_set_size (Gan_SquMatrix *A, unsigned long size)
 Set square matrix to be diagonal with given size.

Gan_SquMatrixgan_diagmat_fill_va (Gan_SquMatrix *A, unsigned long size,...)
 Fill diagonal matrix from variable argument list.

Gan_SquMatrixgan_diagmat_fill_const_q (Gan_SquMatrix *A, unsigned long size, double value)
 Fill a diagonal matrix with constant value.

Gan_Bool gan_diagmat_read_va (Gan_SquMatrix *A, unsigned long size,...)
 Read the elements of a diagonal matrix into pointers.

Gan_SquMatrixgan_diagmat_diag_thres (Gan_SquMatrix *A, unsigned null_space, double thres, int *indexptr, double **elptr)
 Threshold small diagonal elements of a diagonal matrix.

Gan_SquMatrixgan_diagmat_inv_diag_thres (Gan_SquMatrix *A, unsigned null_space, double thres)
 Invert the elements of diagonal matrix.

Gan_Matrixgan_diagmatI_lmult_inf_q (Gan_SquMatrix *A, struct Gan_Matrix *B, struct Gan_Matrix *C)
Gan_SquMatrixgan_diagmat_form_gen (Gan_SquMatrix *A, unsigned long size, double *data, size_t data_size)
Gan_SquMatrixgan_diagmat_fill_vap (Gan_SquMatrix *A, unsigned long size, va_list *aptr)
 Fill diagonal matrix with values from variable argument list.

void gan_mat_db (Gan_Matrix *A)
void gan_mat_free (Gan_Matrix *A)
 Free a matrix.

Gan_Matrixgan_mat_set_dims (Gan_Matrix *A, unsigned long rows, unsigned long cols)
 Set dimensions of generic matrix.

Gan_Matrixgan_mat_fill_va (Gan_Matrix *A, unsigned long rows, unsigned long cols,...)
 Fill matrix from variable argument list.

Gan_Matrixgan_mat_fill_vap (Gan_Matrix *A, unsigned long rows, unsigned long cols, va_list *aptr)
 Fill matrix from variable argument list.

Gan_Matrixgan_mat_fill_const_q (Gan_Matrix *A, unsigned long rows, unsigned long cols, double value)
 Fill all elements of a matrix with the same value.

Gan_Bool gan_mat_read_va (Gan_Matrix *A, unsigned long rows, unsigned long cols,...)
 Read elements of matrix from variable argument list.

Gan_Matrixgan_mat_copy_q (Gan_Matrix *A, Gan_Matrix *B)
 Copy matrix.

Gan_Matrixgan_mat_scale_q (Gan_Matrix *A, double a, Gan_Matrix *B)
 Multiply matrix by scalar.

Gan_Matrixgan_mat_divide_q (Gan_Matrix *A, double a, Gan_Matrix *B)
 Divide matrix by scalar.

Gan_Matrixgan_mat_tpose_q (Gan_Matrix *A, Gan_Matrix *B)
 Transpose matrix.

Gan_Matrixgan_mat_insertsym (Gan_Matrix *A, unsigned long rA, unsigned long cA, struct Gan_SquMatrix *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
void gan_mat_free_va (Gan_Matrix *A,...)
 Free a NULL-terminated variable argument list of matrices.

Gan_Matrixgan_mat_extract_q (Gan_Matrix *A, unsigned long r0, unsigned long c0, unsigned long rows, unsigned long cols, Gan_Matrix *B)
 Extracts rectangular part of matrix.

double gan_mat_sumsqr (Gan_Matrix *A)
 Returns squared Frobenius norm of generic rectangular matrix.

double gan_mat_Fnorm (Gan_Matrix *A)
 Returns Frobenius norm of generic rectangular matrix.

Gan_Matrixgan_mat_invert_q (Gan_Matrix *A, Gan_Matrix *B)
 Inverts general square matrix.

Gan_Bool gan_mat_fprint (FILE *fp, Gan_Matrix *A, const char *prefix, unsigned indent, const char *fmt)
 Print matrix to file pointer.

Gan_Matrixgan_mat_fscanf_q (FILE *fp, Gan_Matrix *A, char *prefix, int prefix_len)
 Read matrix from file.

Gan_Bool gan_mat_fwrite (FILE *fp, Gan_Matrix *A, gan_ui32 magic_number)
 Print matrix to binary file pointer.

Gan_Matrixgan_mat_fread_q (FILE *fp, Gan_Matrix *A, gan_ui32 *magic_number)
 Read matrix from file in binary format.

Gan_Matrixgan_mat_form_gen (Gan_Matrix *A, unsigned long rows, unsigned long cols, double *data, size_t data_size)
Gan_Bool gan_mat_realloc_gen (Gan_Matrix *A, unsigned long rows, unsigned long cols)
Gan_Matrixgan_mat_add_gen (Gan_Matrix *A, Gan_TposeFlag A_tr, Gan_Matrix *B, Gan_TposeFlag B_tr, Gan_Matrix *C)
 Add general size matrices.

Gan_SquMatrixgan_mat_add_sym_gen (Gan_Matrix *A, Gan_TposeFlag A_tr, Gan_Matrix *B, Gan_TposeFlag B_tr, struct Gan_SquMatrix *C)
 Add general size matrices producing a symmetric matrix.

Gan_Matrixgan_mat_sub_gen (Gan_Matrix *A, Gan_TposeFlag A_tr, Gan_Matrix *B, Gan_TposeFlag B_tr, Gan_Matrix *C)
 Subtract general size matrices.

Gan_Vectorgan_mat_multv_gen (Gan_Matrix *A, Gan_TposeFlag A_tr, Gan_Vector *x, Gan_Vector *y)
 Multiply matrix and a vector.

Gan_Matrixgan_mat_rmult_gen (Gan_Matrix *A, Gan_TposeFlag A_tr, Gan_Matrix *B, Gan_TposeFlag B_tr, Gan_Matrix *C)
Gan_SquMatrixgan_mat_rmult_sym_gen (Gan_Matrix *A, Gan_TposeFlag A_tr, Gan_Matrix *B, Gan_TposeFlag B_tr, struct Gan_SquMatrix *C)
Gan_Matrixgan_mat_insert_gen (Gan_Matrix *A, unsigned long rA, unsigned long cA, Gan_Matrix *B, Gan_TposeFlag B_tr, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
 Insert part of generic matrix in another generic matrix.

Gan_Matrixgan_mat_insertv_gen (Gan_Matrix *A, unsigned long rA, unsigned long cA, struct Gan_Vector *x, Gan_TposeFlag x_tr, unsigned long rx, unsigned long size)
Gan_SquMatrixgan_scalImat_set_size (Gan_SquMatrix *A, unsigned long size)
 Set square matrix to be multiple of identity with given size.

Gan_SquMatrixgan_scalImat_fill_va (Gan_SquMatrix *A, unsigned long size,...)
 Fill multiple of the identity matrix from variable argument list.

Gan_SquMatrixgan_scalImat_fill_const_q (Gan_SquMatrix *A, unsigned long size, double value)
 Fill a scaled identity matrix with constant value.

Gan_Bool gan_scalImat_read_va (Gan_SquMatrix *A, unsigned long size,...)
 Read the elements of a scaled identity matrix into pointers.

Gan_SquMatrixgan_scalImat_form_gen (Gan_SquMatrix *A, unsigned long size, double *data, size_t data_size)
Gan_SquMatrixgan_scalImat_fill_vap (Gan_SquMatrix *A, unsigned long size, va_list *aptr)
 Fill multiple of identity matrix using variable argument list.

void gan_squmat_db (Gan_SquMatrix *A)
void gan_squmat_free (Gan_SquMatrix *A)
 Function to free square matrix.

void gan_squmat_free_va (Gan_SquMatrix *A,...)
 Free a NULL-terminated variable argument list of square matrices.

Gan_SquMatrixgan_squmat_set_type_size (Gan_SquMatrix *A, Gan_SquMatrixType type, unsigned long size)
 Set type and size of square matrix.

Gan_SquMatrixgan_squmat_fill_vap (Gan_SquMatrix *A, Gan_SquMatrixType type, unsigned long size, va_list *aptr)
 Fill square matrix from variable argument list.

Gan_SquMatrixgan_squmat_fill_const_q (Gan_SquMatrix *A, Gan_SquMatrixType type, unsigned long size, double value)
 Fill square matrix with constant value.

size_t gan_squmat_data_size (Gan_SquMatrixType type, unsigned long size)
 Returns size of data array needed to create a matrix of given type & size.

Gan_SquMatrixgan_squmat_fscanf_q (FILE *fp, Gan_SquMatrix *A, char *prefix, int prefix_len)
 Read square matrix from ASCII file.

Gan_Bool gan_squmat_fwrite (FILE *fp, Gan_SquMatrix *A, gan_ui32 magic_number)
 Write square matrix to binary file.

Gan_SquMatrixgan_squmat_fread_q (FILE *fp, Gan_SquMatrix *A, gan_ui32 *magic_number)
 Read square matrix from binary file.

Gan_SquMatrixgan_squmat_form_gen (Gan_SquMatrix *A, Gan_SquMatrixType type, unsigned long size, double *data, size_t data_size)
Gan_SquMatrixgan_symmat_set_size (Gan_SquMatrix *A, unsigned long size)
 Set square matrix to be symmetric with given size.

Gan_SquMatrixgan_symmat_fill_va (Gan_SquMatrix *A, unsigned long size,...)
 Fill symmetric matrix from variable argument list.

Gan_SquMatrixgan_symmat_fill_const_q (Gan_SquMatrix *A, unsigned long size, double value)
 Fill symmetric matrix with constant value, and set its size.

Gan_Bool gan_symmat_read_va (Gan_SquMatrix *A, unsigned long size,...)
 Read the elements of a symmetric matrix into pointers.

Gan_SquMatrixgan_symmat_insertsym (Gan_SquMatrix *A, unsigned long rA, Gan_SquMatrix *B, unsigned long rB, unsigned long size)
 Insert diagonal part of symmetric matrix in symmetric matrix.

Gan_SquMatrixgan_symmat_insertsym_od (Gan_SquMatrix *A, unsigned long rA, unsigned long cA, Gan_SquMatrix *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
 Insert off-diagonal part of symmetric matrix in symmetric matrix.

Gan_Bool gan_symmat_eigen (Gan_SquMatrix *A, Gan_SquMatrix *W, struct Gan_Matrix *Z, Gan_Bool sort, double *work, unsigned long work_size)
Gan_SquMatrixgan_symmat_form_gen (Gan_SquMatrix *A, unsigned long size, double *data, size_t data_size)
Gan_SquMatrixgan_symmat_fill_vap (Gan_SquMatrix *A, unsigned long size, va_list *aptr)
 Fill symmetric matrix with values from variable argument list.

Gan_SquMatrixgan_symmat_insert_gen (Gan_SquMatrix *S, unsigned long rS, unsigned long cS, struct Gan_Matrix *B, Gan_TposeFlag B_tr, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
Gan_SquMatrixgan_symmat_insertv_gen (Gan_SquMatrix *A, unsigned long rA, unsigned long cA, struct Gan_Vector *x, Gan_TposeFlag x_tr, unsigned long rx, unsigned long size)
Gan_SquMatrixgan_ltmat_set_size (Gan_SquMatrix *L, unsigned long size)
 Set square matrix to be lower triangular with given size.

Gan_SquMatrixgan_utmat_set_size (Gan_SquMatrix *U, unsigned long size)
 Set square matrix to be upper triangular with given size.

Gan_SquMatrixgan_ltmat_fill_va (Gan_SquMatrix *L, unsigned long size,...)
 Fill a lower triangular matrix with values.

Gan_SquMatrixgan_utmat_fill_va (Gan_SquMatrix *U, unsigned long size,...)
 Fill an upper triangular matrix with values.

Gan_SquMatrixgan_ltmat_fill_const_q (Gan_SquMatrix *L, unsigned long size, double value)
 Fill a lower triangular matrix with a constant value.

Gan_SquMatrixgan_utmat_fill_const_q (Gan_SquMatrix *U, unsigned long size, double value)
 Fill a upper triangular matrix with a constant value.

Gan_Bool gan_ltmat_read_va (Gan_SquMatrix *L, unsigned long size,...)
 Read the elements of a lower triangular matrix into pointers.

Gan_Bool gan_utmat_read_va (Gan_SquMatrix *U, unsigned long size,...)
 Read the elements of an upper triangular matrix into pointers.

Gan_SquMatrixgan_ltmat_form_gen (Gan_SquMatrix *A, unsigned long size, double *data, size_t data_size)
Gan_SquMatrixgan_utmat_form_gen (Gan_SquMatrix *A, unsigned long size, double *data, size_t data_size)
Gan_SquMatrixgan_ltmat_fill_vap (Gan_SquMatrix *L, unsigned long size, va_list *aptr)
 Fills a lower triangular matrix with values.

Gan_SquMatrixgan_utmat_fill_vap (Gan_SquMatrix *U, unsigned long size, va_list *aptr)
 Fills an upper triangular matrix with values.

Gan_SquMatrix_fgan_diagmatf_set_size (Gan_SquMatrix_f *A, unsigned long size)
 Set square matrix to be diagonal with given size.

Gan_SquMatrix_fgan_diagmatf_fill_va (Gan_SquMatrix_f *A, unsigned long size,...)
 Fill diagonal matrix from variable argument list.

Gan_SquMatrix_fgan_diagmatf_fill_const_q (Gan_SquMatrix_f *A, unsigned long size, float value)
 Fill a diagonal matrix with constant value.

Gan_Bool gan_diagmatf_read_va (Gan_SquMatrix_f *A, unsigned long size,...)
 Read the elements of a diagonal matrix into pointers.

Gan_SquMatrix_fgan_diagmatf_diag_thres (Gan_SquMatrix_f *A, unsigned null_space, float thres, int *indexptr, float **elptr)
 Threshold small diagonal elements of a diagonal matrix.

Gan_SquMatrix_fgan_diagmatf_inv_diag_thres (Gan_SquMatrix_f *A, unsigned null_space, float thres)
 Invert the elements of diagonal matrix.

Gan_Matrix_fgan_diagmatIf_lmult_inf_q (Gan_SquMatrix_f *A, struct Gan_Matrix_f *B, struct Gan_Matrix_f *C)
Gan_SquMatrix_fgan_diagmatf_form_gen (Gan_SquMatrix_f *A, unsigned long size, float *data, size_t data_size)
Gan_SquMatrix_fgan_diagmatf_fill_vap (Gan_SquMatrix_f *A, unsigned long size, va_list *aptr)
 Fill diagonal matrix with values from variable argument list.

void gan_matf_db (Gan_Matrix_f *A)
void gan_matf_free (Gan_Matrix_f *A)
 Free a matrix.

Gan_Matrix_fgan_matf_set_dims (Gan_Matrix_f *A, unsigned long rows, unsigned long cols)
 Set dimensions of generic matrix.

Gan_Matrix_fgan_matf_fill_va (Gan_Matrix_f *A, unsigned long rows, unsigned long cols,...)
 Fill matrix from variable argument list.

Gan_Matrix_fgan_matf_fill_vap (Gan_Matrix_f *A, unsigned long rows, unsigned long cols, va_list *aptr)
 Fill matrix from variable argument list.

Gan_Matrix_fgan_matf_fill_const_q (Gan_Matrix_f *A, unsigned long rows, unsigned long cols, float value)
 Fill all elements of a matrix with the same value.

Gan_Bool gan_matf_read_va (Gan_Matrix_f *A, unsigned long rows, unsigned long cols,...)
 Read elements of matrix from variable argument list.

Gan_Matrix_fgan_matf_copy_q (Gan_Matrix_f *A, Gan_Matrix_f *B)
 Copy matrix.

Gan_Matrix_fgan_matf_scale_q (Gan_Matrix_f *A, float a, Gan_Matrix_f *B)
 Multiply matrix by scalar.

Gan_Matrix_fgan_matf_divide_q (Gan_Matrix_f *A, float a, Gan_Matrix_f *B)
 Divide matrix by scalar.

Gan_Matrix_fgan_matf_tpose_q (Gan_Matrix_f *A, Gan_Matrix_f *B)
 Transpose matrix.

Gan_Matrix_fgan_matf_insertsym (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, struct Gan_SquMatrix_f *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
void gan_matf_free_va (Gan_Matrix_f *A,...)
 Free a NULL-terminated variable argument list of matrices.

Gan_Matrix_fgan_matf_extract_q (Gan_Matrix_f *A, unsigned long r0, unsigned long c0, unsigned long rows, unsigned long cols, Gan_Matrix_f *B)
 Extracts rectangular part of matrix.

float gan_matf_sumsqr (Gan_Matrix_f *A)
 Returns squared Frobenius norm of generic rectangular matrix.

float gan_matf_Fnorm (Gan_Matrix_f *A)
 Returns Frobenius norm of generic rectangular matrix.

Gan_Matrix_fgan_matf_invert_q (Gan_Matrix_f *A, Gan_Matrix_f *B)
 Inverts general square matrix.

Gan_Bool gan_matf_fprint (FILE *fp, Gan_Matrix_f *A, const char *prefix, unsigned indent, const char *fmt)
 Print matrix to file pointer.

Gan_Matrix_fgan_matf_fscanf_q (FILE *fp, Gan_Matrix_f *A, char *prefix, int prefix_len)
 Read matrix from file.

Gan_Bool gan_matf_fwrite (FILE *fp, Gan_Matrix_f *A, gan_ui32 magic_number)
 Print matrix to binary file pointer.

Gan_Matrix_fgan_matf_fread_q (FILE *fp, Gan_Matrix_f *A, gan_ui32 *magic_number)
 Read matrix from file in binary format.

Gan_Matrix_fgan_matf_form_gen (Gan_Matrix_f *A, unsigned long rows, unsigned long cols, float *data, size_t data_size)
Gan_Bool gan_matf_realloc_gen (Gan_Matrix_f *A, unsigned long rows, unsigned long cols)
Gan_Matrix_fgan_matf_add_gen (Gan_Matrix_f *A, Gan_TposeFlag A_tr, Gan_Matrix_f *B, Gan_TposeFlag B_tr, Gan_Matrix_f *C)
 Add general size matrices.

Gan_SquMatrix_fgan_matf_add_sym_gen (Gan_Matrix_f *A, Gan_TposeFlag A_tr, Gan_Matrix_f *B, Gan_TposeFlag B_tr, struct Gan_SquMatrix_f *C)
 Add general size matrices producing a symmetric matrix.

Gan_Matrix_fgan_matf_sub_gen (Gan_Matrix_f *A, Gan_TposeFlag A_tr, Gan_Matrix_f *B, Gan_TposeFlag B_tr, Gan_Matrix_f *C)
 Subtract general size matrices.

Gan_Vector_fgan_matf_multv_gen (Gan_Matrix_f *A, Gan_TposeFlag A_tr, Gan_Vector_f *x, Gan_Vector_f *y)
 Multiply matrix and a vector.

Gan_Matrix_fgan_matf_rmult_gen (Gan_Matrix_f *A, Gan_TposeFlag A_tr, Gan_Matrix_f *B, Gan_TposeFlag B_tr, Gan_Matrix_f *C)
Gan_SquMatrix_fgan_matf_rmult_sym_gen (Gan_Matrix_f *A, Gan_TposeFlag A_tr, Gan_Matrix_f *B, Gan_TposeFlag B_tr, struct Gan_SquMatrix_f *C)
Gan_Matrix_fgan_matf_insert_gen (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, Gan_Matrix_f *B, Gan_TposeFlag B_tr, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
 Insert part of generic matrix in another generic matrix.

Gan_Matrix_fgan_matf_insertv_gen (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, struct Gan_Vector_f *x, Gan_TposeFlag x_tr, unsigned long rx, unsigned long size)
Gan_SquMatrix_fgan_scalImatf_set_size (Gan_SquMatrix_f *A, unsigned long size)
 Set square matrix to be multiple of identity with given size.

Gan_SquMatrix_fgan_scalImatf_fill_va (Gan_SquMatrix_f *A, unsigned long size,...)
 Fill multiple of the identity matrix from variable argument list.

Gan_SquMatrix_fgan_scalImatf_fill_const_q (Gan_SquMatrix_f *A, unsigned long size, float value)
 Fill a scaled identity matrix with constant value.

Gan_Bool gan_scalImatf_read_va (Gan_SquMatrix_f *A, unsigned long size,...)
 Read the elements of a scaled identity matrix into pointers.

Gan_SquMatrix_fgan_scalImatf_form_gen (Gan_SquMatrix_f *A, unsigned long size, float *data, size_t data_size)
Gan_SquMatrix_fgan_scalImatf_fill_vap (Gan_SquMatrix_f *A, unsigned long size, va_list *aptr)
 Fill multiple of identity matrix using variable argument list.

void gan_squmatf_db (Gan_SquMatrix_f *A)
void gan_squmatf_free (Gan_SquMatrix_f *A)
 Function to free square matrix.

void gan_squmatf_free_va (Gan_SquMatrix_f *A,...)
 Free a NULL-terminated variable argument list of square matrices.

Gan_SquMatrix_fgan_squmatf_set_type_size (Gan_SquMatrix_f *A, Gan_SquMatrixType type, unsigned long size)
 Set type and size of square matrix.

Gan_SquMatrix_fgan_squmatf_fill_vap (Gan_SquMatrix_f *A, Gan_SquMatrixType type, unsigned long size, va_list *aptr)
 Fill square matrix from variable argument list.

Gan_SquMatrix_fgan_squmatf_fill_const_q (Gan_SquMatrix_f *A, Gan_SquMatrixType type, unsigned long size, float value)
 Fill square matrix with constant value.

size_t gan_squmatf_data_size (Gan_SquMatrixType type, unsigned long size)
 Returns size of data array needed to create a matrix of given type & size.

Gan_SquMatrix_fgan_squmatf_fscanf_q (FILE *fp, Gan_SquMatrix_f *A, char *prefix, int prefix_len)
 Read square matrix from ASCII file.

Gan_Bool gan_squmatf_fwrite (FILE *fp, Gan_SquMatrix_f *A, gan_ui32 magic_number)
 Write square matrix to binary file.

Gan_SquMatrix_fgan_squmatf_fread_q (FILE *fp, Gan_SquMatrix_f *A, gan_ui32 *magic_number)
 Read square matrix from binary file.

Gan_SquMatrix_fgan_squmatf_form_gen (Gan_SquMatrix_f *A, Gan_SquMatrixType type, unsigned long size, float *data, size_t data_size)
void gan_squmatf_free_func (Gan_SquMatrix_f *A)
Gan_SquMatrix_fgan_symmatf_set_size (Gan_SquMatrix_f *A, unsigned long size)
 Set square matrix to be symmetric with given size.

Gan_SquMatrix_fgan_symmatf_fill_va (Gan_SquMatrix_f *A, unsigned long size,...)
 Fill symmetric matrix from variable argument list.

Gan_SquMatrix_fgan_symmatf_fill_const_q (Gan_SquMatrix_f *A, unsigned long size, float value)
 Fill symmetric matrix with constant value, and set its size.

Gan_Bool gan_symmatf_read_va (Gan_SquMatrix_f *A, unsigned long size,...)
 Read the elements of a symmetric matrix into pointers.

Gan_SquMatrix_fgan_symmatf_insertsym (Gan_SquMatrix_f *A, unsigned long rA, Gan_SquMatrix_f *B, unsigned long rB, unsigned long size)
 Insert diagonal part of symmetric matrix in symmetric matrix.

Gan_SquMatrix_fgan_symmatf_insertsym_od (Gan_SquMatrix_f *A, unsigned long rA, unsigned long cA, Gan_SquMatrix_f *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
 Insert off-diagonal part of symmetric matrix in symmetric matrix.

Gan_Bool gan_symmatf_eigen (Gan_SquMatrix_f *A, Gan_SquMatrix_f *W, struct Gan_Matrix_f *Z, Gan_Bool sort, float *work, unsigned long work_size)
Gan_SquMatrix_fgan_symmatf_form_gen (Gan_SquMatrix_f *A, unsigned long size, float *data, size_t data_size)
Gan_SquMatrix_fgan_symmatf_fill_vap (Gan_SquMatrix_f *A, unsigned long size, va_list *aptr)
 Fill symmetric matrix with values from variable argument list.

Gan_SquMatrix_fgan_symmatf_insert_gen (Gan_SquMatrix_f *S, unsigned long rS, unsigned long cS, struct Gan_Matrix_f *B, Gan_TposeFlag B_tr, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
Gan_SquMatrix_fgan_symmatf_insertv_gen (Gan_SquMatrix_f *A, unsigned long rA, unsigned long cA, struct Gan_Vector_f *x, Gan_TposeFlag x_tr, unsigned long rx, unsigned long size)
Gan_SquMatrix_fgan_ltmatf_set_size (Gan_SquMatrix_f *L, unsigned long size)
 Set square matrix to be lower triangular with given size.

Gan_SquMatrix_fgan_utmatf_set_size (Gan_SquMatrix_f *U, unsigned long size)
 Set square matrix to be upper triangular with given size.

Gan_SquMatrix_fgan_ltmatf_fill_va (Gan_SquMatrix_f *L, unsigned long size,...)
 Fill a lower triangular matrix with values.

Gan_SquMatrix_fgan_utmatf_fill_va (Gan_SquMatrix_f *U, unsigned long size,...)
 Fill an upper triangular matrix with values.

Gan_SquMatrix_fgan_ltmatf_fill_const_q (Gan_SquMatrix_f *L, unsigned long size, float value)
 Fill a lower triangular matrix with a constant value.

Gan_SquMatrix_fgan_utmatf_fill_const_q (Gan_SquMatrix_f *U, unsigned long size, float value)
 Fill a upper triangular matrix with a constant value.

Gan_Bool gan_ltmatf_read_va (Gan_SquMatrix_f *L, unsigned long size,...)
 Read the elements of a lower triangular matrix into pointers.

Gan_Bool gan_utmatf_read_va (Gan_SquMatrix_f *U, unsigned long size,...)
 Read the elements of an upper triangular matrix into pointers.

Gan_SquMatrix_fgan_ltmatf_form_gen (Gan_SquMatrix_f *A, unsigned long size, float *data, size_t data_size)
Gan_SquMatrix_fgan_utmatf_form_gen (Gan_SquMatrix_f *A, unsigned long size, float *data, size_t data_size)
Gan_SquMatrix_fgan_ltmatf_fill_vap (Gan_SquMatrix_f *L, unsigned long size, va_list *aptr)
 Fills a lower triangular matrix with values.

Gan_SquMatrix_fgan_utmatf_fill_vap (Gan_SquMatrix_f *U, unsigned long size, va_list *aptr)
 Fills an upper triangular matrix with values.


Enumeration Type Documentation

enum Gan_InvertFlag
 

Whether or not matrix is (to be) inverted.

Enumeration values:
GAN_NOINVERT  Don't invert matrix.
GAN_INVERT  Do invert matrix.

enum Gan_SideFlag
 

Whether product is on left or right side.

Enumeration values:
GAN_LEFTMULT  Multiply on left side.
GAN_RIGHTMULT  Multiply on right side.

enum Gan_SquMatrixType
 

Types of square matrix.

Enumeration values:
GAN_SYMMETRIC_MATRIX  Symmetric matrix.
GAN_DIAGONAL_MATRIX  Diagonal matrix.
GAN_SCALED_IDENT_MATRIX  Identity matrix times scalar.
GAN_LOWER_TRI_MATRIX  Lower triangular matrix.
GAN_UPPER_TRI_MATRIX  Upper triangular matrix.
GAN_ZERO_SQUARE_MATRIX  Square matrix filled with zeros.

enum Gan_TposeFlag
 

Whether or not matrix is (to be) transposed.

Enumeration values:
GAN_NOTRANSPOSE  Don't transpose matrix.
GAN_TRANSPOSE  Do transpose matrix.

enum Gan_UnitFlag
 

Whether triangular matrix is unit along the diagonal.

Enumeration values:
GAN_NOUNIT  Not a unit triangular matrix.
GAN_UNIT  Unit triangular matrix.

enum Gan_UpLoFlag
 

Whether matrix is upper or lower triangular.

Enumeration values:
GAN_LOWER  Lower-triangular matrix.
GAN_UPPER  Upper-triangular matrix.


Function Documentation

Gan_SquMatrix* gan_diagmat_diag_thres Gan_SquMatrix   A,
unsigned    null_space,
double    thres,
int *    indexptr,
double **    elptr
 

Threshold small diagonal elements of a diagonal matrix.

Parameters:
A Diagonal matrix
null_space Size of null-space in A to allow for
thres Threshold on elements of A
indexptr Pointer to index of last unaffected element of A
elptr Pointer to last unaffected element of A
Diagonal elements below the threshold thres times the first are set to zero. In addition any redundant diagonal elements (indicated by the value of null_space) are also set to zero. This can be used to eliminate conditioning problems when using the SVD algorithm gan_mat_svd() for least-squares. The diagonal elements must be in monotonically decreasing order from the top-left corner of the matrix.

The array x of state vectors specifies any redundant parameters in each block.

The contents of indexptr and elptr, if not NULL, are set respectively to the index of and a pointer to the last diagonal element not set to the high value.

Gan_SquMatrix* gan_diagmat_fill_const_q Gan_SquMatrix   A,
unsigned long    size,
double    value
 

Fill a diagonal matrix with constant value.

Returns:
Filled matrix A.
Set matrix A to be diagonal with given size, and fill with given value.

Gan_SquMatrix* gan_diagmat_fill_va Gan_SquMatrix   A,
unsigned long    size,
...   
 

Fill diagonal matrix from variable argument list.

Returns:
Result matrix A, or NULL on failure.
Fill diagonal matrix A with values from variable argument list, and set the size of A to size.

Gan_SquMatrix* gan_diagmat_fill_vap Gan_SquMatrix   A,
unsigned long    size,
va_list *    aptr
 

Fill diagonal matrix with values from variable argument list.

Fill diagonal matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix* gan_diagmat_inv_diag_thres Gan_SquMatrix   A,
unsigned    null_space,
double    thres
 

Invert the elements of diagonal matrix.

Returns:
The matrix A, or NULL on failure.
The bottom-right null_space elements of A are set to zero, as well as any other elements below the thres threshold value. All other elements of A are inverted. The elements of diagonal matrix A are assumed to be positive and in decreasing order from the top-left.

Gan_Bool gan_diagmat_read_va Gan_SquMatrix   A,
unsigned long    size,
...   
 

Read the elements of a diagonal matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Reads all the diagonal element values of the given diagonal matrix A into the variable argument list of pointers to double. The size argument must match the size of the matrix.

Gan_SquMatrix* gan_diagmat_set_size Gan_SquMatrix   A,
unsigned long    size
 

Set square matrix to be diagonal with given size.

Returns:
Result matrix A.

Gan_SquMatrix_f* gan_diagmatf_diag_thres Gan_SquMatrix_f   A,
unsigned    null_space,
float    thres,
int *    indexptr,
float **    elptr
 

Threshold small diagonal elements of a diagonal matrix.

Parameters:
A Diagonal matrix
null_space Size of null-space in A to allow for
thres Threshold on elements of A
indexptr Pointer to index of last unaffected element of A
elptr Pointer to last unaffected element of A
Diagonal elements below the threshold thres times the first are set to zero. In addition any redundant diagonal elements (indicated by the value of null_space) are also set to zero. This can be used to eliminate conditioning problems when using the SVD algorithm gan_mat_svd() for least-squares. The diagonal elements must be in monotonically decreasing order from the top-left corner of the matrix.

The array x of state vectors specifies any redundant parameters in each block.

The contents of indexptr and elptr, if not NULL, are set respectively to the index of and a pointer to the last diagonal element not set to the high value.

Gan_SquMatrix_f* gan_diagmatf_fill_const_q Gan_SquMatrix_f   A,
unsigned long    size,
float    value
 

Fill a diagonal matrix with constant value.

Returns:
Filled matrix A.
Set matrix A to be diagonal with given size, and fill with given value.

Gan_SquMatrix_f* gan_diagmatf_fill_va Gan_SquMatrix_f   A,
unsigned long    size,
...   
 

Fill diagonal matrix from variable argument list.

Fill diagonal matrix A with values from variable argument list, and set the size of A to size.

Gan_SquMatrix_f* gan_diagmatf_fill_vap Gan_SquMatrix_f   A,
unsigned long    size,
va_list *    aptr
 

Fill diagonal matrix with values from variable argument list.

Fill diagonal matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix_f* gan_diagmatf_inv_diag_thres Gan_SquMatrix_f   A,
unsigned    null_space,
float    thres
 

Invert the elements of diagonal matrix.

Returns:
The matrix A, or NULL on failure.
The bottom-right null_space elements of A are set to zero, as well as any other elements below the thres threshold value. All other elements of A are inverted. The elements of diagonal matrix A are assumed to be positive and in decreasing order from the top-left.

Gan_Bool gan_diagmatf_read_va Gan_SquMatrix_f   A,
unsigned long    size,
...   
 

Read the elements of a diagonal matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Reads all the diagonal element values of the given diagonal matrix A into the variable argument list of pointers to double. The size argument must match the size of the matrix.

Gan_SquMatrix_f* gan_diagmatf_set_size Gan_SquMatrix_f   A,
unsigned long    size
 

Set square matrix to be diagonal with given size.

Returns:
Result matrix A.

Gan_SquMatrix* gan_ltmat_fill_const_q Gan_SquMatrix   L,
unsigned long    size,
double    value
 

Fill a lower triangular matrix with a constant value.

Returns:
Result matrix L.
Set a lower triangular matrix L to have given size, and fill with constant value.

Gan_SquMatrix* gan_ltmat_fill_va Gan_SquMatrix   L,
unsigned long    size,
...   
 

Fill a lower triangular matrix with values.

Returns:
Result matrix L.
Set lower triangular matrix L to have given size, and fill with values from a variable argument list.

Gan_SquMatrix* gan_ltmat_fill_vap Gan_SquMatrix   L,
unsigned long    size,
va_list *    aptr
 

Fills a lower triangular matrix with values.

Returns:
The filled matrix L.
Sets a lower triangular matrix L to given size, and fills it with values from the variable argument list aptr.

Gan_Bool gan_ltmat_read_va Gan_SquMatrix   L,
unsigned long    size,
...   
 

Read the elements of a lower triangular matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Read the elements of a lower triangular matrix L into pointers from a variable argument list. The size argument must match the size of the matrix L.

Gan_SquMatrix* gan_ltmat_set_size Gan_SquMatrix   L,
unsigned long    size
 

Set square matrix to be lower triangular with given size.

Returns:
The result matrix L.
Set square matrix L to be lower triangular with given size. L should already have been allocated, with arbitrary type and size. The internal data of L will be reallocated if necessary.

Gan_SquMatrix_f* gan_ltmatf_fill_const_q Gan_SquMatrix_f   L,
unsigned long    size,
float    value
 

Fill a lower triangular matrix with a constant value.

Returns:
Result matrix L.
Set a lower triangular matrix L to have given size, and fill with constant value.

Gan_SquMatrix_f* gan_ltmatf_fill_va Gan_SquMatrix_f   L,
unsigned long    size,
...   
 

Fill a lower triangular matrix with values.

Returns:
Result matrix L.
Set lower triangular matrix L to have given size, and fill with values from a variable argument list.

Gan_SquMatrix_f* gan_ltmatf_fill_vap Gan_SquMatrix_f   L,
unsigned long    size,
va_list *    aptr
 

Fills a lower triangular matrix with values.

Returns:
The filled matrix L.
Sets a lower triangular matrix L to given size, and fills it with values from the variable argument list aptr.

Gan_Bool gan_ltmatf_read_va Gan_SquMatrix_f   L,
unsigned long    size,
...   
 

Read the elements of a lower triangular matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Read the elements of a lower triangular matrix L into pointers from a variable argument list. The size argument must match the size of the matrix L.

Gan_SquMatrix_f* gan_ltmatf_set_size Gan_SquMatrix_f   L,
unsigned long    size
 

Set square matrix to be lower triangular with given size.

Returns:
The result matrix L.
Set square matrix L to be lower triangular with given size. L should already have been allocated, with arbitrary type and size. The internal data of L will be reallocated if necessary.

Gan_Matrix* gan_mat_add_gen Gan_Matrix   A,
Gan_TposeFlag    A_tr,
Gan_Matrix   B,
Gan_TposeFlag    B_tr,
Gan_Matrix   C
 

Add general size matrices.

Add two matrices A, B, each of which may be transposed, and write result into , which is returned. Transposing A or B does not affect A or B, only the result C.

struct Gan_SquMatrix* gan_mat_add_sym_gen Gan_Matrix   A,
Gan_TposeFlag    A_tr,
Gan_Matrix   B,
Gan_TposeFlag    B_tr,
struct Gan_SquMatrix   C
 

Add general size matrices producing a symmetric matrix.

Add two matrices A, B and write result into , which is returned. C is square and is assumed to be symmetric. No checking of this assumption is done. A and B may both be optionally implicitly transposed.

Gan_Matrix* gan_mat_copy_q Gan_Matrix   A,
Gan_Matrix   B
 

Copy matrix.

Copy matrix A to matrix B, and return B.

Gan_Matrix* gan_mat_divide_q Gan_Matrix   A,
double    a,
Gan_Matrix   B
 

Divide matrix by scalar.

Divide matrix A by scalar a into matrix B, and return B.

Gan_Matrix* gan_mat_extract_q Gan_Matrix   A,
unsigned long    r0,
unsigned long    c0,
unsigned long    rows,
unsigned long    cols,
Gan_Matrix   B
 

Extracts rectangular part of matrix.

Parameters:
A Input Matrix
r0 row offset of start of region to be extracted
c0 column offset of start of region to be extracted
rows Height of region to be extracted
cols Width of region to be extracted
B output matrix
Returns:
Pointer to the output matrix B, or NULL on failure.
Extracts the given rectangular part of matrix A, copies it into matrix B, and returns B. If B is passed as NULL, the output matrix is allocated inside the function, and then returned.
See also:
gan_mat_extract_s(), gan_mat_insert().

Gan_Matrix* gan_mat_fill_const_q Gan_Matrix   A,
unsigned long    rows,
unsigned long    cols,
double    value
 

Fill all elements of a matrix with the same value.

Parameters:
A The matrix to fill or NULL
rows The new row size of the matrix
cols The new column size of the matrix
value The value to set each element of the matrix to
Returns:
non-NULL on successfully filling the matrix, or NULL on failure.
Set the dimensions of matrix A to rows by cols, and fill each element with the provided value.

See also:
gan_mat_fill_const_s().

Gan_Matrix* gan_mat_fill_va Gan_Matrix   A,
unsigned long    rows,
unsigned long    cols,
...   
 

Fill matrix from variable argument list.

Parameters:
A Matrix to fill or NULL
rows Number of rows in matrix
cols Number of columns in matrix
Fill matrix A with values from variable argument list, and set the dimensions of A to rows by cols.

Returns:
Pointer to the filled matrix.

Gan_Matrix* gan_mat_fill_vap Gan_Matrix   A,
unsigned long    rows,
unsigned long    cols,
va_list *    aptr
 

Fill matrix from variable argument list.

Parameters:
A Matrix to fill or NULL
rows Number of rows in matrix
cols Number of columns in matrix
aptr Variable argument list of elements
Returns:
Pointer to the filled matrix, or NULL on failure.
Fill matrix A with values from variable argument list aptr, and set the dimensions of A to rows by cols.

double gan_mat_Fnorm Gan_Matrix   A
 

Returns Frobenius norm of generic rectangular matrix.

Parameters:
A The input matrix
Returns:
The value of the Frobenius norm of A.
Returns Frobenius norm of generic rectangular matrix (square-root of sum of squares of matrix elements).

Gan_Bool gan_mat_fprint FILE *    fp,
Gan_Matrix   A,
const char *    prefix,
unsigned    indent,
const char *    fmt
 

Print matrix to file pointer.

Print matrix A to file pointer fp, with prefix string prefix, indentation indent and floating-point format fmt.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.

Gan_Matrix* gan_mat_fread_q FILE *    fp,
Gan_Matrix   A,
gan_ui32 *    magic_number
 

Read matrix from file in binary format.

Read matrix A from file pointer fp in binary format. The magic number is read into the provided pointer. A should either be a pre-allocated matrix pointer or NULL.

Returns:
Pointer to the read matrix on success, NULL on failure.
See also:
gan_vecf_fread_s()

void gan_mat_free Gan_Matrix   A
 

Free a matrix.

Free a generic rectangular matrix A.

void gan_mat_free_va Gan_Matrix   A,
...   
 

Free a NULL-terminated variable argument list of matrices.

Free a NULL-terminated variable argument list of matrices, starting with matrix A.

Gan_Matrix* gan_mat_fscanf_q FILE *    fp,
Gan_Matrix   A,
char *    prefix,
int    prefix_len
 

Read matrix from file.

Read matrix A from file pointer fp. The prefix string for the matrix is read from the file into the prefix string, up to the maximum length prefix_len of the prefix string. Any remaining characters after "prefix" has been filled are ignored. Pass NULL for prefix and zero for prefix_len to ignore the prefix string. A should either be a pre-allocated matrix pointer or NULL.

Returns:
Pointer to the read matrix on success, NULL on failure.
See also:
gan_mat_fscanf_s().

Gan_Bool gan_mat_fwrite FILE *    fp,
Gan_Matrix   A,
gan_ui32    magic_number
 

Print matrix to binary file pointer.

Print matrix A to file pointer fp in binary format, with 32-bit magic number printed first.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.

Gan_Matrix* gan_mat_insert_gen Gan_Matrix   A,
unsigned long    rA,
unsigned long    cA,
Gan_Matrix   B,
Gan_TposeFlag    B_tr,
unsigned long    rB,
unsigned long    cB,
unsigned long    rows,
unsigned long    cols
 

Insert part of generic matrix in another generic matrix.

Fills a rectangular part of generic matrix A starting at row,column position rA, cA and rows by cols in size with the section of generic matrix B, starting at position rB, cB.

Gan_Matrix* gan_mat_invert_q Gan_Matrix   A,
Gan_Matrix   B
 

Inverts general square matrix.

Parameters:
A Input Matrix
B Output inverse matrix
Returns:
Non-NULL Pointer to the output inverse matrix, or NULL on failure. Inverts general square matrix A into matrix B. This is a nasty operation and should be avoided at all costs.
See also:
gan_mat_invert_s().

Gan_Vector* gan_mat_multv_gen Gan_Matrix   A,
Gan_TposeFlag    A_tr,
Gan_Vector   x,
Gan_Vector   y
 

Multiply matrix and a vector.

Multiply matrix A and vector x, A being optionally transposed, writing the result into another vector .

Returns:
Pointer to result vector y.

Gan_Bool gan_mat_read_va Gan_Matrix   A,
unsigned long    rows,
unsigned long    cols,
...   
 

Read elements of matrix from variable argument list.

Gan_Matrix* gan_mat_scale_q Gan_Matrix   A,
double    a,
Gan_Matrix   B
 

Multiply matrix by scalar.

Rescale matrix A by scalar a into matrix B, and return B.

Gan_Matrix* gan_mat_set_dims Gan_Matrix   A,
unsigned long    rows,
unsigned long    cols
 

Set dimensions of generic matrix.

Set dimensions of generic matrix A to rows by cols.

Gan_Matrix* gan_mat_sub_gen Gan_Matrix   A,
Gan_TposeFlag    A_tr,
Gan_Matrix   B,
Gan_TposeFlag    B_tr,
Gan_Matrix   C
 

Subtract general size matrices.

Subtract two matrices A, B, each of which may be implicitly transposed, and write result into , which is returned.

double gan_mat_sumsqr Gan_Matrix   A
 

Returns squared Frobenius norm of generic rectangular matrix.

Parameters:
A The input matrix
Returns:
The value of the squared Frobenius norm of A.
Returns squared Frobenius norm of generic rectangular matrix A (sum of squares of matrix elements).

Gan_Matrix* gan_mat_tpose_q Gan_Matrix   A,
Gan_Matrix   B
 

Transpose matrix.

Function to transpose generic matrix A into another matrix B.

Gan_Matrix_f* gan_matf_add_gen Gan_Matrix_f   A,
Gan_TposeFlag    A_tr,
Gan_Matrix_f   B,
Gan_TposeFlag    B_tr,
Gan_Matrix_f   C
 

Add general size matrices.

Add two matrices A, B, each of which may be transposed, and write result into , which is returned. Transposing A or B does not affect A or B, only the result C.

struct Gan_SquMatrix_f* gan_matf_add_sym_gen Gan_Matrix_f   A,
Gan_TposeFlag    A_tr,
Gan_Matrix_f   B,
Gan_TposeFlag    B_tr,
struct Gan_SquMatrix_f   C
 

Add general size matrices producing a symmetric matrix.

Add two matrices A, B and write result into , which is returned. C is square and is assumed to be symmetric. No checking of this assumption is done. A and B may both be optionally implicitly transposed.

Gan_Matrix_f* gan_matf_copy_q Gan_Matrix_f   A,
Gan_Matrix_f   B
 

Copy matrix.

Copy matrix A to matrix B, and return B.

Gan_Matrix_f* gan_matf_divide_q Gan_Matrix_f   A,
float    a,
Gan_Matrix_f   B
 

Divide matrix by scalar.

Divide matrix A by scalar a into matrix B, and return B.

Gan_Matrix_f* gan_matf_extract_q Gan_Matrix_f   A,
unsigned long    r0,
unsigned long    c0,
unsigned long    rows,
unsigned long    cols,
Gan_Matrix_f   B
 

Extracts rectangular part of matrix.

Parameters:
A Input Matrix
r0 row offset of start of region to be extracted
c0 column offset of start of region to be extracted
rows Height of region to be extracted
cols Width of region to be extracted
B output matrix
Returns:
Pointer to the output matrix B, or NULL on failure.
Extracts the given rectangular part of matrix A, copies it into matrix B, and returns B. If B is passed as NULL, the output matrix is allocated inside the function, and then returned.
See also:
gan_matf_extract_s(), gan_matf_insert().

Gan_Matrix_f* gan_matf_fill_const_q Gan_Matrix_f   A,
unsigned long    rows,
unsigned long    cols,
float    value
 

Fill all elements of a matrix with the same value.

Parameters:
A The matrix to fill or NULL
rows The new row size of the matrix
cols The new column size of the matrix
value The value to set each element of the matrix to
Returns:
non-NULL on successfully filling the matrix, or NULL on failure.
Set the dimensions of matrix A to rows by cols, and fill each element with the provided value.

See also:
gan_matf_fill_const_s().

Gan_Matrix_f* gan_matf_fill_va Gan_Matrix_f   A,
unsigned long    rows,
unsigned long    cols,
...   
 

Fill matrix from variable argument list.

Parameters:
A Matrix to fill or NULL
rows Number of rows in matrix
cols Number of columns in matrix
Fill matrix A with values from variable argument list, and set the dimensions of A to rows by cols.

Returns:
Pointer to the filled matrix.

Gan_Matrix_f* gan_matf_fill_vap Gan_Matrix_f   A,
unsigned long    rows,
unsigned long    cols,
va_list *    aptr
 

Fill matrix from variable argument list.

Parameters:
A Matrix to fill or NULL
rows Number of rows in matrix
cols Number of columns in matrix
aptr Variable argument list of elements
Fill matrix A with values from variable argument list aptr, and set the dimensions of A to rows by cols.

Returns:
Pointer to the filled matrix.

float gan_matf_Fnorm Gan_Matrix_f   A
 

Returns Frobenius norm of generic rectangular matrix.

Parameters:
A The input matrix
Returns:
The value of the Frobenius norm of A.
Returns Frobenius norm of generic rectangular matrix (square-root of sum of squares of matrix elements).

Gan_Bool gan_matf_fprint FILE *    fp,
Gan_Matrix_f   A,
const char *    prefix,
unsigned    indent,
const char *    fmt
 

Print matrix to file pointer.

Print matrix A to file pointer fp, with prefix string prefix, indentation indent and floating-point format fmt.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.

Gan_Matrix_f* gan_matf_fread_q FILE *    fp,
Gan_Matrix_f   A,
gan_ui32 *    magic_number
 

Read matrix from file in binary format.

Read matrix A from file pointer fp in binary format. The magic number is read into the provided pointer. A should either be a pre-allocated matrix pointer or NULL.

Returns:
Pointer to the read matrix on success, NULL on failure.
See also:
gan_vecf_fread_s()

void gan_matf_free Gan_Matrix_f   A
 

Free a matrix.

Free a generic rectangular matrix A.

void gan_matf_free_va Gan_Matrix_f   A,
...   
 

Free a NULL-terminated variable argument list of matrices.

Free a NULL-terminated variable argument list of matrices, starting with matrix A.

Gan_Matrix_f* gan_matf_fscanf_q FILE *    fp,
Gan_Matrix_f   A,
char *    prefix,
int    prefix_len
 

Read matrix from file.

Read matrix A from file pointer fp. The prefix string for the matrix is read from the file into the prefix string, up to the maximum length prefix_len of the prefix string. Any remaining characters after "prefix" has been filled are ignored. Pass NULL for prefix and zero for prefix_len to ignore the prefix string. A should either be a pre-allocated matrix pointer or NULL.

Returns:
Pointer to the read matrix on success, NULL on failure.
See also:
gan_matf_fscanf_s().

Gan_Bool gan_matf_fwrite FILE *    fp,
Gan_Matrix_f   A,
gan_ui32    magic_number
 

Print matrix to binary file pointer.

Print matrix A to file pointer fp in binary format, with 32-bit magic number printed first.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.

Gan_Matrix_f* gan_matf_insert_gen Gan_Matrix_f   A,
unsigned long    rA,
unsigned long    cA,
Gan_Matrix_f   B,
Gan_TposeFlag    B_tr,
unsigned long    rB,
unsigned long    cB,
unsigned long    rows,
unsigned long    cols
 

Insert part of generic matrix in another generic matrix.

Fills a rectangular part of generic matrix A starting at row,column position rA, cA and rows by cols in size with the section of generic matrix B, starting at position rB, cB.

Gan_Matrix_f* gan_matf_invert_q Gan_Matrix_f   A,
Gan_Matrix_f   B
 

Inverts general square matrix.

Parameters:
A Input Matrix
B Output inverse matrix
Returns:
Non-NULL Pointer to the output inverse matrix, or NULL on failure. Inverts general square matrix A into matrix B. This is a nasty operation and should be avoided at all costs.
See also:
gan_matf_invert_s().

Gan_Vector_f* gan_matf_multv_gen Gan_Matrix_f   A,
Gan_TposeFlag    A_tr,
Gan_Vector_f   x,
Gan_Vector_f   y
 

Multiply matrix and a vector.

Multiply matrix A and vector x, A being optionally transposed, writing the result into another vector .

Returns:
Pointer to result vector y.

Gan_Bool gan_matf_read_va Gan_Matrix_f   A,
unsigned long    rows,
unsigned long    cols,
...   
 

Read elements of matrix from variable argument list.

Gan_Matrix_f* gan_matf_scale_q Gan_Matrix_f   A,
float    a,
Gan_Matrix_f   B
 

Multiply matrix by scalar.

Rescale matrix A by scalar a into matrix B, and return B.

Gan_Matrix_f* gan_matf_set_dims Gan_Matrix_f   A,
unsigned long    rows,
unsigned long    cols
 

Set dimensions of generic matrix.

Set dimensions of generic matrix A to rows by cols.

Gan_Matrix_f* gan_matf_sub_gen Gan_Matrix_f   A,
Gan_TposeFlag    A_tr,
Gan_Matrix_f   B,
Gan_TposeFlag    B_tr,
Gan_Matrix_f   C
 

Subtract general size matrices.

Subtract two matrices A, B, each of which may be implicitly transposed, and write result into , which is returned.

float gan_matf_sumsqr Gan_Matrix_f   A
 

Returns squared Frobenius norm of generic rectangular matrix.

Parameters:
A The input matrix
Returns:
The value of the squared Frobenius norm of A.
Returns squared Frobenius norm of generic rectangular matrix A (sum of squares of matrix elements).

Gan_Matrix_f* gan_matf_tpose_q Gan_Matrix_f   A,
Gan_Matrix_f   B
 

Transpose matrix.

Function to transpose generic matrix A into another matrix B.

Gan_SquMatrix* gan_scalImat_fill_const_q Gan_SquMatrix   A,
unsigned long    size,
double    value
 

Fill a scaled identity matrix with constant value.

Returns:
Filled matrix A.
Set matrix A to be a multiple of identity with given size, and fill with given value.

Gan_SquMatrix* gan_scalImat_fill_va Gan_SquMatrix   A,
unsigned long    size,
...   
 

Fill multiple of the identity matrix from variable argument list.

Returns:
Result matrix A, or NULL on failure.
Fill multiple of the identity matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix* gan_scalImat_fill_vap Gan_SquMatrix   A,
unsigned long    size,
va_list *    aptr
 

Fill multiple of identity matrix using variable argument list.

Returns:
Result matrix A.
Fill multiple of identity matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_Bool gan_scalImat_read_va Gan_SquMatrix   A,
unsigned long    size,
...   
 

Read the elements of a scaled identity matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Reads the single value of the given multiple of identity matrix A into the variable argument list of pointers to double. Of course in this case the variable argument list should contain exactly one pointer. The size argument must match the size of the matrix.

Gan_SquMatrix* gan_scalImat_set_size Gan_SquMatrix   A,
unsigned long    size
 

Set square matrix to be multiple of identity with given size.

Returns:
Result matrix A.

Gan_SquMatrix_f* gan_scalImatf_fill_const_q Gan_SquMatrix_f   A,
unsigned long    size,
float    value
 

Fill a scaled identity matrix with constant value.

Returns:
Filled matrix A.
Set matrix A to be a multiple of identity with given size, and fill with given value.

Gan_SquMatrix_f* gan_scalImatf_fill_va Gan_SquMatrix_f   A,
unsigned long    size,
...   
 

Fill multiple of the identity matrix from variable argument list.

Returns:
Result matrix A, or NULL on failure.
Fill multiple of the identity matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix_f* gan_scalImatf_fill_vap Gan_SquMatrix_f   A,
unsigned long    size,
va_list *    aptr
 

Fill multiple of identity matrix using variable argument list.

Returns:
Result matrix A.
Fill multiple of identity matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_Bool gan_scalImatf_read_va Gan_SquMatrix_f   A,
unsigned long    size,
...   
 

Read the elements of a scaled identity matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Reads the single value of the given multiple of identity matrix A into the variable argument list of pointers to double. Of course in this case the variable argument list should contain exactly one pointer. The size argument must match the size of the matrix.

Gan_SquMatrix_f* gan_scalImatf_set_size Gan_SquMatrix_f   A,
unsigned long    size
 

Set square matrix to be multiple of identity with given size.

Returns:
Result matrix A.

size_t gan_squmat_data_size Gan_SquMatrixType    type,
unsigned long    size
 

Returns size of data array needed to create a matrix of given type & size.

Returns size of data array needed to create a square matrix of given type & size.

Gan_SquMatrix* gan_squmat_fill_const_q Gan_SquMatrix   A,
Gan_SquMatrixType    type,
unsigned long    size,
double    value
 

Fill square matrix with constant value.

Returns:
Result matrix A.
Fill matrix A with constant value, and set the type and size of A to type and size respectively.

Gan_SquMatrix* gan_squmat_fill_vap Gan_SquMatrix   A,
Gan_SquMatrixType    type,
unsigned long    size,
va_list *    aptr
 

Fill square matrix from variable argument list.

Returns:
Result matrix A.
Fill square matrix A with values from variable argument list aptr, and set the type and size of A to type and size respectively.

Gan_SquMatrix* gan_squmat_fread_q FILE *    fp,
Gan_SquMatrix   A,
gan_ui32 *    magic_number
 

Read square matrix from binary file.

Returns:
Read matrix on success, NULL on failure.
Read square matrix from file pointer fp in binary format into provided matrix A. The magic number for the matrix is read from the file into the provided pointer.

See also:
gan_squmatf_fread_s().

void gan_squmat_free Gan_SquMatrix   A
 

Function to free square matrix.

Returns:
No value.

void gan_squmat_free_va Gan_SquMatrix   A,
...   
 

Free a NULL-terminated variable argument list of square matrices.

Returns:
No value.
Free a NULL-terminated variable argument list of square matrices, starting with matrix A.

Gan_SquMatrix* gan_squmat_fscanf_q FILE *    fp,
Gan_SquMatrix   A,
char *    prefix,
int    prefix_len
 

Read square matrix from ASCII file.

Returns:
Result matrix A. Read square matrix A from file pointer fp. The prefix string for the matrix is read from the file into the prefix string, up to the maximum length prefix_len of the prefix string. Any remaining characters after prefix has been filled are ignored. Pass NULL for prefix and zero for prefix_len to ignore the prefix string. A should either be a pointer to a pre-allocated square matrix or NULL.

Pointer to the read matrix on success, NULL on failure.

See also:
gan_squmatf_fscanf_s().

Gan_Bool gan_squmat_fwrite FILE *    fp,
Gan_SquMatrix   A,
gan_ui32    magic_number
 

Write square matrix to binary file.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Write square matrix A in binary format to file pointer fp. The provided magic number is written as a prefix.

See also:
gan_squmatf_fread_q().

Gan_SquMatrix* gan_squmat_set_type_size Gan_SquMatrix   A,
Gan_SquMatrixType    type,
unsigned long    size
 

Set type and size of square matrix.

Returns:
Result matrix A.
Set type and size of square matrix A to type and size.

size_t gan_squmatf_data_size Gan_SquMatrixType    type,
unsigned long    size
 

Returns size of data array needed to create a matrix of given type & size.

Returns size of data array needed to create a square matrix of given type & size.

Gan_SquMatrix_f* gan_squmatf_fill_const_q Gan_SquMatrix_f   A,
Gan_SquMatrixType    type,
unsigned long    size,
float    value
 

Fill square matrix with constant value.

Returns:
Result matrix A.
Fill matrix A with constant value, and set the type and size of A to type and size respectively.

Gan_SquMatrix_f* gan_squmatf_fill_vap Gan_SquMatrix_f   A,
Gan_SquMatrixType    type,
unsigned long    size,
va_list *    aptr
 

Fill square matrix from variable argument list.

Returns:
Result matrix A.
Fill square matrix A with values from variable argument list aptr, and set the type and size of A to type and size respectively.

Gan_SquMatrix_f* gan_squmatf_fread_q FILE *    fp,
Gan_SquMatrix_f   A,
gan_ui32 *    magic_number
 

Read square matrix from binary file.

Returns:
Read matrix on success, NULL on failure.
Read square matrix from file pointer fp in binary format into provided matrix A. The magic number for the matrix is read from the file into the provided pointer.

See also:
gan_squmatf_fread_s().

void gan_squmatf_free Gan_SquMatrix_f   A
 

Function to free square matrix.

Returns:
No value.

void gan_squmatf_free_va Gan_SquMatrix_f   A,
...   
 

Free a NULL-terminated variable argument list of square matrices.

Returns:
No value.
Free a NULL-terminated variable argument list of square matrices, starting with matrix A.

Gan_SquMatrix_f* gan_squmatf_fscanf_q FILE *    fp,
Gan_SquMatrix_f   A,
char *    prefix,
int    prefix_len
 

Read square matrix from ASCII file.

Returns:
Result matrix A. Read square matrix A from file pointer fp. The prefix string for the matrix is read from the file into the prefix string, up to the maximum length prefix_len of the prefix string. Any remaining characters after prefix has been filled are ignored. Pass NULL for prefix and zero for prefix_len to ignore the prefix string. A should either be a pointer to a pre-allocated square matrix or NULL.

Pointer to the read matrix on success, NULL on failure.

See also:
gan_squmatf_fscanf_s().

Gan_Bool gan_squmatf_fwrite FILE *    fp,
Gan_SquMatrix_f   A,
gan_ui32    magic_number
 

Write square matrix to binary file.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Write square matrix A in binary format to file pointer fp. The provided magic number is written as a prefix.

See also:
gan_squmatf_fread_q().

Gan_SquMatrix_f* gan_squmatf_set_type_size Gan_SquMatrix_f   A,
Gan_SquMatrixType    type,
unsigned long    size
 

Set type and size of square matrix.

Returns:
Result matrix A.
Set type and size of square matrix A to type and size.

Gan_SquMatrix* gan_symmat_fill_const_q Gan_SquMatrix   A,
unsigned long    size,
double    value
 

Fill symmetric matrix with constant value, and set its size.

Returns:
Result matrix A.
Fill matrix A with constant value, and set the size of A to size.

Gan_SquMatrix* gan_symmat_fill_va Gan_SquMatrix   A,
unsigned long    size,
...   
 

Fill symmetric matrix from variable argument list.

Returns:
Result matrix A.
Fill symmetric matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix* gan_symmat_fill_vap Gan_SquMatrix   A,
unsigned long    size,
va_list *    aptr
 

Fill symmetric matrix with values from variable argument list.

Returns:
Result matrix A.
Fill symmetric matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix* gan_symmat_insertsym Gan_SquMatrix   A,
unsigned long    rA,
Gan_SquMatrix   B,
unsigned long    rB,
unsigned long    size
 

Insert diagonal part of symmetric matrix in symmetric matrix.

Returns:
Result matrix A.
Fills a square on-diagonal part of symmetric matrix A starting at row,column position rA,rA and with given row/column size with the section in symmetric matrix B, starting at position rB, rB.

Gan_SquMatrix* gan_symmat_insertsym_od Gan_SquMatrix   A,
unsigned long    rA,
unsigned long    cA,
Gan_SquMatrix   B,
unsigned long    rB,
unsigned long    cB,
unsigned long    rows,
unsigned long    cols
 

Insert off-diagonal part of symmetric matrix in symmetric matrix.

Returns:
Result matrix A.
Fills an off-diagonal rectangular part of symmetric matrix A starting at row, column position rA,cA and with given dimensions rows, cols with the section in symmetric matrix B, starting at position rB, cB.

Gan_Bool gan_symmat_read_va Gan_SquMatrix   A,
unsigned long    size,
...   
 

Read the elements of a symmetric matrix into pointers.

The size argument must match the size of the matrix A.

Gan_SquMatrix* gan_symmat_set_size Gan_SquMatrix   A,
unsigned long    size
 

Set square matrix to be symmetric with given size.

Returns:
Result matrix A.
Set square matrix A to be symmetric with given size.

Gan_SquMatrix_f* gan_symmatf_fill_const_q Gan_SquMatrix_f   A,
unsigned long    size,
float    value
 

Fill symmetric matrix with constant value, and set its size.

Returns:
Result matrix A.
Fill matrix A with constant value, and set the size of A to size.

Gan_SquMatrix_f* gan_symmatf_fill_va Gan_SquMatrix_f   A,
unsigned long    size,
...   
 

Fill symmetric matrix from variable argument list.

Returns:
Result matrix A.
Fill symmetric matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix_f* gan_symmatf_fill_vap Gan_SquMatrix_f   A,
unsigned long    size,
va_list *    aptr
 

Fill symmetric matrix with values from variable argument list.

Returns:
Result matrix A.
Fill symmetric matrix A with values from variable argument list aptr, and set the size of A to size.

Gan_SquMatrix_f* gan_symmatf_insertsym Gan_SquMatrix_f   A,
unsigned long    rA,
Gan_SquMatrix_f   B,
unsigned long    rB,
unsigned long    size
 

Insert diagonal part of symmetric matrix in symmetric matrix.

Returns:
Result matrix A.
Fills a square on-diagonal part of symmetric matrix A starting at row,column position rA,rA and with given row/column size with the section in symmetric matrix B, starting at position rB, rB.

Gan_SquMatrix_f* gan_symmatf_insertsym_od Gan_SquMatrix_f   A,
unsigned long    rA,
unsigned long    cA,
Gan_SquMatrix_f   B,
unsigned long    rB,
unsigned long    cB,
unsigned long    rows,
unsigned long    cols
 

Insert off-diagonal part of symmetric matrix in symmetric matrix.

Returns:
Result matrix A.
Fills an off-diagonal rectangular part of symmetric matrix A starting at row, column position rA,cA and with given dimensions rows, cols with the section in symmetric matrix B, starting at position rB, cB.

Gan_Bool gan_symmatf_read_va Gan_SquMatrix_f   A,
unsigned long    size,
...   
 

Read the elements of a symmetric matrix into pointers.

The size argument must match the size of the matrix A.

Gan_SquMatrix_f* gan_symmatf_set_size Gan_SquMatrix_f   A,
unsigned long    size
 

Set square matrix to be symmetric with given size.

Returns:
Result matrix A.
Set square matrix A to be symmetric with given size.

Gan_SquMatrix* gan_utmat_fill_const_q Gan_SquMatrix   U,
unsigned long    size,
double    value
 

Fill a upper triangular matrix with a constant value.

Returns:
Result matrix U.
Set an upper triangular matrix U to have given size, and fill with constant value.

Gan_SquMatrix* gan_utmat_fill_va Gan_SquMatrix   U,
unsigned long    size,
...   
 

Fill an upper triangular matrix with values.

Returns:
Result matrix U.
Set upper triangular matrix U to have given size, and fill with values from a variable argument list.

Gan_SquMatrix* gan_utmat_fill_vap Gan_SquMatrix   U,
unsigned long    size,
va_list *    aptr
 

Fills an upper triangular matrix with values.

Returns:
The filled matrix U.
Sets an upper triangular matrix U to given size, and fills it with values from the variable argument list aptr.

Gan_Bool gan_utmat_read_va Gan_SquMatrix   U,
unsigned long    size,
...   
 

Read the elements of an upper triangular matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Read the elements of an upper triangular matrix U into pointers from a variable argument list. The size argument must match the size of the matrix U.

Gan_SquMatrix* gan_utmat_set_size Gan_SquMatrix   U,
unsigned long    size
 

Set square matrix to be upper triangular with given size.

Returns:
The result matrix U.
Set square matrix U to be upper triangular with given size. U should already have been allocated, with arbitrary type and size. The internal data of U will be reallocated if necessary.

Gan_SquMatrix_f* gan_utmatf_fill_const_q Gan_SquMatrix_f   U,
unsigned long    size,
float    value
 

Fill a upper triangular matrix with a constant value.

Returns:
Result matrix U.
Set an upper triangular matrix U to have given size, and fill with constant value.

Gan_SquMatrix_f* gan_utmatf_fill_va Gan_SquMatrix_f   U,
unsigned long    size,
...   
 

Fill an upper triangular matrix with values.

Returns:
Result matrix U.
Set upper triangular matrix U to have given size, and fill with values from a variable argument list.

Gan_SquMatrix_f* gan_utmatf_fill_vap Gan_SquMatrix_f   U,
unsigned long    size,
va_list *    aptr
 

Fills an upper triangular matrix with values.

Returns:
The filled matrix U.
Sets an upper triangular matrix U to given size, and fills it with values from the variable argument list aptr.

Gan_Bool gan_utmatf_read_va Gan_SquMatrix_f   U,
unsigned long    size,
...   
 

Read the elements of an upper triangular matrix into pointers.

Returns:
GAN_TRUE on success, GAN_FALSE on failure.
Read the elements of an upper triangular matrix U into pointers from a variable argument list. The size argument must match the size of the matrix U.

Gan_SquMatrix_f* gan_utmatf_set_size Gan_SquMatrix_f   U,
unsigned long    size
 

Set square matrix to be upper triangular with given size.

Returns:
The result matrix U.
Set square matrix U to be upper triangular with given size. U should already have been allocated, with arbitrary type and size. The internal data of U will be reallocated if necessary.


Generated on Mon Oct 13 16:14:58 2003 by doxygen1.3-rc1