-
Notifications
You must be signed in to change notification settings - Fork 1
/
matmath.h
28 lines (22 loc) · 1.04 KB
/
matmath.h
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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* matmul.h * * * * * * * * * * * * * * * * * * * * * * * * * */
/* created by: jordan bonecutter * * * * * * * * * * * * * * * */
/* 25 october 2019 * * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef MATMATH_H
#define MATMATH_H
#include <stdio.h>
typedef struct{
double** weights;
unsigned rows, cols;
} Matrix;
Matrix* matrix_new(unsigned rows, unsigned cols); /* new matrix with weights init to 0*/
Matrix* matrix_newr(unsigned rows, unsigned cols); /* new matrix with random weights */
void matrix_del(Matrix* A); /* free memory from allocd matrix */
void matrix_add(Matrix* A, Matrix* B, Matrix* C);/* C = A + B */
void matrix_mul(Matrix* A, Matrix* B, Matrix* C);/* C = AB */
void matrix_fnc(Matrix* A, Matrix* C, double (*f)(double)); /* C = f(A) */
void matrix_dump(Matrix* A, FILE* fp); /* dump to json file */
Matrix* matrix_res(FILE* fp); /* resurrect from json file */
#endif
/* eof */