My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
matrix.h
Go to the documentation of this file.
1 #ifndef MATRICI_H
2 #define MATRICI_H
3 
4 #include <stdbool.h>
5 
19 typedef struct Matrix {
20  int lines;
21  int columns;
22 
23  double determinant;
24  double trace;
25 
26  double **value;
27  struct Matrix *inverse;
28 } Matrix;
29 
40 Matrix *create_matrix(int rows, int columns);
41 
49 void read_matrix(Matrix *a);
50 
59 int print_matrix(Matrix *a);
60 
71 Matrix *get_minor(Matrix *a, int line, int column);
72 
82 void multiply_matrix_with_scalar(Matrix *a, double scalar);
83 
98 int get_transpose(Matrix *a, Matrix **transpose);
99 
109 void destroy_matrix(Matrix *a);
110 
122 int compute_inverse(Matrix *a);
123 
131 double get_determinant(Matrix *a);
132 
146 int multiply_matrices(Matrix *a, Matrix *b,
147  Matrix **result);
148 
149 
150 
162 int add_matrices(Matrix *a, Matrix *b, Matrix **result);
163 
174 void copy_matrix(Matrix *a, Matrix **destination);
175 
185 Matrix *matrix_pow(Matrix *a, int power);
186 
198 bool compare_matrices(Matrix *a, Matrix *b);
199 
200 #endif
Matrix * create_matrix(int rows, int columns)
Returns a pointer to a Matrix with rows rows and columns columns. Note that the new matrix is empty...
bool compare_matrices(Matrix *a, Matrix *b)
Use this function to compare to matrices. The criteria used to compare the matrices are the dimension...
Matrix * get_minor(Matrix *a, int line, int column)
Returns the minorant of a matrix by a specific row and column.
int multiply_matrices(Matrix *a, Matrix *b, Matrix **result)
Multiplies the matrices a and b and stores their results in the matrix result. Note that the function...
Matrix * matrix_pow(Matrix *a, int power)
raise the matrix a to the power power.
double ** value
Definition: matrix.h:26
struct Matrix Matrix
int columns
Definition: matrix.h:21
int add_matrices(Matrix *a, Matrix *b, Matrix **result)
Use this function to add 2 matrices. Note that the result will be stored in a third matrix...
double get_determinant(Matrix *a)
Returns the determinant of a matrix.
int get_transpose(Matrix *a, Matrix **transpose)
Stores the transpose of the matrix a in the matrix transpose.
void multiply_matrix_with_scalar(Matrix *a, double scalar)
Multiplies a matrix a with an scalar. Note that the new value of the matrix will be the result of thi...
void read_matrix(Matrix *a)
Utility function used to read a matrix from the standard input.
void copy_matrix(Matrix *a, Matrix **destination)
Copies the contents of the matrix a to the matrix destinaation.
int print_matrix(Matrix *a)
utility function used to print a matrix to the standar output.
void destroy_matrix(Matrix *a)
struct Matrix * inverse
Definition: matrix.h:27
int compute_inverse(Matrix *a)
Computes the inverse of the matrix a. Note that the inverse of matrix a will be stored in the inverse...
int lines
Definition: matrix.h:20
Definition: matrix.h:19
double trace
Definition: matrix.h:24
double determinant
Definition: matrix.h:23