Chris,

thanks for the answers.
I will probably write a wrapper for cases that I need often.

David, well, there is PDL::Reduce for aggregates. I was looking for
something similar for non-reducing functions, ie. rotate.
Ingo
On 06/12/2013 08:38 PM, David Mertens wrote:
> For the record, many functions in numpy allow you to specify the axis
> over which reductions are to be performed--precisely what you're
> looking for. This sounds nice until you realize that the concept
> doesn't scale up to higher dimensions or multiple input piddles very
> nicely. This is why PDL introduces the axis manipulation methods and
> always operates on the left-most axes. It is far more general.
>
> David
>
>
> On Tue, Jun 11, 2013 at 12:42 PM, Chris Marshall
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Hi Ingo-
>
>     <replying to perldl list as this is not pdl-porters only>
>
>     That is the current way to do so.  While is is a lot
>     to write, it is very general.  However, here are some
>     thoughts:
>
>     - you could implement a new rotate() method that
>       does what you need
>
>     - you could implement a do() method that evals and
>       generates the needed method
>
>     - work for PDL3 is going to enable more flexible dimension
>       assignments and permutation for threading and argument
>       passing
>
>     And yes, I find it tedious as well  :-)
>
>     --Chris
>
>     On Tue, Jun 11, 2013 at 11:49 AM, Ingo Schmid <[email protected]
>     <mailto:[email protected]>> wrote:
>     >
>     > Hi,
>     >
>     > is there a simple way to specify a dimension for a given
>     operation? What I
>     > mean is for example rotate along the n-th dimension. I knwo that
>     I can do
>     >
>     > $x->mv($n,0)->rotate($r)->mv(0,$n)
>     >
>     > but this is quite tedious, imo.
>     >
>     > I know there is PDL::Reduce for aggregates.
>     >
>     > What I mean is a syntax like
>     >
>     > $x->do('rotate',$n)
>     >
>     > or something similar.
>     > Does it exist?
>     >
>     > Ingo
>
>     _______________________________________________
>     Perldl mailing list
>     [email protected] <mailto:[email protected]>
>     http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
>
>
>
> -- 
>  "Debugging is twice as hard as writing the code in the first place.
>   Therefore, if you write the code as cleverly as possible, you are,
>   by definition, not smart enough to debug it." -- Brian Kernighan
>
>
> _______________________________________________
> 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