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

# SCM Repository

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

Revision 135 - (download) (annotate)
Fri Jul 2 21:57:47 2010 UTC (10 years, 11 months ago) by jhr
File size: 989 byte(s)
```  Working on IL representation
```
```(* 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