Gabor -

I've never used rotate before, but this looks right to me.  I find that a
lot of functions are implemented to act on one or two particular dimensions,
so you have to call xchg or transpose to get it to act on your particular
dimension of interest.

David

On Wed, Nov 11, 2009 at 7:22 AM, Gabor Szabo <[email protected]> wrote:

> Hi again,
>
>
> perldl> p $q
>
> [
>  [0 0 0]
>  [0 1 0]
>  [0 0 0]
> ]
>
> I can use rotate (with wrap) to move values right or left.
>
> perldl> p $q->rotate(1)
>
> [
>  [0 0 0]
>  [0 0 1]
>  [0 0 0]
> ]
>
> perldl> p $q->rotate(-1)
>
> [
>  [0 0 0]
>  [1 0 0]
>  [0 0 0]
> ]
>
>
> Is there a way to move them up and down as well?
> Probably you would talk about rotating along the 2nd dimension.
>
> I managed to do this:
>
> perldl> p $q->transpose->rotate(-1)->transpose
>
> [
>  [0 1 0]
>  [0 0 0]
>  [0 0 0]
> ]
>
> perldl> p $q->transpose->rotate(1)->transpose
>
> [
>  [0 0 0]
>  [0 0 0]
>  [0 1 0]
> ]
>
> but I wonder if this is correct at all and if there was a better way to do
> it?
>
> Gabor
>
> _______________________________________________
> 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

Reply via email to