Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Hello, all. I'm having an issue with a large and difficult-to-produce piddle matrix that I made on a Mac OS with 64 architecture(8-byte long), which I want to use in a perl program on a Windows OS with 64 architecture (4-byte long). If at all possible, I want to avoid recreating this data.

I want to load in a matrix, slice a row, then calculate the Pearson's correlation of that row against each other row using PDL::Stats::Basic corr. This works fine when I create a matrix in Windows and find the correlation in Windows, and it also works when I use the data I want to use to find the correlation on Mac, but not when I use data from the Mac OS in Windows. I've tried using PDL::IO::Storable and PDL::IO::Dumper. When I save/load the matrix using PDL::IO::Storable, I get this error:

Long integer size is not compatible at C:/Perl64/lib/Storable.pm line +380, at test.pl line 6.
When I save/load the matrix using PDL::IO::Dumper, it loads fine, but the correlation no longer works. Here's a MWE:
# On Mac OS use PDL; use PDL::IO::Dumper; my $a = random(8,150); PDL::IO::Dumper::fdump($a, 'a.pldl'); # On Windows OS use PDL; use PDL::Stats::Basic; use PDL::IO::Dumper;` my $a = frestore('a.pldl'); my $b = $a->slice(':,3'); my $c = $a->corr($b); print $c->slice('(0)'), "\n";

This code returns '-1.#IND', which is Windows for nan. Am I getting caught by the different data sizes again?


In reply to Mac to Windows Data Incompatibility by goshawk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (7)
    As of 2014-04-21 02:15 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (489 votes), past polls