📄 matmult.c
字号:
/* matmult.c * Test program to do matrix multiplication on large arrays. * * Intended to stress virtual memory system. * * Ideally, we could read the matrices off of the file system, * and store the result back to the file system! */#include "syscall.h"#define Dim 20 /* sum total of the arrays doesn't fit in * physical memory */int A[Dim][Dim];int B[Dim][Dim];int C[Dim][Dim];intmain(){ int i, j, k; for (i = 0; i < Dim; i++) /* first initialize the matrices */ for (j = 0; j < Dim; j++) { A[i][j] = i; B[i][j] = j; C[i][j] = 0; } for (i = 0; i < Dim; i++) /* then multiply them together */ for (j = 0; j < Dim; j++) for (k = 0; k < Dim; k++) C[i][j] += A[i][k] * B[k][j]; Exit(C[Dim-1][Dim-1]); /* and then we're done */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -