-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrixcode.c
More file actions
43 lines (35 loc) · 877 Bytes
/
matrixcode.c
File metadata and controls
43 lines (35 loc) · 877 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<stdio.h>
#include<math.h>
int k = 99;
void iter(double*[], double*[], int, int);
int main(int argc, int* argv[]) {
int m = argv[0], n = argv[1];
double* A = (double*)malloc(m*n*sizeof(double));
double* b = (double*)malloc(m*m*sizeof(double));
//init W
for(int i = 0; i < m; ++i) {
for (int t = 0; t < n; ++t)
{
A[t + i*n] = i+t;
}
}
//k iterations
for(int v = 1; v < k; ++v){
//create b
for(int i = 0; i < m; ++i){
b[i + i*m] = cos(v*i);
}
//multiply A by b
iter(A, b, m, n);
}
return 1;
}
//performs the dot product operation
void iter(double* matrixA[], double* matrixB[], int m, int n) {
for(int i = 0; i < m; ++i) {
for (int t = 0; t < n; ++t)
{
int sum = 0;
}
}
}