On Thu, Jun 24, 2010 at 4:58 PM, David Mertens <[email protected]> wrote:
> On Thu, Jun 24, 2010 at 3:59 PM, P Kishor <[email protected]> wrote:
>>
>> Imagine, I want to end up with a large, 2D piddle $p, whose every
>> element is a 1D piddle $q, so, really, a 3D piddle. But, it is easier
>> to think of it as a 2D piddle, a rectangular grid of piddles.
>>
>> This rectangular piddle is (i x j), say, (2000 x 1500). Each element
>> in this (i x j) piddle has a serial number, starting at coordinates
>> (0,0) at the top left, which is 1, and increasing to the right most
>> edge, then down one row and left, then to the right most edge, and so
>> on. So, in my example 2D (i x j) piddle, the bottom-most, right-most
>> element's coordinates are (1999 x 1499) and its serial number is 3e6.
>>
>> I can get the content of any element in the 2D piddle with $p->at(x,
>> y) where (x, y) is the coordinate pair. Also, thanks to David Mertens,
>> if I know the serial number of an element, I can find its content with
>> $p->flat->at(n), where n is its serial number between 1 and 3e6.
>>
>> Ok. Here's the rub. I don't have all the data. I get the data
>> incrementally. That is, my 2k x 1.5k 2D piddle is really made up like
>> a patchwork quilt, and I get the patches one at a time. Every patch is
>> a series of 1D piddles ($q from my para 1 above) with a unique serial
>> number between 1 and 3e6, so I know, for any set of 1D piddles, which
>> patch they will go to. By the way, is there a PDL method to find the
>> indexes (coordinate pair) of an element in my 2D piddle, given its
>> serial number? I could write one in Perl, but PDL might have one
>> already.
>>
>> So, I want to glue(), which, btw, is really clever method, my patches
>> to each other, one by one, till they end up as the 2000x1500 2D
>> piddle.
>>
>> How do I do the above?
>>
>>
>> --
>> 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
>
> Puneet -
>
> If you're going to be building your matrix in a random order, then you'll
> have to pre-allocate it, as far as I can figure.
>

Right. That sounds like sound advice. So, I create a fake 2D piddle,
and then, as I get my data, replaces each patch worth of slice with
real data, using the serial numbers as a way of "locating" the patches
in the whole fabric.

> In terms of obtaining the serial address, I think you should probably just
> write a small function to handle it for you. I don't think there's a piddle
> method for it.

Yes, that should be easy.


>
> David
>
> --
> Sent via my carrier pigeon.
>



-- 
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

Reply via email to