Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

PDL How to create/initialise a large byte piddle directly.

by BrowserUk (Pope)
on Oct 19, 2006 at 21:44 UTC ( #579474=perlquestion: print w/ replies, xml ) Need Help??
BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

I can initialise a large 2D piddle using zeroes and then convert that to a byte piddle:

perldl> $a = zeroes 1000, 1000 perldl> $b = byte $a perldl> help vars PDL variables in package main:: Name Type Dimension Flow State Mem ---------------------------------------------------------------- $a Double D [1000,1000] P 7.63Mb $b Byte D [1000,1000] P 0.95Mb

I can then undef $a to discard the default Double piddle and recover space

perldl> undef $a perldl> help vars PDL variables in package main:: Name Type Dimension Flow State Mem ---------------------------------------------------------------- $b Byte D [1000,1000] P 0.95Mb

And I can do that all in one line:

perldl> $c = byte zeroes 1000,1000 perldl> help vars PDL variables in package main:: Name Type Dimension Flow State Mem ---------------------------------------------------------------- $c Byte D [1000,1000] P 0.95Mb $b Byte D [1000,1000] P 0.95Mb

but it appears as if the latter still creates the 8-times bigger intermediary before automatically discarding it.

Is there a way to create a large 2D byte piddle directly?

I'm just starting to find my way around the PDL docs and I seem to be missing this example.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Comment on PDL How to create/initialise a large byte piddle directly.
Select or Download Code
Re: PDL How to create/initialise a large byte piddle directly.
by explorer (Chaplain) on Oct 19, 2006 at 23:03 UTC

    From PDL::Core:

    $c = zeroes( byte, 1000, 1000);
    Update: Is VITAL for you to subscribe to pdl mailing list!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://579474]
Approved by grep
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2014-10-23 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (128 votes), past polls