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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: PDL How to create/initialise a large byte piddle directly.
by explorer (Chaplain) on Oct 19, 2006 at 23:03 UTC |
Back to
Seekers of Perl Wisdom