(* 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
Click to toggle
does not end with </html> tag
does not end with </body> tag
The output has ended thus: yet supported" else raise Fail(Var.uniqueNameOf rator ^ " is not a reduction operator") end