primitive.t (PDL-2.080) | : | primitive.t (PDL-2.081) | ||
---|---|---|---|---|
skipping to change at line 426 | skipping to change at line 426 | |||
my $indicies = pdl(0,1,4,6,23,58,59); | my $indicies = pdl(0,1,4,6,23,58,59); | |||
($x,$y,$z)=$a1->one2nd($indicies); | ($x,$y,$z)=$a1->one2nd($indicies); | |||
ok(all( $x==pdl(0,1,1,0,2,1,2) ), "one2nd x"); | ok(all( $x==pdl(0,1,1,0,2,1,2) ), "one2nd x"); | |||
ok(all( $y==pdl(0,0,1,2,3,3,3) ), "one2nd y"); | ok(all( $y==pdl(0,0,1,2,3,3,3) ), "one2nd y"); | |||
ok(all( $z==pdl(0,0,0,0,1,4,4) ), "one2nd z"); | ok(all( $z==pdl(0,0,0,0,1,4,4) ), "one2nd z"); | |||
{ | { | |||
my $yvalues = (new PDL( 0..5)) - 20; | my $yvalues = (new PDL( 0..5)) - 20; | |||
my $xvalues = -(new PDL (0..5))*.5; | my $xvalues = -(new PDL (0..5))*.5; | |||
my $x = new PDL(-2); | my $x = new PDL(-2); | |||
is( $x->interpol($xvalues,$yvalues), -16 ); | is( $x->interpol($xvalues,$yvalues), -16, "interpolate: real-valued" ); | |||
} | ||||
{ | ||||
my $yvalues = ((new PDL( 0..5)) - 20) * (1+i()) ; | ||||
my $xvalues = -(new PDL (0..5))*.5; | ||||
my $x = new PDL(-2); | ||||
is( $x->interpol($xvalues,$yvalues), -16 - 16*i, "interpolate: complex-valued" ) | ||||
; | ||||
ok( !eval { $x->interpol($xvalues*i(),$yvalues) } , "interpolate: x must be real | ||||
" ); | ||||
} | } | |||
# Some of these tests are based upon those in Chapter 5 of Programming | # Some of these tests are based upon those in Chapter 5 of Programming | |||
# Pearls, by J. Bentley | # Pearls, by J. Bentley | |||
{ | { | |||
# choose a non-factor of two odd number for the length | # choose a non-factor of two odd number for the length | |||
my $N = 723; | my $N = 723; | |||
my $ones = ones( $N ); | my $ones = ones( $N ); | |||
my $idx = sequence( $N ); | my $idx = sequence( $N ); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added |