-2
所以我想写一个C函数来计算两个数组的乘法,但我有点卡住了。矩阵乘法问题
double ** matrixMultiply(double **A, int nRowsOfA, int nColsOfA,
double **B, int nRowsOfB, int nColsOfB)
{
double **out;
int i, j, l;
out=(double **)malloc(nRowsOfA*sizeof(double *));
for (i=0;i<nRowsOfA; i++)
out[i]=(double *)malloc(nColsOfB*sizeof(double));
for (i=0;i<nRowsOfA; i++)
for (j=0; j<nColsOfB; j++)
{
Some calculation to figure out how to multiply the two matrices together.
}
return out;
}
我敢肯定它有事情做与i和j创建一个2-d阵列,但是,是的,我不知道如何执行它。
你能解释一下你面临什么问题吗 – akashchandrakar 2014-12-03 05:00:57
请更专注于哪些方法无效。 – Codor 2014-12-03 07:51:31