test_IPKF

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

matrix.h File Reference

matrix.h File Reference

File containing the function to manipulates matrices. More...

Go to the source code of this file.

Data Structures

struct  s_matrix
 struct matrix allows to execute matrix computation More...

Typedefs

typedef struct s_matrix matrix
 struct matrix allows to execute matrix computation

Functions

int CreateMatrix (matrix *m)
 this function allows to allocate a matrix in memory
void DeleteMatrix (matrix *m)
 this function allows to delete from memory a matrix struct
int InitMatrix (matrix *m, int row, int col)
 this function initialize a matrix
int MxM (matrix *a, matrix *b, matrix *r)
 this function allows to compute the product between 2 matrices
int axM (matrix *m, float a, matrix *r)
 this function allows to compute the product between a scalar and a matrix
int Sum (matrix *a, matrix *b, matrix *r)
 this function allows to compute the sum between two matrices
int Sub (matrix *a, matrix *b, matrix *r)
 this function allows to compute the subtraction between two matrices
int Traspost (matrix *m, matrix *r)
 this function allows to compute the traspost of a matrix
int Inv (matrix *m, matrix *inv_m)
 this function allows to compute the inverse of a matrix using the Gauss algorithm
void CrossProd (matrix *v, matrix *w, matrix *r)
 Computes the cross product between two vectors.
void Print_Matrix (matrix *m)
 print the matrix in the prompt

Detailed Description

File containing the function to manipulates matrices.

Author:
Daniele Ludovico
Date:
20/3/2016

Definition in file matrix.h.


Typedef Documentation

typedef struct s_matrix matrix

struct matrix allows to execute matrix computation


Function Documentation

int axM ( matrix m,
float  a,
matrix r 
)

this function allows to compute the product between a scalar and a matrix

Parameters:
mis the pointer to the matrix
ais the scalar number
ris the pointer to the result
Returns:
0 if the the product is computed correctly
1 if the number of row of a is different from number of row of r
2 if the number of col of a is different from number of col of r

Definition at line 109 of file matrix.c.

int CreateMatrix ( matrix m )

this function allows to allocate a matrix in memory

Parameters:
matrixpointer to the object to allocate
Returns:
0 if the allocation is done correctly
1 if there is not enough space in memory to create a new matrix

Definition at line 3 of file matrix.c.

void CrossProd ( matrix v,
matrix w,
matrix r 
)

Computes the cross product between two vectors.

Parameters:
vis the first vector
wis the second vector
ris address to the resulting matrix
Returns:
void

Definition at line 360 of file matrix.c.

void DeleteMatrix ( matrix m )

this function allows to delete from memory a matrix struct

Parameters:
matrixpointer to the object to delete
Returns:
void

Definition at line 34 of file matrix.c.

int InitMatrix ( matrix m,
int  row,
int  col 
)

this function initialize a matrix

Parameters:
mis the pointer to the matrix to initialize
rowis the number of row of the matrix
colis the number of column of the matrix
Returns:
0 if the allocation is done correctly
1 if there is not enough space in memory to create a new matrix

Definition at line 52 of file matrix.c.

int Inv ( matrix m,
matrix inv_m 
)

this function allows to compute the inverse of a matrix using the Gauss algorithm

Parameters:
mis the pointer to the original matrix
inv_mis the pointer to the result
Returns:
0 if the inversion is done correctly
1 if m is not a square matrix
2 if the number of row of m is different from the row of inv_m
3 if the number of column of m is different from the column of inv_m
4 if m is not invertible

Definition at line 262 of file matrix.c.

int MxM ( matrix a,
matrix b,
matrix r 
)

this function allows to compute the product between 2 matrices

Parameters:
ais the first element of the product
bis the second element of the product
ris the matrix which will contain the result
Returns:
0 if the product is computed correctly
1 if the number of column of a is different from the row of b
2 if the number of row of a is different from number of row of r
3 if the number of column of b is different from number of column of r

Definition at line 59 of file matrix.c.

void Print_Matrix ( matrix m )

print the matrix in the prompt

Parameters:
mis the pointer to the matrix to print
Returns:
void

Definition at line 385 of file matrix.c.

int Sub ( matrix a,
matrix b,
matrix r 
)

this function allows to compute the subtraction between two matrices

Parameters:
ais the pointer to the first matrix
bis the pointer to the second matrix
cis the pointer to the result
Returns:
0 if the subtraction is computed correctly
1 if the number of column of a is different from the column of b
2 if the number of row of a is different from number of row of b
3 if the number of row of a is different from number of row of r
4 if the number of column of a is different from number of column of r

Definition at line 186 of file matrix.c.

int Sum ( matrix a,
matrix b,
matrix r 
)

this function allows to compute the sum between two matrices

Parameters:
ais the pointer to the first matrix
bis the pointer to the second matrix
cis the pointer to the result
Returns:
0 if the sum is computed correctly
1 if the number of column of a is different from the column of b
2 if the number of row of a is different from number of row of b
3 if the number of row of a is different from number of row of r
4 if the number of column of a is different from number of column of r

Definition at line 151 of file matrix.c.

int Traspost ( matrix m,
matrix r 
)

this function allows to compute the traspost of a matrix

Parameters:
mis the pointer to the matrix to be trasposed
ris the pointer to the result
Returns:
0 if the operation is done correctly
1 if the number of row of m is different from the column of r
2 if the number of column of m is different from the row of r

Definition at line 221 of file matrix.c.