Buenas,
I'm trying to find the eigenvalues and eigenvectors of a matrix H using the Householder Method. Math::MatrixReal has many functions for this , one of them is sym_diagonalize(). The problem is that I use PDL to define H and when I run the program I get this error " Can't locate object method "sym_diagonalize" via package "PDL" ". Can't I use both modules in the same code or there is a mistake on how Im calling the functions?
use warnings;
use strict;
use PDL;
use Math::MatrixReal;
#Parámetros
my $epsilon=4.52;
my $d0=0.0030;
my $Vprim=5;
my $Dprim=4; #D/d0
#operadores P y X (NxN=15)
my $P=(pdl[[ 0, -sqrt(1),0,0,0,0,0,0,0,0,0,0,0,0,0],
[sqrt(1),0, -sqrt(2),0,0,0,0,0,0,0,0,0,0,0,0],
[0, sqrt(2),0,-sqrt(3),0,0,0,0,0,0,0,0,0,0,0],
[0,0,sqrt(3),0,-sqrt(4),0,0,0,0,0,0,0,0,0,0],
[0,0,0,sqrt(4),0,-sqrt(5),0,0,0,0,0,0,0,0,0],
[0,0,0,0,sqrt(5),0,-sqrt(6),0,0,0,0,0,0,0,0],
[0,0,0,0,0,sqrt(6),0,-sqrt(7),0,0,0,0,0,0,0],
[0,0,0,0,0,0,sqrt(7),0,-sqrt(8),0,0,0,0,0,0],
[0,0,0,0,0,0,0,sqrt(8),0,-sqrt(9),0,0,0,0,0],
[0,0,0,0,0,0,0,0,sqrt(9),0,-sqrt(10),0,0,0,0],
[0,0,0,0,0,0,0,0,0,sqrt(10),0,-sqrt(11),0,0,0],
[0,0,0,0,0,0,0,0,0,0,sqrt(11),0,-sqrt(12),0,0],
[0,0,0,0,0,0,0,0,0,0,0,sqrt(12),0,-sqrt(13),0],
[0,0,0,0,0,0,0,0,0,0,0,0,sqrt(13),0,-sqrt(14)],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,sqrt(14)]
]);
my $X=(pdl[[0,sqrt(1),0,0,0,0,0,0,0,0,0,0,0,0,0],
[sqrt(1),0, sqrt(2),0,0,0,0,0,0,0,0,0,0,0,0],
[0, sqrt(2),0,sqrt(3),0,0,0,0,0,0,0,0,0,0,0],
[0,0,sqrt(3),0,sqrt(4),0,0,0,0,0,0,0,0,0,0],
[0,0,0,sqrt(4),0,sqrt(5),0,0,0,0,0,0,0,0,0],
[0,0,0,0,sqrt(5),0,sqrt(6),0,0,0,0,0,0,0,0],
[0,0,0,0,0,sqrt(6),0,sqrt(7),0,0,0,0,0,0,0],
[0,0,0,0,0,0,sqrt(7),0,sqrt(8),0,0,0,0,0,0],
[0,0,0,0,0,0,0,sqrt(8),0,sqrt(9),0,0,0,0,0],
[0,0,0,0,0,0,0,0,sqrt(9),0,sqrt(10),0,0,0,0],
[0,0,0,0,0,0,0,0,0,sqrt(10),0,sqrt(11),0,0,0],
[0,0,0,0,0,0,0,0,0,0,sqrt(11),0,sqrt(12),0,0],
[0,0,0,0,0,0,0,0,0,0,0,sqrt(12),0,sqrt(13),0],
[0,0,0,0,0,0,0,0,0,0,0,0,sqrt(13),0,sqrt(14)],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,sqrt(14)]
]);
#
#trucamiento de H
my $j=<STDIN>; #cambio la dimensión
#parte 1 , selecciono corto columnas
my $x1=slice($X,"0:$j:1");
my $p1=slice($P,"0:$j:1");
#parte 2 , selecciono corto filas
my $k=0;
my @index;
while($k<$j+1){
push @index,$k;
$k=$k+1;
};
#operadores de dimensión $jx$j
my $p2=$p1->dice_axis(1,[@index]);
my $x2=$x1->dice_axis(1,[@index]);
#verificando
#print "$p2\n$x2\n";
my $a=$x2 x $x2;
my $b= $x2 x $x2 x $x2 x $x2;
my $c= $p2 x $p2;
#print "$a\n$b\n$c\n";
my $H= -(($c)/4) + 4*($Vprim/($Dprim**4))*($b) - 4*($Vprim/($Dprim**2)
+)*($a);
my $l; my $v;
($l, $v) = $H->sym_diagonalize();