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

# SCM Repository

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

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

revision 130, Thu Jul 1 20:08:43 2010 UTC revision 131, Fri Jul 2 21:30:43 2010 UTC
# Line 10  Line 10
10    (* the static definition of a field value *)    (* the static definition of a field value *)
11      datatype field_def =      datatype field_def =
12        = CONV of ImageInfo.info * Kernel.kernel  (* convolution *)        = CONV of ImageInfo.info * Kernel.kernel  (* convolution *)
13        | DIFF of field_def        | DIFF of int * field_def                 (* k levels of differentiation *)
14        | NEG of field_def        | NEG of field_def
15        | SUM of field_def * field_def        | SUM of field_def * field_def
16  (* scaling too? *)  (* scaling too? *)
17
18      (* normalize a field definition by pushing the DIFF operators to the
19       * leaves
20       *)
21        fun normalize fld = let
22              fun norm fld = (case fld
23                     of CONV _ => fld
24                      | DIFF(k, fld) => diff (k, fld)
25                      | NEG fld => NEG(norm fld)
26                      | SUM(fld1, fld2) => SUM(norm fld1, norm fld2)
27                    (* end case *))
28              and diff (k, fld) = (case fld
29                     of CONV _ => DIFF(k, fld)
30                      | DIFF(k', fld) => diff (k+k', fld)
31                      | NEG fld => NEG(diff(k, fld))
32                      | SUM(fld1, fld2) => SUM(diff(k, fld1), diff(k, fld2))
33                    (* end case *))
34              in
35                norm fld
36              end
37
38    end    end

Legend:
 Removed from v.130 changed lines Added in v.131

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