Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/simplify/util.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/simplify/util.sml

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

revision 4587, Sun Sep 18 19:58:38 2016 UTC revision 4588, Mon Sep 19 02:13:20 2016 UTC
# Line 44  Line 44 
44              then RED(Reductions.ALL)              then RED(Reductions.ALL)
45            else if Var.same(BV.red_exists, rator)            else if Var.same(BV.red_exists, rator)
46              then RED(Reductions.EXISTS)              then RED(Reductions.EXISTS)
47            else if Var.same(BV.red_max, rator)            else if Var.same(BV.red_max_i, rator)
48              then RED(Reductions.MAX)              then RED(Reductions.IMAX)
49              else if Var.same(BV.red_max_r, rator)
50                then RED(Reductions.RMAX)
51            else if Var.same(BV.red_mean, rator)            else if Var.same(BV.red_mean, rator)
52              then MEAN              then MEAN
53            else if Var.same(BV.red_min, rator)            else if Var.same(BV.red_min_i, rator)
54              then RED(Reductions.MIN)              then RED(Reductions.IMIN)
55            else if Var.same(BV.red_product, rator)            else if Var.same(BV.red_min_r, rator)
56              then RED(Reductions.PRODUCT)              then RED(Reductions.RMIN)
57            else if Var.same(BV.red_sum, rator)            else if Var.same(BV.red_product_i, rator)
58              then RED(Reductions.SUM)              then RED(Reductions.IPRODUCT)
59              else if Var.same(BV.red_product_r, rator)
60                then RED(Reductions.RPRODUCT)
61              else if Var.same(BV.red_sum_i, rator)
62                then RED(Reductions.ISUM)
63              else if Var.same(BV.red_sum_r, rator)
64                then RED(Reductions.RSUM)
65    (* FIXME: variance not supported yet
66            else if Var.same(BV.red_variance, rator)            else if Var.same(BV.red_variance, rator)
67              then VARIANCE              then VARIANCE
68    *)
69              else raise Fail(Var.uniqueNameOf rator ^ " is not a reduction operator")              else raise Fail(Var.uniqueNameOf rator ^ " is not a reduction operator")
70    
71      fun reductionInfo redOp = (case redOp      val mvsReal = [SimpleTypes.SHAPE[]]
72             of Reductions.ALL => {rator = BV.op_and, init = L.Bool true, mvs = []}  
73              | Reductions.EXISTS => {rator = BV.op_or, init = L.Bool false, mvs = []}      fun reductionInfo redOp = let
74              | Reductions.MAX => {rator = BV.fn_max_r, init = L.Real R.negInf, mvs = []}            val id = Reductions.identity redOp
75              | Reductions.MIN => {rator = BV.fn_min_r, init = L.Real R.posInf, mvs = []}            in
76              | Reductions.PRODUCT => {rator = BV.mul_rr, init = L.Real R.one, mvs = []}              case redOp
77              | Reductions.SUM => {rator = BV.add_tt, init = L.Real R.one, mvs = [SimpleTypes.SHAPE[]]}               of Reductions.ALL => {rator = BV.op_and, init = id, mvs = []}
78            (* end case *))                | Reductions.EXISTS => {rator = BV.op_or, init = id, mvs = []}
79                  | Reductions.IMAX => {rator = BV.fn_max_i, init = id, mvs = []}
80                  | Reductions.RMAX => {rator = BV.fn_max_r, init = id, mvs = []}
81                  | Reductions.IMIN => {rator = BV.fn_min_i, init = id, mvs = []}
82                  | Reductions.RMIN => {rator = BV.fn_min_r, init = id, mvs = []}
83                  | Reductions.IPRODUCT => {rator = BV.mul_ii, init = id, mvs = []}
84                  | Reductions.RPRODUCT => {rator = BV.mul_rr, init = id, mvs = []}
85                  | Reductions.ISUM => {rator = BV.add_ii, init = id, mvs = mvsReal}
86                  | Reductions.RSUM => {rator = BV.add_tt, init = id, mvs = mvsReal}
87                (* end case *)
88              end
89    
90      local      local
91        val n = ref 0        val n = ref 0

Legend:
Removed from v.4587  
changed lines
  Added in v.4588

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