comparing two matrices or double values
I'm trying to compare two matrices to see if they are equal. They are stored in the same manner, in that I use a double pointer.
This is my code
Code:
for ( row = 0; row < rows; ++row )
{
for ( col = 0; col < cols; ++col )
{
int i = col * rows + row;
if(matrixD[i] != matrixC[i])
{
printf("matrixd, %8g, matrixC, %8g \n", matrixD[i], matrixC[i]);
flag = TRUE;
return flag;
}
}
}
This gives me a result
Quote:
matrixd, 21.544, matrixC, 21.544
The results are NOT equal!!
They seem to be the saem so should I be using some sort of comparison function. Somebody said maybe use L2Same - what is it and does anyone know how i would use it?
Thanks,
Colly.