matrixops.t (PDL-2.082) | : | matrixops.t (PDL-2.083) | ||
---|---|---|---|---|
skipping to change at line 328 | skipping to change at line 328 | |||
my $A = sequence(2, 2) + 1; | my $A = sequence(2, 2) + 1; | |||
my $A1 = $A->slice(',1:0'); # interchange two rows | my $A1 = $A->slice(',1:0'); # interchange two rows | |||
my $B = pdl(1,1); | my $B = pdl(1,1); | |||
my $x_expected = pdl([[-1, 1]]); | my $x_expected = pdl([[-1, 1]]); | |||
check_inplace($B, sub { lu_backsub($A->lu_decomp, $_[0]) }, $x_expected, "lu_bac ksub dims"); | check_inplace($B, sub { lu_backsub($A->lu_decomp, $_[0]) }, $x_expected, "lu_bac ksub dims"); | |||
check_inplace($B, sub { lu_backsub($A1->lu_decomp, $_[0]) }, $x_expected, "lu_ba cksub dims 2"); | check_inplace($B, sub { lu_backsub($A1->lu_decomp, $_[0]) }, $x_expected, "lu_ba cksub dims 2"); | |||
my $got = $A x $x_expected->transpose; | my $got = $A x $x_expected->transpose; | |||
ok(tapprox($got,$B->transpose,$tol), "A x actually == B") or diag "got: $got"; | ok(tapprox($got,$B->transpose,$tol), "A x actually == B") or diag "got: $got"; | |||
} | } | |||
{ | ||||
squaretotri(my $x=sequence(3,3), my $y=zeroes(6)); | ||||
is $y.'', "[0 3 4 6 7 8]", 'squaretotri with output arg given'; | ||||
eval {squaretotri($x, zeroes(7))}; | ||||
like $@, qr/dim has size 7/; | ||||
$y = squaretotri($x); | ||||
is $y.'', "[0 3 4 6 7 8]", 'squaretotri with no output arg given'; | ||||
$y = squaretotri(sequence(3,3,2)); | ||||
is $y.'', " | ||||
[ | ||||
[ 0 3 4 6 7 8] | ||||
[ 9 12 13 15 16 17] | ||||
] | ||||
", 'squaretotri broadcasts right'; | ||||
} | ||||
done_testing; | done_testing; | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 16 lines changed or added |