## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "t/matrixops.t" betweenPDL-2.081.tar.gz and PDL-2.082.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

matrixops.t  (PDL-2.081):matrixops.t  (PDL-2.082)
skipping to change at line 181 skipping to change at line 181
my \$pa = pdl([3,4,5,6],[6,7,8,9],[9,0,7,6],[4,3,2,0]); # det=48 my \$pa = pdl([3,4,5,6],[6,7,8,9],[9,0,7,6],[4,3,2,0]); # det=48
my \$pb = pdl([1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]); # det=1 my \$pb = pdl([1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]); # det=1
my \$c = pdl([0,1,0,0],[1,0,0,0],[0,0,1,0],[0,0,0,1]); # det=-1 my \$c = pdl([0,1,0,0],[1,0,0,0],[0,0,1,0],[0,0,0,1]); # det=-1
my \$d = pdl([1,2,3,4],[5,4,3,2],[0,0,3,0],[3,0,1,6]); # det=-216 my \$d = pdl([1,2,3,4],[5,4,3,2],[0,0,3,0],[3,0,1,6]); # det=-216
my \$e = (\$pa->cat(\$pb)) -> cat( \$c->cat(\$d) ); my \$e = (\$pa->cat(\$pb)) -> cat( \$c->cat(\$d) );
my \$det = \$e->determinant; my \$det = \$e->determinant;
} }
{ {
my \$m2=pdl[[-2,-2,-2],[-1,-1,-2],[0,0,-2]];
isa_ok \$m2->det, 'PDL', 'det of singular always returns ndarray';
}
{
### Check identity and stretcher matrices... ### Check identity and stretcher matrices...
ok((identity(2)->flat == pdl(1,0,0,1))->all, "identity matrix"); ok((identity(2)->flat == pdl(1,0,0,1))->all, "identity matrix");
ok((identity(pdl 2)->flat == pdl(1,0,0,1))->all, "identity matrix with scalar nd array"); ok((identity(pdl 2)->flat == pdl(1,0,0,1))->all, "identity matrix with scalar nd array");
ok((identity(zeroes 2, 3)->flat == pdl(1,0,0,1))->all, "identity matrix with dim ensioned ndarray"); ok((identity(zeroes 2, 3)->flat == pdl(1,0,0,1))->all, "identity matrix with dim ensioned ndarray");
my @deep_identity_dims = identity(zeroes 2, 3, 4)->dims; my @deep_identity_dims = identity(zeroes 2, 3, 4)->dims;
is_deeply \@deep_identity_dims, [2, 2, 4], "identity matrix with multi-dimension ed ndarray" or diag 'got: ', explain \@deep_identity_dims; is_deeply \@deep_identity_dims, [2, 2, 4], "identity matrix with multi-dimension ed ndarray" or diag 'got: ', explain \@deep_identity_dims;
ok((stretcher(pdl(2,3))->flat == pdl(2,0,0,3))->all, "stretcher 2x2"); ok((stretcher(pdl(2,3))->flat == pdl(2,0,0,3))->all, "stretcher 2x2");
ok((stretcher(pdl([2,3],[3,4]))->flat == pdl(2,0,0,3,3,0,0,4))->all, "stretcher 2x2x2"); ok((stretcher(pdl([2,3],[3,4]))->flat == pdl(2,0,0,3,3,0,0,4))->all, "stretcher 2x2x2");
} }
End of changes. 1 change blocks.
0 lines changed or deleted 5 lines changed or added