矩阵乘法

vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b)
{
    vector<vector<ll>> res(a.size(),vector<ll>(b[0].size()));
    for (int i = 0; i < a.size(); i++)
    {
        for (int j = 0; j < b[0].size(); j++)
        {
            res[i][j] = 0;
            for (int k = 0; k < b.size(); k++)
            {
                res[i][j] += a[i][k] * b[k][j];
            }
        }
    }
    return res;
}

 

posted @ 2021-01-26 10:20  DeaL57  阅读(80)  评论(0编辑  收藏  举报