Tim -
On Mar 6, 2012 1:51 AM, "Tim Haines" <[email protected]> wrote:
> Greetings, all.
>
> Is there a way of making PDL::Primitive::interpolate thread multiple
> x_i/y_i values over a single set of x values that also produces an output
> that is multidimensional?
>
> [code]
> my $x_i = sequence(10,3) * 1.25;
> my $y_i = $x_i **2 + 5.1;
> my $x = sequence(10)*2 + 3.2;
> my ($y, $err);
>
> # this gives dim errors
> ($y, $err) = interpolate($x, $x_i, $y_i);
>
> # this makes $y->dims == (10,1). Is it acting like interpND?
> ($y, $err) = interpolate($x, $x_i->xchg(0,1), $y_i->xchg(0,1));
>
> # what I want to happen
> my $y_3 = zeroes(10,3);
> my $err_3 = zeroes(10,3);
>
> for my $i (0..2)
> {
> ($y, $err) = interpolate($x, $x_i->slice(":,($i)"),
> $y_i->slice(":,($i)"));
> $y_3->slice(":,($i)") .= $y;
> $err_3->slice(":,($i)") .= $err;
> }
> [/code]
>
> I have a feeling that I shall have to resort to using PDL::PP to replace
> the for loop. I have yet to venture into that territory. Could someone
> provide me with some pointers on its usage?
>
> Many thanks in advance.
>
> - Tim
>
> P.S. I know I should be using NiceSlice, but I still can't get used to its
> syntax. :-)
>
>
> _______________________________________________
> PDL-porters mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
>
>
Regarding your concerns about learning PDL::PP, I began learning about that
machine relatively early in my time using PDL. Oddly, I didn't really
understand the full usefulness of PDL threading and dimension munging until
I had written a handful of PDL::PP functions. So, don't be afraid to learn
PDL::PP. :-)
David
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl