[R-sig-finance] Saving a matrix in binary format

Steven D. Moffitt steve.moffitt at mail.stuart.iit.edu
Wed Apr 5 22:01:02 CEST 2006


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

>Hi - is it possible to save and load a matrix in binary form using R?
>
> 
>
>For example save.matrix() - and load.matrix() , but where the saves and
>loads are in binary format for speed and compactness. 
>
>
>	[[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-finance at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>



More information about the R-sig-finance mailing list