http://qs1969.pair.com?node_id=11138474


in reply to PDL & Math::MatrixReal

You cannot call a method on an object which does not support that method. Your $H is not a Math::MatrixReal object so it does not support the sym_diagonalize method. Here's a trivial illustration:

#!/usr/bin/env perl use strict; use warnings; use Math::MatrixReal; use CGI; # For example my $cgi = CGI->new; my $whassat = 'CGI'; print "\$cgi is an object of class $whassat\n" if $cgi->isa ($whassat) +; eval { my @res = $cgi->sym_diagonalize; }; # This will fail print $@ if $@; my $mmr = Math::MatrixReal->new_from_rows ( [[ 1 .. 3 ], [ 2, -99, 2 ] +, [ 3, 2, -7]] ); $whassat = 'Math::MatrixReal'; print "\$mmr is an object of class $whassat\n" if $mmr->isa ($whassat) +; my @res = $mmr->sym_diagonalize; # This will succeed print "First Eigenvalue: @{$res[0]->[0][0]}\n";

If you copy-convert your $H into a Math::MatrixReal object then you can call sym_diagonalize on it.


🦛