Site icon G. Mancusi's blog

[C] Matrix Computation Library

matrixcomp.c

https://github.com/GianlucaMancusi/matrix_computation

This github project is created by Gianluca Mancusi, Daniele Manicardi, Gianmarco Lusvardi – from the “Enzo Ferrari” Department of Engineering. Some useful Matrix Calculation tools optimized for each system.

This C library is designed to perform calculations on matrix. Here are some of the cool features:

We are pleased to receiving support!

//====== Useful functions =======

Calculates the determinant of any squared matrix of any dimension (NxN):

extern double det(const struct matrix *matr);

Reduce a matrix in row echelon form. For more information see Wikipedia

extern void rowEchelonForm(struct matrix *matr);

Transpose the input matrix (very fast):

extern void transposeMatrix(struct matrix *matr);

Multiply two compatible matrices:

extern struct matrix *mulmatr(const struct matrix *lhs, const struct matrix *rhs);

Creates a new matrix in the single pointer format:

extern struct matrix *creatematr(size_t rows, size_t cols);

Create a new empty matrix in the single pointer format:

extern struct matrix *createemptymatr(size_t rows, size_t cols);

Create a new “cloned from other” matrix in the single pointer format:

extern struct matrix *creatematrfrom(const double* matr, size_t row, size_t col);

Clone a matrix:

extern struct matrix *clonematr(const struct matrix* matr);

This feature allows you to find the complementary minor given rows and columns:

extern struct matrix* matrcompminor(const struct matrix *matr, int row, int col);

Change an entire row:

extern int matrrow(const struct matrix* matr, size_t rowid, const double *row);

Destroy and free memory of an allocated matrix:

extern void destroymatr(struct matrix* matr);

Fast way to access an element of a matrix without thinking too much about it:

extern double *elementAt(struct matrix *matr, size_t rowIndex, size_t colIndex);

 

Print to File a matrix (to print on screen use “stdout” standard file):

extern void printMatrix(struct matrix *matr, FILE *f);

 

Exit mobile version