Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: PDL & Math::MatrixReal

by hippo (Bishop)
on Nov 05, 2021 at 16:17 UTC ( [id://11138474]=note: print w/replies, xml ) Need Help??


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.


🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138474]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-23 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found