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

SCM Repository

[diderot] Annotation of /trunk/src/compiler/IL/field-def.sml
ViewVC logotype

Annotation of /trunk/src/compiler/IL/field-def.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 135 - (view) (download)

1 : jhr 130 (* field-def.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure FieldDef =
8 :     struct
9 :    
10 :     (* the static definition of a field value *)
11 : jhr 135 datatype field_def
12 : jhr 130 = CONV of ImageInfo.info * Kernel.kernel (* convolution *)
13 : jhr 131 | DIFF of int * field_def (* k levels of differentiation *)
14 : jhr 130 | NEG of field_def
15 :     | SUM of field_def * field_def
16 :     (* scaling too? *)
17 :    
18 : jhr 131 (* 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 : jhr 130 end

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