![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re^6: Algorithm for cancelling common factors between two lists of multiplicandsby BrowserUk (Patriarch) |
on Aug 09, 2005 at 00:03 UTC ( #482072=note: print w/replies, xml ) | Need Help?? |
... is there a reason you aren't using the Chi-square test? I'm not trying to solve the sample problem. That was just an example I found on the web and used as a test. I set out to solve the problem of performing the FET using Perl. First I did it with Math::Pari, but which gives a result of 8.070604647867604097576877668E-7030 in 26ms, but I was unsure about the accuracy. It also imposes a binary dependancy.
So, then I coded it using Math::BigFloat
But that ran for 20 minutes without producing any output before I killed it (I've set it running again now, and my machines fan has been thrashing at full speed for the last 25 minutes). Whilst I was waiting for the BigFloat version, I coded this version which attempts to reduce the size of the problem by eliminating (exactly common) factors:
This works well for values smallish values, but cannot handle the example I gave above (NV overflow). It was then I started thinking about how to eliminate more factors from the equation so as to reduce the size of the intermediate terms, and posted my SoPW. I think that hv's solution of expanding all terms to their prime factorizations before performing the cancelling out will be a winner--but I haven't finished coding that yet. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.
In Section
Seekers of Perl Wisdom
|
|