From cloos+r-devel at jhcloos.com  Fri Aug 27 22:31:57 2010
From: cloos+r-devel at jhcloos.com (James Cloos)
Date: Fri, 27 Aug 2010 16:31:57 -0400
Subject: [Rd] Speeding up matrix multiplies
In-Reply-To: <20100823233927.GA21529@cs.toronto.edu> (Radford Neal's
	message of "Mon, 23 Aug 2010 19:39:27 -0400")
References: <20100823233927.GA21529@cs.toronto.edu>
Message-ID: <m3tymf3iga.fsf@carbon.jhcloos.org>

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



[Rd] Speeding up matrix multiplies
James Cloos