forked from PierreSenellart/matrix_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix.h
More file actions
28 lines (21 loc) · 616 Bytes
/
matrix.h
File metadata and controls
28 lines (21 loc) · 616 Bytes
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
#ifndef MATRIX_H
#define MATRIX_H
#include <stdbool.h>
#include <stdio.h>
typedef double scalar;
typedef struct matrix {
unsigned n1, n2;
bool ok;
scalar *data;
} matrix;
matrix matrix_create(unsigned n1, unsigned n2, scalar v);
void matrix_destroy(matrix m);
matrix matrix_identity(unsigned n);
scalar *matrix_get(matrix m, unsigned i, unsigned j);
matrix matrix_add(matrix m, matrix n);
void matrix_print(FILE *f, matrix m);
matrix add_matrix(matrix m, matrix n);
matrix mul_matrix(matrix m, matrix n);
matrix fast_pow(matrix m, unsigned n);
matrix scal_mul(matrix m, scalar l);
#endif /* MATRIX_H */