matrixops.t (PDL-2.080) | : | matrixops.t (PDL-2.081) | ||
---|---|---|---|---|
skipping to change at line 119 | skipping to change at line 119 | |||
[-3 -4 -3] | [-3 -4 -3] | |||
] | ] | |||
] | ] | |||
EOF | EOF | |||
my $a334inv; | my $a334inv; | |||
lives_ok { $a334inv = $a334->inv } "3x3x4 inv ran OK"; | lives_ok { $a334inv = $a334->inv } "3x3x4 inv ran OK"; | |||
ok(tapprox(matmult($a334,$a334inv),identity(3)->dummy(2,4)), "3x3x4 inv gave cor rect answer"); | ok(tapprox(matmult($a334,$a334inv),identity(3)->dummy(2,4)), "3x3x4 inv gave cor rect answer"); | |||
} | } | |||
{ | { | |||
my $idc = identity(zeroes(cdouble, 2, 2)); | ||||
is $idc->type, 'cdouble'; | ||||
} | ||||
{ | ||||
# bug in inv for native-complex - GH#403 | ||||
my $p = pdl [[ 1+i(), 0], [0, 2+2*i() ] ]; | ||||
my $p_inv; | ||||
lives_ok { $p_inv = $p->inv } "native-complex inv runs OK"; | ||||
ok(tapprox(matmult($p,$p_inv),identity(2)), "native-complex inv gave correct ans | ||||
wer"); | ||||
} | ||||
{ | ||||
### Check LU backsubstitution (bug #2023711 on sf.net) | ### Check LU backsubstitution (bug #2023711 on sf.net) | |||
my $pa = pdl([[1,2],[1,1]]); # asymmetric to see if need transpose | my $pa = pdl([[1,2],[1,1]]); # asymmetric to see if need transpose | |||
my ($lu,$perm,$par); | my ($lu,$perm,$par); | |||
lives_ok { ($lu,$perm,$par) = lu_decomp($pa) } "lu_decomp 2x2 ran OK"; | lives_ok { ($lu,$perm,$par) = lu_decomp($pa) } "lu_decomp 2x2 ran OK"; | |||
ok($par==1, "lu_decomp 2x2 correct parity"); | ok($par==1, "lu_decomp 2x2 correct parity"); | |||
ok(all($perm == pdl(0,1)), "lu_decomp 2x2 correct permutation"); | ok(all($perm == pdl(0,1)), "lu_decomp 2x2 correct permutation"); | |||
my $bb = pdl([1,0], [3, 4]); | my $bb = pdl([1,0], [3, 4]); | |||
my $xx_expected = pdl <<'EOF'; | my $xx_expected = pdl <<'EOF'; | |||
[ | [ | |||
[-1 1] | [-1 1] | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added |