Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: How to shift the columns of a PDL matrix

by lin0 (Curate)
on Jul 03, 2007 at 22:35 UTC ( #624802=note: print w/replies, xml ) Need Help??

in reply to How to shift the columns of a PDL matrix

Hi Anonymous Monk,

you could use something like:

$pdl = append(zeroes(1,$pdl->getdim(1)), $pdl(0:-2,:));

where $pdl is your 8 columns by 120 rows piddle

Note: I am assuming you are using PDL::NiceSlice



Replies are listed 'Best First'.
Re^2: How to shift the columns of a PDL matrix
by Anonymous Monk on Nov 04, 2016 at 09:42 UTC

    since you don't want to grow your matrix, it is even simpler to use rotate to shift your columns and then insert your new data.

    $pdl=$pdl->rotate(1); $pdl(0,).=$new_data # your vector.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://624802]
[Your Mother]: I prefer palatial fricatives.
[Lotus1]: https://en. wiki/%C3%87
[Your Mother]: I'm headed out west, sucker.
[Lotus1]: the west is the best, get here we'll do the rest
LanX chjuman !
[Eily]: do you pronunce that /xju:mən/ then ?
[Eily]: that's not what I'd call a silent h :)
[LanX]: see soundfile https://en. wiki/human# Pronunciation
[Your Mother]: Just Another Perl 'Acker.
[LanX]: I pronounce it 'juːmən'

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2017-03-27 17:06 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.