Er, sorry, that last should have been "labeled roll *right* and shift  
up".  The example is further complicated by the fact that 2-D PDLs  
print upside-down -- the Y dimension increases on subsequent lines of  
printout -- while they plot rightside-up -- the Y dimension increases  
as you go up the plot.

Anyway, for any index tricks involving boundary conditions in the  
original PDL, range() is your friend.


On Nov 12, 2009, at 9:05 AM, Craig DeForest wrote:

> p $q->range([1,0],3,'t'); # shift left
> p $q->range([-1,1],3,'t'); # shift right and down
> p $q->range([-1,-1],3,'pt'); # roll left and shift up
>
> On Nov 12, 2009, at 8:59 AM, Gabor Szabo wrote:
>
>> Now that I know how to rotate with a wrap - thank you all for your  
>> help -
>> I'd like to rotate (or shift or move?) without wrapping.
>>
>> I managed to do these, but I wonder if there is something more  
>> straight forward?
>>
>> perldl> $q = sequence(3,3);
>>
>> perldl> p $q
>>
>> [
>> [0 1 2]
>> [3 4 5]
>> [6 7 8]
>> ]
>>
>>
>> perldl> p $q->append(0)->slice("1:3")     # that is move left pad  
>> by 0
>>
>> [
>> [1 2 0]
>> [4 5 0]
>> [7 8 0]
>> ]
>>
>> perldl> p zeroes(1)->append($q)->slice("0:2")   # that is move  
>> right pad by 0
>>
>> [
>> [0 0 1]
>> [0 3 4]
>> [0 6 7]
>> ]
>>
>> perldl> p $q->transpose->append(0)->slice("1:3")->transpose     #  
>> move up
>>
>> [
>> [3 4 5]
>> [6 7 8]
>> [0 0 0]
>> ]
>>
>> perldl> p zeroes(1)->append($q->transpose)->slice("0:2")->transpose
>> # move down
>>
>> [
>> [0 0 0]
>> [0 1 2]
>> [3 4 5]
>> ]
>>
>>
>> perldl> p zeroes(1)->append($q->transpose)->slice("0:2")->transpose- 
>> >append(0)->slice("1:3")
>> # move down and left 1
>>
>> [
>> [0 0 0]
>> [1 2 0]
>> [4 5 0]
>> ]
>>
>> etc...
>>
>> 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