Beginning of the new era
Matrix - is a library with basic operations, written on C.
It allows to create, delete, add/subtract/multiply matrices.
Also you can get determinant, inverse and algebraic complements in O(n^3) time complexity.
$ git clone https://github.com/georghegel/matrix.git
$ cd matrix
$ make
For testing:
$ make test
Pretty similar to macOS.
for now make test
doesn't work correctly, and I'm fixing it
$ git clone https://github.com/georghegel/matrix.git
$ cd matrix
$ make
For testing:
$ make test
not ready yet
Create matrix (initial matrix will be filled with zeros):
matrix_t my_matrix;
create_matrix(3, 3, &my_matrix);
my_matrix[0][0] = 7;
my_matrix[0][1] = 3;
my_matrix[0][2] = 4;
my_matrix[1][0] = 5;
my_matrix[1][1] = 2;
my_matrix[1][2] = 1;
my_matrix[2][0] = 9;
my_matrix[2][1] = 11;
my_matrix[2][2] = 17;
Delete matrix:
delete_matrix(&my_matrix);
Next function returns 0 if element-wise comparison is successful (e.g. each corresponding element are equal).
Otherwise 1 will return.
matrix_t A, B;
create_matrix(3, 3, &A);
create_matrix(3, 3, &B);
// fill matrix A and B with your values as we did before
int res = eq_matrix(&A, &B);
matrix_t A, B, result;
create_matrix(3, 3, &A);
create_matrix(3, 3, &B);
sum_matrix(&A, &B, &result);
sub_matrix(&A, &B, &result);
Scalar multiplication:
double number = 2.73;
mult_number(&A, number, &result);
matrix_t A, B, result;
create_matrix(3, 4, &A);
create_matrix(4, 5, &B);
mult_matrix(&A, &B, &result);
matrix_t A, result;
create_matrix(3, 7, &A);
transpose(&A, &result);
// result matrice's rows and cols = (7, 3);
Determinant:(a bit difficult concept)
double result = 0.0;
determinant_m(&A, &result);
inverse(&A, &result);
Algebraic complements matrix:
To understand this concept you should be familiar with minors, which is obvious.
complements(&A, &result);
[1] Кострикин - Введение в Алгебру
[2] Винберг - Курс алгебры
[3] Gauss elimination - wikipedia
[4] Invertible matrices - wikipedia