提交记录 21988
提交时间 |
评测时间 |
2024-07-23 10:57:04 |
2024-07-23 10:57:05 |
#define idx(i, j) ((i) * n + (j))
#define expect(x, v) __builtin_expect(x, v)
#define likely(x) expect(!!(x), 1)
#define unlikely(x) expect(!!(x), 0)
#define unreachable() __builtin_unreachable()
#define assume(x) ({ if (!(x)) unreachable(); })
#define prefetch __builtin_prefetch
void matrix_multiply(int n, const double *A, const double *B, double *C) {
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
C[idx(i, j)] = 0;
for (int i = 0; i < n; i++) {
prefetch(C, idx(i, 0), 1);
for (int k = 0; k < n; k++) {
prefetch(A + idx(i, k), 0);
prefetch(B + idx(k, 0), 0);
for (int j = 0; j < n; j++) {
C[idx(i, j)] += A[idx(i, k)] * B[idx(k, j)];
}
}
}
}
Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-09-08 09:03:45 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用