Main Page | Modules | Class List | File List | Class Members | File Members

mat_gen.h File Reference

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <gandalf/common/misc_defs.h>
#include <gandalf/common/misc_error.h>
#include <gandalf/linalg/linalg_defs.h>
#include <gandalf/linalg/vec_gen.h>
#include <gandalf/linalg/mat_square.h>

Go to the source code of this file.

Classes

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

Defines

#define GAN_MATRIX_STRUCT_DEFINED
#define Gan_SquMatrix   struct Gan_SquMatrix
#define gan_mat_realloc(A, rows, cols)   gan_mat_realloc_gen(A,rows,cols)

Typedefs

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

Functions

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 (const Gan_Matrix *A, unsigned long rows, unsigned long cols,...)
 Read elements of matrix from variable argument list.
Gan_Matrixgan_mat_copy_q (const 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, const struct Gan_SquMatrix *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
Gan_Bool gan_mat_is_zero (Gan_Matrix *A)
 Checks whether a matrix is zero.
void gan_mat_free_va (Gan_Matrix *A,...)
 Free a NULL terminated variable argument list of matrices.
Gan_Matrixgan_mat_extract_q (const 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 (const Gan_Matrix *A)
 Returns squared Frobenius norm of generic rectangular matrix.
double gan_mat_Fnorm (const Gan_Matrix *A)
 Returns Frobenius norm of generic rectangular matrix.
Gan_Matrixgan_mat_invert_q (const Gan_Matrix *A, Gan_Matrix *B)
 Inverts general square matrix.
Gan_Bool gan_mat_fprint (FILE *fp, const 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, const Gan_Matrix *A, gan_uint32 magic_number)
 Print matrix to binary file pointer.
Gan_Matrixgan_mat_fread_q (FILE *fp, Gan_Matrix *A, gan_uint32 *magic_number)
 Read matrix from file in binary format.
Gan_Matrixgan_mat_alloc (unsigned long rows, unsigned long cols)
 Macro: Allocate and return a generic matrix.
Gan_Matrixgan_mat_form (Gan_Matrix *A, unsigned long rows, unsigned long cols)
 Macro: Form and return a generic matrix.
Gan_Matrixgan_mat_form_data (Gan_Matrix *A, unsigned long rows, unsigned long cols, double *data, size_t data_size)
 Macro: Form and return a generic matrix.
Gan_Bool gan_mat_set_el (Gan_Matrix *A, unsigned i, unsigned j, double value)
 Macro: Set specific element of matrix.
double gan_mat_get_el (const Gan_Matrix *A, unsigned i, unsigned j)
 Macro: Get specific element of matrix.
Gan_Bool gan_mat_inc_el (Gan_Matrix *A, unsigned i, unsigned j, double value)
 Macro: Increment specific element of matrix by given value.
Gan_Bool gan_mat_dec_el (Gan_Matrix *A, unsigned i, unsigned j, double value)
 Macro: Decrement specific element of matrix by given value.
Gan_Bool gan_mat_print (const Gan_Matrix *A, const char *prefix, int indent, const char *fmt)
 Macro: Print matrix to standard output.
Gan_Matrixgan_mat_fill_const_s (unsigned long rows, unsigned long cols, double value)
 Macro: Allocate and fill elements of a matrix with the same value.
Gan_Matrixgan_mat_fill_zero_q (Gan_Matrix *A, unsigned long rows, unsigned long cols)
 Macro: Fill matrix with zeros.
Gan_Matrixgan_mat_fill_zero_s (unsigned long rows, unsigned cols)
 Macro: Allocate and fill matrix with zeros.
Gan_Matrixgan_mat_copy_s (const Gan_Matrix *A)
 Macro: Copy matrix.
Gan_Matrixgan_mat_scale_s (Gan_Matrix *A, double a)
 Macro: Multiply matrix by scalar.
Gan_Matrixgan_mat_scale_i (Gan_Matrix *A, double a)
 Macro: Multiply matrix by scalar.
Gan_Matrixgan_mat_divide_s (Gan_Matrix *A, double a)
 Macro: Divide matrix by scalar.
Gan_Matrixgan_mat_divide_i (Gan_Matrix *A, double a)
 Macro: Divide matrix by scalar.
Gan_Matrixgan_mat_negate_q (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Negate matrix.
Gan_Matrixgan_mat_negate_s (Gan_Matrix *A)
 Macro: Negate matrix.
Gan_Matrixgan_mat_negate_i (Gan_Matrix *A)
 Macro: Negate matrix.
Gan_Matrixgan_mat_tpose_s (Gan_Matrix *A)
 Macro: Transpose matrix.
Gan_Matrixgan_mat_tpose_i (Gan_Matrix *A)
 Macro: Transpose matrix.
Gan_Matrixgan_mat_add_q (Gan_Matrix *A, Gan_Matrix *B, Gan_Matrix *C)
 Macro: Add two matrices and write result into a third.
Gan_Matrixgan_mat_add_s (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Add two matrices and return the result as a new matrix.
Gan_Matrixgan_mat_add_i1 (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Add two matrices and overwrite the first with the result.
Gan_Matrixgan_mat_add_i2 (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Add two matrices and overwrite the second with the result.
Gan_Matrixgan_mat_increment (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Increment a matrix with another matrix.
Gan_Matrixgan_mat_addT_q (Gan_Matrix *A, Gan_Matrix *B, Gan_Matrix *C)
 Macro: Add two matrices, the second transposed, and write result into a third.
Gan_Matrixgan_mat_addT_s (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Add two matrices, the second transposed, and return a new result matrix.
Gan_Matrixgan_mat_incrementT (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Increment a matrix with the transpose of another matrix.
Gan_SquMatrixgan_mat_add_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Add two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_add_sym_s (const Gan_Matrix *A, Gan_Matrix *B)
 Macro: Add two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_mat_addT_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Add two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_addT_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Add two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_matT_add_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Add two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_matT_add_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Add two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_matT_addT_sym_q (Gan_Matrix *A, Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Add two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_matT_addT_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Add two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_mat_saddT_sym_q (const Gan_Matrix *A, const Gan_SquMatrix *B)
 Macro: Add matrix to itself and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_saddT_sym_s (const Gan_Matrix *A)
 Macro: Add matrix to itself and return the result as a new symmetric matrix.
Gan_SquMatrixgan_matT_sadd_sym_q (const Gan_Matrix *A, Gan_SquMatrix *B)
 Macro: Add matrix to itself and write result into a symmetric matrix.
Gan_SquMatrixgan_matT_sadd_sym_s (const Gan_Matrix *A)
 Macro: Add matrix to itself and return the result as a new symmetric matrix.
Gan_Matrixgan_mat_sub_q (Gan_Matrix *A, Gan_Matrix *B, Gan_Matrix *C)
 Macro: Subtract two matrices and write result into a third.
Gan_Matrixgan_mat_sub_s (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Subtract two matrices and return the result as a new matrix.
Gan_Matrixgan_mat_sub_i1 (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Subtract two matrices and overwrite the first with the result.
Gan_Matrixgan_mat_sub_i2 (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Subtract two matrices and overwrite the second with the result.
Gan_Matrixgan_mat_decrement (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Decrement a matrix with another matrix.
Gan_Matrixgan_mat_subT_q (Gan_Matrix *A, Gan_Matrix *B, Gan_Matrix *C)
 Macro: Subtract two matrices, the second transposed, and write result into a third.
Gan_Matrixgan_mat_subT_s (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Subtract two matrices, the second transposed, and return new result matrix.
Gan_Matrixgan_mat_decrementT (Gan_Matrix *A, Gan_Matrix *B)
 Macro: Decrement a matrix with the transpose of another matrix.
Gan_Vectorgan_mat_multv_q (const Gan_Matrix *A, const Gan_Vector *x, Gan_Vector *y)
 Macro: Multiply matrix and a vector, writing the result into another vector.
Gan_Vectorgan_mat_multv_s (const Gan_Matrix *A, const Gan_Vector *x)
 Macro: Multiply matrix and a vector, returning the result as a new vector.
Gan_Vectorgan_matT_multv_q (const Gan_Matrix *A, const Gan_Vector *x, Gan_Vector *y)
 Macro: Multiply the transpose of a matrix by a vector.
Gan_Vectorgan_matT_multv_s (const Gan_Matrix *A, const Gan_Vector *x)
 Macro: Multiply transpose of matrix by a vector.
Gan_Matrixgan_mat_rmult_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_Matrix *C)
 Macro: Multiply two matrices and write result into a third.
Gan_Matrixgan_mat_rmult_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply two matrices and return the result as a new matrix.
Gan_Matrixgan_mat_rmultT_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_Matrix *C)
 Macro: Multiply a matrix by the transpose of another and write result into a third.
Gan_Matrixgan_mat_rmultT_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply a matrix by the transpose of another and return a new matrix.
Gan_Matrixgan_matT_rmult_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_Matrix *C)
 Macro: Multiply the transpose of a matrix by another matrix.
Gan_Matrixgan_matT_rmult_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply the transpose of a matrix by another matrix.
Gan_Matrixgan_matT_rmultT_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_Matrix *C)
 Macro: Multiply the transpose of a matrix by the transpose of another matrix.
Gan_Matrixgan_matT_rmultT_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply the transpose of a matrix by the transpose of another matrix.
Gan_SquMatrixgan_mat_rmult_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Multiply two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_rmult_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_mat_rmultT_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Multiply two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_rmultT_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_matT_rmult_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Multiply two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_matT_rmult_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_matT_rmultT_sym_q (const Gan_Matrix *A, const Gan_Matrix *B, Gan_SquMatrix *C)
 Macro: Multiply two matrices and write result into a symmetric matrix.
Gan_SquMatrixgan_matT_rmultT_sym_s (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Multiply two matrices and return the result as a new symmetric matrix.
Gan_SquMatrixgan_mat_srmultT_q (const Gan_Matrix *A, const Gan_SquMatrix *B)
 Macro: Multiply matrix by itself and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_srmultT_s (const Gan_Matrix *A)
 Macro: Multiply matrix by itself and return the result as a new symmetric matrix.
Gan_SquMatrixgan_mat_slmultT_q (const Gan_Matrix *A, Gan_SquMatrix *B)
 Macro: Multiply matrix by itself and write result into a symmetric matrix.
Gan_SquMatrixgan_mat_slmultT_s (const Gan_Matrix *A)
 Macro: Multiply matrix by itself and return the result as a new symmetric matrix.
Gan_Matrixgan_mat_invert_s (const Gan_Matrix *A)
 Macro: Inverts general square matrix.
Gan_Bool gan_mat_same_dims (const Gan_Matrix *A, const Gan_Matrix *B)
 Macro: Checks that two matrices have the same number of rows and columns.
Gan_Matrixgan_mat_insert (Gan_Matrix *A, unsigned long rA, unsigned long cA, const Gan_Matrix *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
 Macro: Insert part of generic matrix in another generic matrix.
Gan_Matrixgan_mat_insertT (Gan_Matrix *A, unsigned long rA, unsigned long cA, const Gan_Matrix *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols)
 Macro: Insert transpose of part of generic matrix in another generic matrix.
Gan_Matrixgan_mat_insertv (Gan_Matrix *A, unsigned long rA, unsigned long cA, const Gan_Vector *x, unsigned long rx, unsigned long rows)
 Macro: Insert part of column vector in a generic matrix.
Gan_Matrixgan_mat_insertvT (Gan_Matrix *A, unsigned long rA, unsigned long cA, const Gan_Vector *x, unsigned long rx, unsigned long cols)
 Macro: Insert part of row vector in a generic matrix.
Gan_Bool gan_mat_test_dims (const Gan_Matrix *A, unsigned long rows, unsigned long cols)
 Macro: Test dimensions of generic matrix.
size_t gan_mat_data_size (unsigned long rows, unsigned long cols)
 Macro: Returns size of data array in bytes needed to hold matrix data.
Gan_Matrixgan_mat_extract_s (const Gan_Matrix *A, unsigned long r0, unsigned long c0, unsigned long rows, unsigned long cols)
 Macro: Extracts rectangular part of matrix.
Gan_Matrixgan_mat_fscanf_s (FILE *fp, const char *prefix, int prefix_len)
 Macro: Read matrix from file.
Gan_Matrixgan_mat_fread_s (FILE *fp, gan_uint32 *magic_number)
 Macro: Read matrix from file.
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 (const Gan_Matrix *A, Gan_TposeFlag A_tr, const 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 (const Gan_Matrix *A, Gan_TposeFlag A_tr, const Gan_Vector *x, Gan_Vector *y)
 Multiply matrix and a vector.
Gan_Matrixgan_mat_rmult_gen (const Gan_Matrix *A, Gan_TposeFlag A_tr, const Gan_Matrix *B, Gan_TposeFlag B_tr, Gan_Matrix *C)
Gan_SquMatrixgan_mat_rmult_sym_gen (const Gan_Matrix *A, Gan_TposeFlag A_tr, const 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, const 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, const struct Gan_Vector *x, Gan_TposeFlag x_tr, unsigned long rx, unsigned long size)


Detailed Description

Module: Generic rectangular matrices (double precision)

Part of: Gandalf Library

Version:
1.32
Date:
2005/08/22 08:52:18
Author:
jps
Copyright: (c) 2000 Imagineer Software Limited
Generated on Fri Mar 17 12:44:52 2006 by  doxygen 1.3.9.1