Skip to content

Saving a matrix in binary format

1 message · Steven D. Moffitt

#
Dear Mr. Chatterjee,

I'm not aware of a function that does this generically, and I doubt there exists one in the standard relase of R for the following reason - different processors have different numerical formats that would require a specialized format for general purpose floating-point storage.  For example, Intel processors have a little endian architecture whereas Sparcs have a big endian architecture.  Different processors represent doubles differently, so that a read of a bits forming a double from one processor won't be correct for another.  at the present time, processors are transitioning from 32-bit to 64-bit, making it necessary to distinguish 64-bit doubles from 80-bit doubles from 128-bit 'long doubles.'  

In short, while it is possible to write a C/C++ program that would accomplish what you want, it wouldn't be portable.  Even an upgrade from an Intel x86 processor to an Itanium processor could give problems!

Steve Moffitt

Director of Research
WH Trading, LLC



---------- Original Message ----------------------------------
From: "Indrajit Chatterjee" <IChatterjee at axarosenberg.com>
Date:  Wed, 5 Apr 2006 11:16:19 -0700