On Tue, Jun 22, 2010 at 3:01 PM, Craig DeForest
<[email protected]> wrote:
> Looks like you're storing integer data in a double-precision floating-point
> PDL. (default data type is 'double'). Try using type declarations in your
> constructors -- e.g. "ones(short, $x)->dummy * pdl(short, @dm)"
>
ahhh...
-rw-r--r-- 1 punkish punkish 1289616 Jun 22 14:42 bin.dat
-rw-r--r-- 1 punkish punkish 1280000 Jun 22 15:07 pdl.dat
-rw-r--r-- 1 punkish punkish 14 Jun 22 15:07 pdl.dat.hdr
So much better. So, a modest technical question -- is a piddle,
internally, just like a packed value with some magic dust sprinkled on
it?
>
> On Jun 22, 2010, at 1:59 PM, P Kishor wrote:
>
>> Possibly naive question, but inquiring minds wanna know
>>
>> my $x = 400;
>> my $y = 200;
>> my $n = 20;
>>
>> my @dat = (1234, 123, 1, 0, 245, 5, 546, 10);
>>
>> store_pdl();
>> store_bin();
>>
>> sub store_pdl {
>> my $row = ones($x)->dummy * pdl(@dm);
>> my $img = ones($y)->dummy->dummy * $row;
>> my $hdr = writefraw($img, 'pdl.dat');
>> }
>>
>> sub store_bin {
>> open BIN, '>:raw', 'bin.dat';
>> for ( 0 .. $y ) {
>> for ( 0 .. $x ) {
>> printf BIN "%s", pack 's8', @dat;
>> }
>> };
>> close BIN;
>> }
>>
>> -rw-r--r-- 1 punkish punkish 1289616 Jun 22 14:42 bin.dat
>> -rw-r--r-- 1 punkish punkish 5120000 Jun 22 14:42 pdl.dat
>> -rw-r--r-- 1 punkish punkish 14 Jun 22 14:42 pdl.dat.hdr
>>
>> the piddle is approx. 4 times the size of the packed file. I was
>> expecting it to be bigger, but not 4 times bigger. Is there a way
>> around this?
>>
--
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl