# SCM Repository

# View of /trunk/src/compiler/IL/field-def.sml

Parent Directory | Revision Log

Revision

File size: 991 byte(s)

**131**- (**download**) (**annotate**)*Fri Jul 2 21:30:43 2010 UTC*(11 years ago) by*jhr*File size: 991 byte(s)

Added normalize function

(* field-def.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. *) structure FieldDef = struct (* the static definition of a field value *) datatype field_def = = CONV of ImageInfo.info * Kernel.kernel (* convolution *) | DIFF of int * field_def (* k levels of differentiation *) | NEG of field_def | SUM of field_def * field_def (* scaling too? *) (* normalize a field definition by pushing the DIFF operators to the * leaves *) fun normalize fld = let fun norm fld = (case fld of CONV _ => fld | DIFF(k, fld) => diff (k, fld) | NEG fld => NEG(norm fld) | SUM(fld1, fld2) => SUM(norm fld1, norm fld2) (* end case *)) and diff (k, fld) = (case fld of CONV _ => DIFF(k, fld) | DIFF(k', fld) => diff (k+k', fld) | NEG fld => NEG(diff(k, fld)) | SUM(fld1, fld2) => SUM(diff(k, fld1), diff(k, fld2)) (* end case *)) in norm fld end end

root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |

Powered by ViewVC 1.0.0 |