SCM Repository
View of /branches/vis15/src/compiler/simplify/util.sml
Parent Directory
|
Revision Log
Revision 3464 -
(download)
(annotate)
Sun Nov 29 17:38:34 2015 UTC (5 years, 3 months ago) by jhr
File size: 1607 byte(s)
Sun Nov 29 17:38:34 2015 UTC (5 years, 3 months ago) by jhr
File size: 1607 byte(s)
working on reductions for merge
(* util.sml * * Utility code for Simplification. * * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu) * * COPYRIGHT (c) 2015 The University of Chicago * All rights reserved. *) structure Util : sig (* return information about a reduction operator *) val reductionInfo : Var.t -> { rator : Var.t, (* primitive operator *) init : Literal.t, (* identity element to use for initialization *) mvs : SimpleTypes.meta_arg list (* meta-variable arguments for primitive application *) } end = struct structure BV = BasisVars structure L = Literal structure R = RealLit fun reductionInfo rator = if Var.same(BV.red_all, rator) then {rator = BV.op_and, init = L.Bool true, mvs = []} else if Var.same(BV.red_exists, rator) then {rator = BV.op_or, init = L.Bool false, mvs = []} else if Var.same(BV.red_max, rator) then {rator = BV.fn_max, init = L.Real R.negInf, mvs = []} else if Var.same(BV.red_mean, rator) then raise Fail "FIXME: 'mean' reduction not yet supported" else if Var.same(BV.red_min, rator) then {rator = BV.fn_min, init = L.Real R.posInf, mvs = []} else if Var.same(BV.red_product, rator) then {rator = BV.mul_rr, init = L.Real R.one, mvs = []} else if Var.same(BV.red_sum, rator) then {rator = BV.add_tt, init = L.Real R.one, mvs = [SimpleTypes.SHAPE[]]} else if Var.same(BV.red_variance, rator) then raise Fail "FIXME: 'variance' reduction not yet supported" else raise Fail(Var.uniqueNameOf rator ^ " is not a reduction operator") end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |