Defines | Functions

src/linalg.h File Reference

STATUS: work in progress Linear Algebra. More...

#include "definitions.h"
#include "array.h"
#include <gsl/gsl_matrix.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define mat_IDX(m, i, j)   array_INDEX2( m, double, i, j )
 index matrix at i,j.
#define matrix_CHECK(flag, m)
 is m a matrix?
#define matrix_CHECKSQR(flag, m)
 is m a square matrix?
#define vec_IDX(v, i)   array_INDEX1( v, double, i )
 index vector at i.
#define vector_CHECK(flag, v)
 is v a vector?

Functions

Arraymatrix_get_col (Array *m, int col)
 get a column of a matrix as vector.
Arraymatrix_get_row (Array *m, int row, bool alloc)
 get a row of a matrix as vector.
Arraymatrix_mean (Array *a, int dim)
 calculate the mean of matrix a along dimension dim.
Arraymatrix_mult (const Array *m1, const Array *m2)
 Matrix Multiplication.
Arraymatrix_pca (Array *X, Array **var, bool alloc)
 Principal Components analysis.
gsl_matrix * matrix_to_gsl (Array *in, bool alloc)
 convert 2D- Array struct to gsl_matrix.
Arraymatrix_transpose (Array *m, bool alloc)
 Matrix transpose.

Detailed Description

STATUS: work in progress Linear Algebra.

matrices Vectors and Matrices
1D and 2D Array structs of DType DOUBLE are used to represent vectors and matrices, respectively. I.e. that each function starting with matrix_*( Array *m ) accepts only 2D Arrays of DType DOUBLE functions starting with vector_*( Array *m ) accept only 1D Arrays of DType DOUBLE. This is checked with the Macros matrix_CHECK() and vector_CHECK().

Definition in file linalg.h.