提交记录 16132


用户 题目 状态 得分 用时 内存 语言 代码长度
lkmcfj mmmd1k. 测测你的双精度矩阵乘法-1k Accepted 100 3 s 8200 KB C++ 672 B
提交时间 评测时间
2021-04-04 11:30:25 2021-04-04 11:30:32
#define idx(i, j) ((i) * n + (j))

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 ++)
				{
					double a_ij = A[idx(i, j)];
					register double *c_i = C + i * n;
                                        register const double *b_j = B + j * n;
					const int UNROLL = 4;
					for (int k = 0; k < n; k += UNROLL)
					{
						c_i[0] += a_ij * b_j[0];
						c_i[1] += a_ij * b_j[1];
						c_i[2] += a_ij * b_j[2];
						c_i[3] += a_ij * b_j[3];
                                                c_i += UNROLL;
                                                b_j += UNROLL;
					}
				}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #13 s8 MB + 8 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2021-04-21 21:29:17 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用