in reply to Mysterious slow down with large data set
You can shed another chunk of time by norm()'ing your vectors once as you load them, rather than repeatedly:
while(<>){ chomp; my ($wrd, @data) = split; $kernel{$wrd} = norm( pdl(@data) ); ... my $sim = inner( $kernel{ $w1 }, $kernel{ $w2 } );
But the PDL -- now down to just the inner()s -- still exhibits the slowdown behaviour, despite that it doesn't do so when run in a tight loop on two similar vectors in a standalone test.
At this point you need some serious PDL knowledge to move forward I think.
|
|---|