in reply to Re^5: Algorithm for cancelling common factors between two lists of multiplicands
in thread Algorithm for cancelling common factors between two lists of multiplicands
The precision is setable, but I had left at the default.
Increasing the precision to the point where it match or suppassed the accuracy of your Haskell code (a setting of 58), doubled the time it took to a gnat's under 50 ms:
[ 6:46:43.79] P:\test>MP-FET.pl 8.070604647867604097576877675243109941729476950993498765160880911582E- +7030 1 trial of _default ( 49.865ms total), 49.865ms/trial
BTW: Could you explain something for me? In this:
cancel (x:xs) (y:ys) | x == y = cancel xs ys | x < y = let (xs', ys') = cancel xs (y:ys) in (x:xs', ys') | otherwise = let (xs', ys') = cancel (x:xs) ys in (xs', y:ys') cancel xs ys = (xs, ys)
I understand how it cancels between the lists, but I am confused about when it would pattern match against the second definition?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Algorithm for cancelling common factors between two lists of multiplicands
by tmoertel (Chaplain) on Aug 11, 2005 at 06:20 UTC |