Evanovich has asked for the wisdom of the Perl Monks concerning the following question:
My problem is that the angles aren't right. could it be that perl is not sorting the values of each hash consistently? Is there a way to easily and efficiently correct for this? Yours humbly, Evanmy $pdl1 = pdl (values(%{$database[0]})); my $n1 = norm $pdl1; my ($pdl2, $n2, $dotproduct, $d, @angles); for (0..$3database) { $pdl2 = pdl (values (%{$database[$_]})); $n2 = norm $pdl2; $dotproduct = inner ($n1, $n2); $d = dotproduct->sclr(); $angles[$_] = (180/3.1415926)*acos($d); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Lining up many hash values
by robartes (Priest) on May 02, 2003 at 06:44 UTC | |
|
Re: Lining up many hash values
by pzbagel (Chaplain) on May 02, 2003 at 05:48 UTC | |
|
Re: Lining up many hash values
by BrowserUk (Patriarch) on May 02, 2003 at 07:30 UTC | |
|
Re: Lining up many hash values
by jsegal (Friar) on May 02, 2003 at 16:25 UTC |