-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