Well, you have to copy every puddle anyway, to collate them as you desire.
(Mobile) On Jun 21, 2010, at 4:36 PM, P Kishor <[email protected]> wrote: > Thanks Craig. > > On Mon, Jun 21, 2010 at 4:59 PM, Craig DeForest > <[email protected]> wrote: >> You are supposed to be able to pad it out by throwing them all into >> the >> constructor "pdl()", but there is currently a bug in the >> constructor that >> sometimes crashes in that case. >> >> Unfortunately, your best bet (other than fixing the constructor >> bug) is to >> use several lines: >> >> $dims = cat(pdl(map { $_->dims } @p))->mv(-1,0)->maximum; > > I really don't need to figure out the $dims. Fortunately, I already > know the correct value for the dims, so I can avoid the above step. > >> $pdl = new_from_specification(0...@p, $dims); >> for $i(0..$#p){ >> $pdl->(($i)) .= $p[$i]->range( 0 * $dims , $dims, 't'); >> } >> >> That copies each element of @p into the original array, with >> truncation as a >> boundary condition. > > So, let me understand the above (which is rather confusing to me). > Each element of @p is a piddle. One of the piddles dim is off. Since I > know what the correct dim is, I can figure out which piddle is off. > Can I modify just that specific piddle? In other words, I have a 2D > piddle that should have 2 dims of values, say, 1000 and 1000, but is > actually 990 and 1000. I want to pad just that one piddles one dim to > 1000. How do I do that? > > By not having to copy every piddle, that should speed up the > process, no? > > >> >> There's a slightly faster formulation using slice, but it is much >> yuckier to >> read. >> >> >> On Jun 21, 2010, at 3:47 PM, P Kishor wrote: >> >>> I have a bunch of "identical" piddles in an array @p that I am cat- >>> ing >>> together and mv-ing their dimensions so I can extract values from >>> them >>> from a single loop. Each piddle has two dimensions, say 'x' and >>> 'y' -- >>> >>> 1> $pdl = cat(@p)->mv(-1, 0); >>> 2> for my $i (1 .. $x) { >>> 3> for my $j (1 .. $y) { >>> 4> my $vals = $pdl(:,($i - 1),($j - 1)); >>> 5> } >>> 6> } >>> >>> I have encountered a problem... one of my piddles has different >>> dimension 'x' from other piddles. It is an error in the data, but I >>> don't want it to stop my work. Say, the value of $x is supposed to >>> be >>> 1000, but for one of the piddles, the value of $x is 990. This >>> causes >>> line 1 above to blow up with >>> >>> PDL: PDL::Ops::assgn(a,b): Parameter 'b' >>> PDL: Mismatched implicit thread dimension 1: should be 990, is 1000 >>> >>> Is there are way I can pad that piddle with the difference, so >>> things >>> proceed on? >>> >>> -- >>> Puneet Kishor >>> >>> _______________________________________________ >>> Perldl mailing list >>> [email protected] >>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >>> >> >> > > > > -- > 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
