I found a curious situation when running pdl, as illustrated in the
following example.  I build two singular 3x3 matrices and calculate
their determinant, which is zero. However, in one case I get a PDL
scalar and in the other I get a Perl scalar. I don't know why the
different behaviour:

# Program
use v5.36;
use PDL;
my $m1=pdl[[-2,-2,-2], [-1,-2,-2], [0,-2,-2]];
my $m2=pdl[[-2,-2,-2],[-1,-1,-2],[0,0,-2]];
for($m1, $m2){
    say "Matrix=$_", "Det=", $_->det, "\nRef=", ref $_->det;
}


#Results:
Matrix=
[
 [-2 -2 -2]
 [-1 -2 -2]
 [ 0 -2 -2]
]
Det=0
Ref=PDL
Matrix=
[
 [-2 -2 -2]
 [-1 -1 -2]
 [ 0  0 -2]
]
Det=0
Ref=

I'm currently running PDL v2.081 under Perl 5.36 in Linux/testing.

Best regards,
Luis



-- 

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Av. Universidad s/n CP 62210         |                           (*)/\/  \
Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB


_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to