-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmatrix.h
69 lines (48 loc) · 1.48 KB
/
matrix.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
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
65
66
67
68
69
/*
-----------------------------------------------------------------
** Top contributors:
** Shiqi Wang and Suman Jana
** This file is part of the ReluVal project.
** Copyright (c) 2018-2019 by the authors listed in the file LICENSE
** and their institutional affiliations.
** All rights reserved.
-----------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <cblas.h>
#ifndef MATRIX_H
#define MATRIX_H
/* Define the structure of Matrix */
struct Matrix
{
float* data;
int row, col;
};
/* add the constant to matrix */
void add_constant(struct Matrix* A, float alpha);
/*matrix multiplication with factors */
void matmul_with_factor(struct Matrix* A,\
struct Matrix* B,\
struct Matrix* C,\
float alpha,\
float beta);
/* matrix multiplication */
void matmul(struct Matrix* A,\
struct Matrix* B,\
struct Matrix* C);
/* matrix multiplication with bias */
void matmul_with_bias(struct Matrix* A,\
struct Matrix* B,\
struct Matrix* C);
/* element-wise multiplication */
void multiply(struct Matrix* A, struct Matrix* B);
/* print matrix */
void printMatrix(struct Matrix* A);
/* print matrix to the file */
void fprintMatrix(FILE *fp, struct Matrix* A);
/* takes the relu of the matrix */
void relu(struct Matrix* A);
#endif