Hi A.N.,
Since these matrices are on the CPU, you can use routines like LAPACK’s dlag2s or slag2d
to make th metrics that you want to subtract to be the same precision and then subtract and
compute norm also through LAPACK.
MAGMA has similar routines if the matrices are on the GPU memory (magmablas_dlag2s and magmablas_slag2d).
If you do it in your code, like in the example below, if sub_fl is double, all you need to do is
sub_ft+=fabs(P_DA(i, j) - (double)P_SA(i, j));
or if sub_fl is float, do
sub_ft+=fabsf((float)P_DA(i, j) - (double)P_SA(i, j));
Note that I also changed abs (in math.h this is for integers) to fabs for double and fobs for float data.
Best regards,
Stan