我是靠谱客的博主 哭泣悟空,这篇文章主要介绍矩阵相乘 一维数组表示,现在分享给大家,希望可以做个参考。

// matrixMulti.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <iostream>

#define N 4
#define Len 16
void multi(int a[],int b[]){
    int i,j,t,k;
    //int cLen=N*N;
    int c[Len]={0};
    for(k=0;k<N*N;k++){
        i=k/N;
        j=k%N;
        for(t=0;t<N;t++)
        {
            c[k]+=a[N*i+t]*b[j+t*N];

        }
        printf("%d ",c[k]);
    }
}

int main(int argc, char* argv[])
{
    int a[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
    int b[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
    multi(a,b);
    return 0;
}

最后

以上就是哭泣悟空最近收集整理的关于矩阵相乘 一维数组表示的全部内容,更多相关矩阵相乘内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(114)

评论列表共有 0 条评论

立即
投稿
返回
顶部