Hello,
I'm trying to compare different methods for matrix multiplication. The first one is normal method:
do
{
                for (j = 0; j < i; j++)
                {
                        for (k = 0; k < i; k++)
                        {
                                suma = 0;
                                for (l = 0; l < i; l++)
                                        suma += MatrixA[j][l]*MatrixB[l][k];
                                MatrixR[j][k] = suma;
                        }
                 }
c++;
}while (c<iteraciones);
The second one consist on transpond the matrix B firstly and then do the multiplication by rows:
int f,co;
for (f=0;f<i;f++){
for (co=0;co<i;co++){
MatrixB[f][co]=MatrixB[co][f];
}
}
c=0;
do
{
                for (j = 0; j < i; j++)
                {
                        for (k = 0; k < i; k++)
                        {
                                suma = 0;
                                for (l = 0; l < i; l++)
                                        suma += MatrixA[j][l]*MatrixB[k][l];
                                MatrixR[j][k] = suma;
                        }
                 }
c++;
The second method supposed to be much faster, because we are accesing contiguos memory slots, but I'm not getting a significant improvement in the performance. Am I doing something wrong?
I can post the complete code, but I think is not needed.
Thanks a lot