Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^9: Algorithm for cancelling common factors between two lists of multiplicands

by tmoertel (Chaplain)
on Aug 09, 2005 at 01:40 UTC ( #482093=note: print w/replies, xml ) Need Help??


in reply to Re^8: Algorithm for cancelling common factors between two lists of multiplicands
in thread Algorithm for cancelling common factors between two lists of multiplicands

You didn't do anything wrong, but you did ask for the internal representation (via rpCutoff) instead of the final ratio (via pCutoff). The internal representation is likely to be insanly huge for large problems.

Save the other code as FishersExactTest.hs and the following as Main.hs and then compile:
ghc -O2 -o fet --make Main.hs
to get a program fet that you can pipe a matrix into.

module Main (main) where import FishersExactTest (pCutoff) main = interact $ show . pCutoff . map (map read . words) . lines
See my earlier node (Re^5: Algorithm for cancelling common factors between two lists of multiplicands) for an example of usage.
  • Comment on Re^9: Algorithm for cancelling common factors between two lists of multiplicands
  • Download Code

Replies are listed 'Best First'.
Re^10: Algorithm for cancelling common factors between two lists of multiplicands
by BrowserUk (Patriarch) on Aug 09, 2005 at 01:50 UTC

    Hmm 1%1?

    C:\ghc\ghc-6.4\code>ghc --make FET.hs -o FET.exe Chasing modules from: FET.hs Compiling FishersExactTest ( ./FishersExactTest.hs, ./FishersExactTest +.o ) Compiling Main ( FET.hs, FET.o ) Linking ... C:\ghc\ghc-6.4\code>FET 989 9400 43400 2400 ^Z 1%1 C:\ghc\ghc-6.4\code>echo 989 9400 43400 2400 | FET 1%1

    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.
      You entered a 4x1 matrix, and so that's why you got an answer of 1. (The code works on general matricies and does not assume the 2x2 case.) Enter the data as a 2x2 matrix to get the result you expect:
      $ ./fet 989 9400 43400 2400 ^D ... tons of output ...

      Cheers,
      Tom

        How do I get that output reduced to a real in scientific format?


        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482093]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2022-11-28 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?