Hi, For that specific usage, rotate works too. I do not know if that is the general solution you seek.
p $a [0 1 2 3 4] p rotate $a,4 [1 2 3 4 0] p rotate $a,-1 [1 2 3 4 0] -ashish On Wed, 9 Apr 2008, 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 > -ashish Ashish Mahabal, Caltech Astronomy, Pasadena, CA 91125 http://www.astro.caltech.edu/~aam aam at astro.caltech.edu The most erroneous stories are those we think we know best - and therefore never scrutinize or question. -Stephen Jay Gould (1941 - 2002) _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
