You can use range for that: $a = sequence(5) $b = pdl(1); $c = $a->range($b,[$a->dims],'p');
On Apr 9, 2008, at 3:00 PM, Art Davis wrote: > I haven't been able to make shiftleft work the way I want it. It may > not even be the right command, I can't understand the POD > documentation for it. > > What I want: > perldl> $a=sequence(5); p$a; > [ 0 1 2 3 4 ] > perldl> $c=<some PerlDL syntax on $a>; p$c; > [ 1 2 3 4 0 ] > > What I've tried: > perldl> $a=sequence(5); $b=pdl(1); > perldl> $c=shiftleft($a,$b,0); > Undefined subroutine &main::shiftleft called > perldl> $c = shiftleft $a, $b, 0; > Usage: PDL::shiftleft(a,b,c,swap) (you may leave temporaries or > output variables out of list) > perldl> $c = $a << $b; p$c; > [0 2 4 6 8] > perldl> $a->inplace->shiftleft($b,0); p$a; > [0 2 4 6 8] > > Making $b a Perl scalar doesn't seem to help. > > Can someone explain and/or provide a full example of the usage of > shiftleft and/or provide a tip for shifting an array? > > ActivePerl 5.10 > PDL 2.4.3 > > > Thanks! > --Art > _______________________________________________ > 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
