On Tue, Jan 24, 2012 at 12:03 PM, Chris Marshall <[email protected]>wrote:
> Your example used ->dummy() which is a call to > the original ->slice() method for the length of the > dummy dim. Niceslice syntax would be something > like $vpix3(,,,,*128)->info but you'll note the explicit > list of dimension commas. > > I don't see an easy way to get the last dimension > of a given size without some mv() or such. Usually > if the last dimension is of size 1 it gets autopromoted > to whatever length is needed for a threaded operation. > > Cheers, > Chris > *scratches head* That's a good point. Ingo, what *were* you doing that for, anyway? Why not just say $cab2->dummy(-1)? There are uses, of course, but I'm curious is yours is one of them or not. David On Tue, Jan 24, 2012 at 12:52 PM, Ingo Schmid <[email protected]> wrote: > > On 01/24/2012 06:37 PM, Chris Marshall wrote: > >> > >> For what it is worth, the slice() syntax for a dummy dimension > >> of size a is '*a' and not '* a' or anything else. That said, it could > >> be made more permissive without breaking anything. The > >> niceslice syntax does work with this construct... > > > > I was using Niceslice but I guess you mean something else. > > > >> Cheers, > >> Chris > >> > >> On Tue, Jan 24, 2012 at 12:11 PM, Ingo Schmid<[email protected]> wrote: > >>> > >>> Hi, > >>> a minor bug but annoying to debug ... took me about an hour to find > >>> what's > >>> wrong ... > >>> > >>> PDL (latest build) produced the following error : > >>> > >>> print $cab2->dummy(-1,$$p{ky})->info; > >>> > >>> $cabc2->info: PDL: Double D [128,6,1,2,8] > >>> > >>> $$p{ky} is ' 128 ' - single quotes are only to show the padding white > >>> space. > >>> > >>> > >>> Invalid slice str ',,,,,* 128 ': ' 128 ' at Basic/Core/Core.pm.PL(i.e. > >>> PDL::Core.pm) line 396 > >>> PDL::Core::barf('Invalid slice str \',,,,,* 128 \': \' 128 \'') > >>> called > >>> at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 1592 > >>> PDL::dummy('PDL=SCALAR(0x1df98c0)', -1, ' 128 ') called at > >>> /home/ingo/perl/reco_utils.pm line 84 > >>> reco_utils::epi('PDL=SCALAR(0x1df9998)', 'PDL=SCALAR(0x1df98a8)', > >>> 'PDL=SCALAR(0x1df9d28)', 'HASH(0x1dc9830)') called at > >>> /home/ingo/perl/reco_utils.pm line 364 > >>> reco_utils::fou('PDL=SCALAR(0x1df9bf0)', 'HASH(0x1dc9830)', > >>> 'PDL=SCALAR(0x1df9f38)') called at /home/ingo/perl/offline-reco.plline > >>> 263 > >>> at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 396 > >>> PDL::Core::barf('Invalid slice str \',,,,,* 128 \': \' 128 \'') > >>> called > >>> at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 1592 > >>> PDL::dummy('PDL=SCALAR(0x1df98c0)', -1, ' 128 ') called at > >>> /home/ingo/perl/reco_utils.pm line 84 > >>> reco_utils::epi('PDL=SCALAR(0x1df9998)', 'PDL=SCALAR(0x1df98a8)', > >>> 'PDL=SCALAR(0x1df9d28)', 'HASH(0x1dc9830)') called at > >>> /home/ingo/perl/reco_utils.pm line 364 > >>> reco_utils::fou('PDL=SCALAR(0x1df9bf0)', 'HASH(0x1dc9830)', > >>> 'PDL=SCALAR(0x1df9f38)') called at /home/ingo/perl/offline-reco.plline > >>> 263 > >>> Died at /home/ingo/perl/offline-reco.pl line 351. > >>> > >>> The following works: > >>> > >>> print $cab2->dummy(-1,($$p{ky})*1.)->info; > >>> > >>> > >>> > >>> > >>> _______________________________________________ > >>> Perldl mailing list > >>> [email protected] > >>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > >>> > > > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > -- Sent via my carrier pigeon.
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
