View Full Version : optimizing matrix multiplication

11-27-2004, 06:04 AM
Does anybody have a working algorithm or full copy of code that optimizes matrix multiplication in the x86 assembly language?

I know a basic algorithm in C:
for (i=0;i<BLOCK_SIZE;i++)
for (j=0;j<BLOCK_SIZE;j++)
for (k=0;k<BLOCK_SIZE;k++)
c[i*MAX+j] += a[i*MAX+k]*b[k*MAX+j];

but, does anybody know a faster one?

11-29-2004, 05:17 PM
You could download the DirectX SDK and import the library:
Use header:
#include <d3dx.h>

Use function:
D3DXMatrixMultiply(Result, Mat1, Mat2);

(note: the library name and header might be off slightly, it may be something like d3dx8.lib and d3dx8.h, you can easily check online though)