MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica 9 does not read mathematica 8 ".mx" files

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129077] Re: Mathematica 9 does not read mathematica 8 ".mx" files
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Thu, 13 Dec 2012 04:06:33 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <ka6n22$h2m$1@smc.vnet.net>

On 11/12/2012 07:23, NBM wrote:
> Having written a lot of code on M8, I recently switched to M9 and tried to
> run the code which starts by loading an .mx file written by M8, but M9 wouldn't read it saying that it was written on another machine. This is a major incompatibility issue between M8 and M9. Fortunately I kept my M8 installation, so for now, M9 is useless to me.
> Please a solution.
>
As others have commented, you can't move .MX files:

1)      Between versions of Mathematica.
2)      Between 32 and 64-bit implementations.
3)      (Possibly) between different platforms (Windows, Linux,etc.)

I used to use .mx files to store some really large partly symbolic 
expressions, because the saving and the read back were both fast. After 
some experimentation, I found that this was a good portable alternative:

str=OpenWrite[file,BinaryFormat->True];

  BinaryWrite[str,magic,"TerminatedString"];

  BinaryWrite[str,Compress[{expr,version}],"TerminatedString"];

Close[str]

(where expr containd the expression, and magic is some short string that 
enables you to do a sanity check when you read the file back in.

This is not quite as fast as using .mx, but it still seems faster than 
other alternatives.

Read the stuff back with two calls to BinaryRead[str,"TerminatedString"],
checking the first, and uncompressing the second.

Compress and Uncompress seem extraordinarily efficient applied to large 
expressions.

David Bailey
http://www.dbaileyconsultancy.co.uk






  • Prev by Date: Re: Mathematica 9 does not read mathematica 8 ".mx" files
  • Next by Date: Re: definite double integral issue
  • Previous by thread: Re: Mathematica 9 does not read mathematica 8 ".mx" files
  • Next by thread: Re: Mathematica 9 does not read mathematica 8 ".mx" files