summaryrefslogtreecommitdiff
path: root/matrix.h
blob: 97110367a0d520f0c4b20523fe115af324c78a60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#ifndef MATRIX_H
#define MATRIX_H

#define __MINGW_FEATURES__ 1

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>


typedef struct matrix{
	int rows;
	int cols;
	long double **data;
} matrix;

matrix *newMatrix(int rows, int cols);

void freeMatrix(matrix **m);

void saveMatrix(matrix *m, FILE *fp);

matrix *loadMatrix(FILE *fp);

void copyMatrix(matrix *dest, matrix *src);

matrix *cloneMatrix(matrix *m);

matrix *identityMatrix(int order);

void fillMatrix(matrix *m, long double n);

void addMatrix(matrix *m, long double n);

void subtractMatrix(matrix *m, long double n);

void multiplyMatrix(matrix *m, long double n);

matrix *addMatrices(matrix *a, matrix *b);

matrix *subtractMatrices(matrix *a, matrix *b);

matrix *multiplyMatrices(matrix *a, matrix *b);

matrix *HadamardProduct(matrix *a, matrix *b);

matrix *subMatrix(matrix *m, int row, int col);

long double determinant(matrix *m);

void cofactor(matrix *m);

matrix *transpose(matrix *m);

matrix *dotProduct(matrix *a, matrix *b);

void adjugate(matrix *m);

void invert(matrix *m);

void raiseMatrix(matrix *m, int n);

#endif