Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: double **

by samtregar (Abbot)
on Jul 02, 2008 at 21:15 UTC ( [id://695202]=note: print w/replies, xml ) Need Help??


in reply to double **

There isn't one. You've got a couple options that I know of. First, you could write pull the NVs out of your AVs and put them into a new double [][] that you New() and Safefree() on the spot. That will use lots of memory if your array is big. Alternately you could have your Perl code keep your data in packed C arrays to begin with, using something like Tie::CArray. Then you can write a little XS to put out the double** from that and pass it to your C code.

-sam

Replies are listed 'Best First'.
Re^2: double **
by pdupre (Acolyte) on Jul 03, 2008 at 15:55 UTC
    Hello Sam, thank for your email. SO my conclusion is that it is going to be efficient to call a c routine with a AoA, I imagined that the machine representation was close between a AoA and a double [][]! It looks like that I am wrong. Will it it be a lot more efficient to pass several double [] ? Regards. Patrick Dupre The University of York
        Thank again, I am just surprise to not find something ready to go (ie. conversion between double [][] and AoA). Patrick Dupre The University of York
      Yup, AVs and C arrays are very different beasts. If the volume of data is the same I don't think you'll see a big difference between a double[][] and several double[]s but only you know the details well enough to judge.

      -sam

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://695202]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-18 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found