Demo entry 6714387

matrixMul

   

Submitted by anonymous on Feb 13, 2018 at 00:03
Language: C++. Code size: 351 Bytes.

void matrixMulCpu(float * fpMatrixA, float * fpMatrixB, float * fpMatrixC, int m, int n, int k)
{
	float sum = 0.0f;

	for(int i = 0; i < m; i++)
	{
		for (int j = 0; j < n; j++)
		{
			for(int l = 0; l < k; l++)
			{
				sum += fpMatrixA[i * k + l] * fpMatrixB[l * n + j];
			}

			fpMatrixC[i * n + j] = sum;
			sum = 0.0f;
		}
	}
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).