提交记录 20101


用户 题目 状态 得分 用时 内存 语言 代码长度
TSKY mmmd1k. 测测你的双精度矩阵乘法-1k Accepted 100 734.574 ms 8200 KB C++14 745 B
提交时间 评测时间
2023-09-04 23:27:11 2023-09-04 23:27:14
#include <cstdint>
using namespace std;
template <size_t L, size_t M, size_t N>
struct MatMulKernel
{
    enum
    {
        row1 = L,
        col1 = M,
        row2 = M,
        col2 = N
    };
    template <typename Ty>
    static void matmul(const Ty *A, const Ty *B, Ty *C)
    {
        for (size_t j = 0; j < col1; j++)
        {
            for (size_t i = 0; i < row1; i++)
            {
                Ty A_ij = A[i * col1 + j];
                for (size_t k = 0; k < col2; k++)
                {
                    C[i * col2 + k] += B[j * col2 + k] * A_ij;
                }
            }
        }
    }
};

void matrix_multiply(int n, const double *A, const double *B, double *C) {
	MatMulKernel<1024,1024,1024>::matmul(A,B,C);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1734.574 ms8 MB + 8 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2025-09-14 00:11:05 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠