Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /MLRISC/releases/release-110.84/library/probability.sml
ViewVC logotype

Diff of /MLRISC/releases/release-110.84/library/probability.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1109, Fri Mar 1 13:56:06 2002 UTC revision 1110, Fri Mar 1 14:07:58 2002 UTC
# Line 15  Line 15 
15      val never : prob    (* 0% probability *)      val never : prob    (* 0% probability *)
16      val always : prob   (* 100% probability *)      val always : prob   (* 100% probability *)
17    
18      val prob : (word * word) -> prob      val prob : (int * int) -> prob
19      val fromFreq : int list -> prob list      val fromFreq : int list -> prob list
20    
21      val + : (prob * prob) -> prob      val + : (prob * prob) -> prob
# Line 81  Line 81 
81            (* end case *))            (* end case *))
82    
83      fun prob (n, d) =      fun prob (n, d) =
84            if (n > d) orelse (d = 0w0)            if (n > d) orelse (n < 0) orelse (d <= 0)
85              then raise Domain              then raise Domain
86              else normalize(n, d)              else normalize(Word.fromInt n, Word.fromInt d)
87    
88      fun add (PROB(n1, d1), PROB(n2, d2)) = normalize(d2*n1 + d1*n2, d1*d2)      fun add (PROB(n1, d1), PROB(n2, d2)) = normalize(d2*n1 + d1*n2, d1*d2)
89    

Legend:
Removed from v.1109  
changed lines
  Added in v.1110

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0