[Rd] Speeding up matrix multiplies

James Cloos cloos+r-devel at jhcloos.com
Fri Aug 27 22:31:57 CEST 2010


I just tried out the effects of using R's NA value¹ with C arithmetic
on an amd64 linux box.

I always got a NAN result for which R's R_IsNA() would return true.

At least on this platform, NAN's propagate w/o a change in their
lower 32 bits.

If NA is supposed to propagate the way NaN is spec'ed to in IEEE754,
then on some platforms it should be OK to skip the NA/NaN checks and
let the optimised routines handle all of the matrix multiplies.

A configure test could be used to determine whether the current
platform is one where NA/NaN checks are required.

-JimC

1] given:
         union rd { double d; uint64_t l; }; union rd u;
   then:
         u.d is an R NA iff both of:
             u.l & 0x7ff0000000000000 == 0x7ff0000000000000
             u.l & 0x00000000ffffffff == 1954;
         are true.
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



More information about the R-devel mailing list