#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/vecf_gen.h>
#include <gandalf/linalg/matf_square.h>
Go to the source code of this file.
Classes | |
struct | Gan_Matrix_f |
Structure definition for single precision general size matrix. More... | |
Defines | |
#define | GAN_MATRIXF_STRUCT_DEFINED |
#define | Gan_SquMatrix_f struct Gan_SquMatrix_f |
#define | gan_matf_realloc(A, rows, cols) gan_matf_realloc_gen(A,rows,cols) |
Typedefs | |
typedef Gan_Matrix_f | Gan_Matrix_f |
Structure definition for single precision general size matrix. | |
Functions | |
void | gan_matf_free (Gan_Matrix_f *A) |
Free a matrix. | |
Gan_Matrix_f * | gan_matf_set_dims (Gan_Matrix_f *A, unsigned long rows, unsigned long cols) |
Set dimensions of generic matrix. | |
Gan_Matrix_f * | gan_matf_fill_va (Gan_Matrix_f *A, unsigned long rows, unsigned long cols,...) |
Fill matrix from variable argument list. | |
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. | |
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. | |
Gan_Bool | gan_matf_read_va (const Gan_Matrix_f *A, unsigned long rows, unsigned long cols,...) |
Read elements of matrix from variable argument list. | |
Gan_Matrix_f * | gan_matf_copy_q (const Gan_Matrix_f *A, Gan_Matrix_f *B) |
Copy matrix. | |
Gan_Matrix_f * | gan_matf_scale_q (Gan_Matrix_f *A, float a, Gan_Matrix_f *B) |
Multiply matrix by scalar. | |
Gan_Matrix_f * | gan_matf_divide_q (Gan_Matrix_f *A, float a, Gan_Matrix_f *B) |
Divide matrix by scalar. | |
Gan_Matrix_f * | gan_matf_tpose_q (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Transpose matrix. | |
Gan_Bool | gan_matf_is_zero (Gan_Matrix_f *A) |
Checks whether a matrix is zero. | |
Gan_Matrix_f * | gan_matf_insertsym (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const 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_f * | gan_matf_extract_q (const 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 (const Gan_Matrix_f *A) |
Returns squared Frobenius norm of generic rectangular matrix. | |
float | gan_matf_Fnorm (const Gan_Matrix_f *A) |
Returns Frobenius norm of generic rectangular matrix. | |
Gan_Matrix_f * | gan_matf_invert_q (const Gan_Matrix_f *A, Gan_Matrix_f *B) |
Inverts general square matrix. | |
Gan_Bool | gan_matf_fprint (FILE *fp, const Gan_Matrix_f *A, const char *prefix, unsigned indent, const char *fmt) |
Print matrix to file pointer. | |
Gan_Matrix_f * | gan_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, const Gan_Matrix_f *A, gan_uint32 magic_number) |
Print matrix to binary file pointer. | |
Gan_Matrix_f * | gan_matf_fread_q (FILE *fp, Gan_Matrix_f *A, gan_uint32 *magic_number) |
Read matrix from file in binary format. | |
Gan_Matrix_f * | gan_matf_alloc (unsigned long rows, unsigned long cols) |
Macro: Allocate and return a generic matrix. | |
Gan_Matrix_f * | gan_matf_form (Gan_Matrix_f *A, unsigned long rows, unsigned long cols) |
Macro: Form and return a generic matrix. | |
Gan_Matrix_f * | gan_matf_form_data (Gan_Matrix_f *A, unsigned long rows, unsigned long cols, float *data, size_t data_size) |
Macro: Form and return a generic matrix. | |
Gan_Bool | gan_matf_set_el (Gan_Matrix_f *A, unsigned i, unsigned j, float value) |
Macro: Set specific element of matrix. | |
float | gan_matf_get_el (const Gan_Matrix_f *A, unsigned i, unsigned j) |
Macro: Get specific element of matrix. | |
Gan_Bool | gan_matf_inc_el (Gan_Matrix_f *A, unsigned i, unsigned j, float value) |
Macro: Increment specific element of matrix by given value. | |
Gan_Bool | gan_matf_dec_el (Gan_Matrix_f *A, unsigned i, unsigned j, float value) |
Macro: Decrement specific element of matrix by given value. | |
Gan_Bool | gan_matf_print (const Gan_Matrix_f *A, const char *prefix, int indent, const char *fmt) |
Macro: Print matrix to standard output. | |
Gan_Matrix_f * | gan_matf_fill_const_s (unsigned long rows, unsigned long cols, float value) |
Macro: Allocate and fill elements of a matrix with the same value. | |
Gan_Matrix_f * | gan_matf_fill_zero_q (Gan_Matrix_f *A, unsigned long rows, unsigned long cols) |
Macro: Fill matrix with zeros. | |
Gan_Matrix_f * | gan_matf_fill_zero_s (unsigned long rows, unsigned cols) |
Macro: Allocate and fill matrix with zeros. | |
Gan_Matrix_f * | gan_matf_copy_s (const Gan_Matrix_f *A) |
Macro: Copy matrix. | |
Gan_Matrix_f * | gan_matf_scale_s (Gan_Matrix_f *A, float a) |
Macro: Multiply matrix by scalar. | |
Gan_Matrix_f * | gan_matf_scale_i (Gan_Matrix_f *A, float a) |
Macro: Multiply matrix by scalar. | |
Gan_Matrix_f * | gan_matf_divide_s (Gan_Matrix_f *A, float a) |
Macro: Divide matrix by scalar. | |
Gan_Matrix_f * | gan_matf_divide_i (Gan_Matrix_f *A, float a) |
Macro: Divide matrix by scalar. | |
Gan_Matrix_f * | gan_matf_negate_q (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Negate matrix. | |
Gan_Matrix_f * | gan_matf_negate_s (Gan_Matrix_f *A) |
Macro: Negate matrix. | |
Gan_Matrix_f * | gan_matf_negate_i (Gan_Matrix_f *A) |
Macro: Negate matrix. | |
Gan_Matrix_f * | gan_matf_tpose_s (Gan_Matrix_f *A) |
Macro: Transpose matrix. | |
Gan_Matrix_f * | gan_matf_tpose_i (Gan_Matrix_f *A) |
Macro: Transpose matrix. | |
Gan_Matrix_f * | gan_matf_add_q (Gan_Matrix_f *A, Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Add two matrices and write result into a third. | |
Gan_Matrix_f * | gan_matf_add_s (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Add two matrices and return the result as a new matrix. | |
Gan_Matrix_f * | gan_matf_add_i1 (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Add two matrices and overwrite the first with the result. | |
Gan_Matrix_f * | gan_matf_add_i2 (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Add two matrices and overwrite the second with the result. | |
Gan_Matrix_f * | gan_matf_increment (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Increment a matrix with another matrix. | |
Gan_Matrix_f * | gan_matf_addT_q (Gan_Matrix_f *A, Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Add two matrices, the second transposed, and write result into a third. | |
Gan_Matrix_f * | gan_matf_addT_s (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Add two matrices, the second transposed, and return a new result matrix. | |
Gan_Matrix_f * | gan_matf_incrementT (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Increment a matrix with the transpose of another matrix. | |
Gan_SquMatrix_f * | gan_matf_add_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Add two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_add_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Add two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_addT_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Add two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_addT_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Add two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_add_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Add two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_add_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Add two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_addT_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Add two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_addT_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Add two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_saddT_sym_q (const Gan_Matrix_f *A, Gan_SquMatrix_f *B) |
Macro: Add matrix to itself and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_saddT_sym_s (const Gan_Matrix_f *A) |
Macro: Add matrix to itself and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_sadd_sym_q (const Gan_Matrix_f *A, Gan_SquMatrix_f *B) |
Macro: Add matrix to itself and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_sadd_sym_s (const Gan_Matrix_f *A) |
Macro: Add matrix to itself and return the result as a new symmetric matrix. | |
Gan_Matrix_f * | gan_matf_sub_q (Gan_Matrix_f *A, Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Subtract two matrices and write result into a third. | |
Gan_Matrix_f * | gan_matf_sub_s (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Subtract two matrices and return the result as a new matrix. | |
Gan_Matrix_f * | gan_matf_sub_i1 (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Subtract two matrices and overwrite the first with the result. | |
Gan_Matrix_f * | gan_matf_sub_i2 (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Subtract two matrices and overwrite the second with the result. | |
Gan_Matrix_f * | gan_matf_decrement (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Decrement a matrix with another matrix. | |
Gan_Matrix_f * | gan_matf_subT_q (Gan_Matrix_f *A, Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Subtract two matrices, the second transposed, and write result into a third. | |
Gan_Matrix_f * | gan_matf_subT_s (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Subtract two matrices, the second transposed, and return new result matrix. | |
Gan_Matrix_f * | gan_matf_decrementT (Gan_Matrix_f *A, Gan_Matrix_f *B) |
Macro: Decrement a matrix with the transpose of another matrix. | |
Gan_Vector_f * | gan_matf_multv_q (const Gan_Matrix_f *A, const Gan_Vector_f *x, Gan_Vector_f *y) |
Macro: Multiply matrix and a vector, writing the result into another vector. | |
Gan_Vector_f * | gan_matf_multv_s (const Gan_Matrix_f *A, const Gan_Vector_f *x) |
Macro: Multiply matrix and a vector, returning the result as a new vector. | |
Gan_Vector_f * | gan_matTf_multv_q (const Gan_Matrix_f *A, const Gan_Vector_f *x, Gan_Vector_f *y) |
Macro: Multiply the transpose of a matrix by a vector. | |
Gan_Vector_f * | gan_matTf_multv_s (const Gan_Matrix_f *A, const Gan_Vector_f *x) |
Macro: Multiply transpose of matrix by a vector. | |
Gan_Matrix_f * | gan_matf_rmult_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Multiply two matrices and write result into a third. | |
Gan_Matrix_f * | gan_matf_rmult_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply two matrices and return the result as a new matrix. | |
Gan_Matrix_f * | gan_matf_rmultT_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Multiply a matrix by the transpose of another and write result into a third. | |
Gan_Matrix_f * | gan_matf_rmultT_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply a matrix by the transpose of another and return a new matrix. | |
Gan_Matrix_f * | gan_matTf_rmult_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Multiply the transpose of a matrix by another matrix. | |
Gan_Matrix_f * | gan_matTf_rmult_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply the transpose of a matrix by another matrix. | |
Gan_Matrix_f * | gan_matTf_rmultT_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_Matrix_f *C) |
Macro: Multiply the transpose of a matrix by the transpose of another matrix. | |
Gan_Matrix_f * | gan_matTf_rmultT_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply the transpose of a matrix by the transpose of another matrix. | |
Gan_SquMatrix_f * | gan_matf_rmult_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Multiply two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_rmult_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_rmultT_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Multiply two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_rmultT_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_rmult_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Multiply two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_rmult_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_rmultT_sym_q (const Gan_Matrix_f *A, const Gan_Matrix_f *B, Gan_SquMatrix_f *C) |
Macro: Multiply two matrices and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matTf_rmultT_sym_s (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Multiply two matrices and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_srmultT_q (const Gan_Matrix_f *A, Gan_SquMatrix_f *B) |
Macro: Multiply matrix by itself and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_srmultT_s (const Gan_Matrix_f *A) |
Macro: Multiply matrix by itself and return the result as a new symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_slmultT_q (const Gan_Matrix_f *A, Gan_SquMatrix_f *B) |
Macro: Multiply matrix by itself and write result into a symmetric matrix. | |
Gan_SquMatrix_f * | gan_matf_slmultT_s (const Gan_Matrix_f *A) |
Macro: Multiply matrix by itself and return the result as a new symmetric matrix. | |
Gan_Matrix_f * | gan_matf_invert_s (const Gan_Matrix_f *A) |
Macro: Inverts general square matrix. | |
Gan_Bool | gan_matf_same_dims (const Gan_Matrix_f *A, const Gan_Matrix_f *B) |
Macro: Checks that two matrices have the same number of rows and columns. | |
Gan_Matrix_f * | gan_matf_insert (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const Gan_Matrix_f *B, unsigned long rB, unsigned long cB, unsigned long rows, unsigned long cols) |
Macro: Insert part of generic matrix in another generic matrix. | |
Gan_Matrix_f * | gan_matf_insertT (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const Gan_Matrix_f *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_Matrix_f * | gan_matf_insertv (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const Gan_Vector_f *x, unsigned long rx, unsigned long rows) |
Macro: Insert part of column vector in a generic matrix. | |
Gan_Matrix_f * | gan_matf_insertvT (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const Gan_Vector_f *x, unsigned long rx, unsigned long cols) |
Macro: Insert part of row vector in a generic matrix. | |
Gan_Bool | gan_matf_test_dims (const Gan_Matrix_f *A, unsigned long rows, unsigned long cols) |
Macro: Test dimensions of generic matrix. | |
size_t | gan_matf_data_size (unsigned long rows, unsigned long cols) |
Macro: Returns size of data array in bytes needed to hold matrix data. | |
Gan_Matrix_f * | gan_matf_extract_s (const Gan_Matrix_f *A, unsigned long r0, unsigned long c0, unsigned long rows, unsigned long cols) |
Macro: Extracts rectangular part of matrix. | |
Gan_Matrix_f * | gan_matf_fscanf_s (FILE *fp, const char *prefix, int prefix_len) |
Macro: Read matrix from file. | |
Gan_Matrix_f * | gan_matf_fread_s (FILE *fp, gan_uint32 *magic_number) |
Macro: Read matrix from file. | |
Gan_Matrix_f * | gan_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_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. | |
Gan_SquMatrix_f * | gan_matf_add_sym_gen (const Gan_Matrix_f *A, Gan_TposeFlag A_tr, const Gan_Matrix_f *B, Gan_TposeFlag B_tr, struct Gan_SquMatrix_f *C) |
Add general size matrices producing a symmetric matrix. | |
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. | |
Gan_Vector_f * | gan_matf_multv_gen (const Gan_Matrix_f *A, Gan_TposeFlag A_tr, const Gan_Vector_f *x, Gan_Vector_f *y) |
Multiply matrix and a vector. | |
Gan_Matrix_f * | gan_matf_rmult_gen (const Gan_Matrix_f *A, Gan_TposeFlag A_tr, const Gan_Matrix_f *B, Gan_TposeFlag B_tr, Gan_Matrix_f *C) |
Gan_SquMatrix_f * | gan_matf_rmult_sym_gen (const Gan_Matrix_f *A, Gan_TposeFlag A_tr, const Gan_Matrix_f *B, Gan_TposeFlag B_tr, struct Gan_SquMatrix_f *C) |
Gan_Matrix_f * | gan_matf_insert_gen (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const 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_f * | gan_matf_insertv_gen (Gan_Matrix_f *A, unsigned long rA, unsigned long cA, const struct Gan_Vector_f *x, Gan_TposeFlag x_tr, unsigned long rx, unsigned long size) |
Part of: Gandalf Library