Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/high-il/normalize-ein.sml
 [diderot] / branches / charisee / src / compiler / high-il / normalize-ein.sml

# Diff of /branches/charisee/src/compiler/high-il/normalize-ein.sml

revision 2866, Thu Feb 5 22:39:59 2015 UTC revision 2867, Tue Feb 10 06:52:58 2015 UTC
# Line 56  Line 56
57          | E.Div (a,b) => (1,E.Div(E.Sum(c1,a),E.Sum(c1,b)))          | E.Div (a,b) => (1,E.Div(E.Sum(c1,a),E.Sum(c1,b)))
58          | E.Lift e    => (1,E.Lift(E.Sum(c1,e)))          | E.Lift e    => (1,E.Lift(E.Sum(c1,e)))
59            | E.Sqrt e    => (1,E.Sqrt(E.Sum(c1,e)))
60          | E.Sum(c2,e2)=> (1,E.Sum(c1@c2,e2))          | E.Sum(c2,e2)=> (1,E.Sum(c1@c2,e2))
61          | E.Prod p    => filterSca(c1,p)          | E.Prod p    => filterSca(c1,p)
62          | E.Const 0   => (1,E.Const 0) (*expression could have been changed to 0*)          | E.Const 0   => (1,E.Const 0) (*expression could have been changed to 0*)
# Line 71  Line 72
72      *)      *)
73      fun mkapply(d1,e1)=(case e1      fun mkapply(d1,e1)=(case e1
74          of E.Lift e   => (1,E.Const 0)          of E.Lift e   => (1,E.Const 0)
75            | E.Sqrt e   =>  (1,E.Prod[ E.Div(E.Const 1 ,E.Prod[E.Const 2, e1]), E.Apply( d1,e)])
76          | E.Prod []   => err("Apply of empty product")          | E.Prod []   => err("Apply of empty product")
78          | E.Conv(v, alpha, h, d2)    =>let          | E.Conv(v, alpha, h, d2)    =>let
# Line 122  Line 124
124      *)      *)
125      fun mkprobe(e1,x)=(case e1      fun mkprobe(e1,x)=(case e1
126          of E.Lift e   => (1,e)          of E.Lift e   => (1,e)
127            | E.Sqrt a    => (1,E.Sqrt(E.Probe(a,x)))
128          | E.Prod []   => err("Probe of empty product")          | E.Prod []   => err("Probe of empty product")
129          | E.Prod p    => (1,E.Prod (List.map (fn(a)=>E.Probe(a,x)) p))          | E.Prod p    => (1,E.Prod (List.map (fn(a)=>E.Probe(a,x)) p))
130          | E.Apply _   => (0,E.Probe(e1,x))          | E.Apply _   => (0,E.Probe(e1,x))
# Line 130  Line 133
133          | E.Sum(c,e') => (1,E.Sum(c,E.Probe(e',x)))          | E.Sum(c,e') => (1,E.Sum(c,E.Probe(e',x)))
135          | E.Sub (a,b) => (1,E.Sub(E.Probe(a,x),E.Probe(b,x)))          | E.Sub (a,b) => (1,E.Sub(E.Probe(a,x),E.Probe(b,x)))
136          | E.Neg e'    => (1,E.Neg(E.Probe(e',x)))          | E.Neg a    => (1,E.Neg(E.Probe(a,x)))
137          | E.Div (a,b) => (1,E.Div(E.Probe(a,x),E.Probe(b,x)))          | E.Div (a,b) => (1,E.Div(E.Probe(a,x),E.Probe(b,x)))
138          | E.Const _   => (1,e1)(*err("Const without Lift")*)          | E.Const _   => (1,e1)(*err("Const without Lift")*)
139          | E.Tensor _  => err("Tensor without Lift")          | E.Tensor _  => err("Tensor without Lift")
# Line 166  Line 169
169          | E.Neg(E.Neg e)    => rewriteBody e          | E.Neg(E.Neg e)    => rewriteBody e
170          | E.Neg e           => E.Neg(rewriteBody e)          | E.Neg e           => E.Neg(rewriteBody e)
171          | E.Lift e          => E.Lift(rewriteBody e)          | E.Lift e          => E.Lift(rewriteBody e)
172            | E.Sqrt e          => E.Sqrt(rewriteBody e)
175              in if (change=1) then ( changed:=true;body') else body' end              in if (change=1) then ( changed:=true;body') else body' end
# Line 330  Line 334
334      val (b,count) = loop(body,0)      val (b,count) = loop(body,0)
335      val _ =testp["\n Out of normalize \n",P.printbody(b),      val _ =testp["\n Out of normalize \n",P.printbody(b),
336          "\n    Final CounterXX:",Int.toString(count),"\n\n"]          "\n    Final CounterXX:",Int.toString(count),"\n\n"]
val xx =G.reduceDelta([],[E.Delta(E.V 2,E.V 1),E.Delta(E.V 3,E.V 0)],[E.Conv(0,[E.V 1,E.V 3],1,[E.V 0])])
337      in      in
338          (Ein.EIN{params=params, index=index, body=b},count)          (Ein.EIN{params=params, index=index, body=b},count)
339      end      end

Legend:
 Removed from v.2866 changed lines Added in v.2867