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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2922, Tue Mar 3 03:55:09 2015 UTC revision 2923, Tue Mar 3 15:33:44 2015 UTC
# Line 43  Line 43 
43      (*mkSum:sum_indexid list * ein_exp->int *ein_exp      (*mkSum:sum_indexid list * ein_exp->int *ein_exp
44      *distribute summation expression      *distribute summation expression
45      *)      *)
46    (*
47    fun mkSum(c1,e1)=(case e1    fun mkSum(c1,e1)=(case e1
48          of E.Lift e   => (1,E.Lift(E.Sum(c1,e)))          of E.Lift e   => (1,E.Lift(E.Sum(c1,e)))
49          | E.Tensor(_,[]) => (1,e1)          | E.Tensor(_,[]) => (1,e1)
# Line 52  Line 52 
52          | E.Prod p    => filterSca(c1,p)          | E.Prod p    => filterSca(c1,p)
53          | _           => (0,E.Sum(c1,e1))          | _           => (0,E.Sum(c1,e1))
54          (*end case*))          (*end case*))
55  (*  *)
56      fun mkSum(c1,e1)=(case e1      fun mkSum(c1,e1)=(case e1
57          of E.Conv _   => (0,E.Sum(c1,e1))          of E.Conv _   => (0,E.Sum(c1,e1))
58          | E.Field _   => (0,E.Sum(c1,e1))          | E.Field _   => (0,E.Sum(c1,e1))
# Line 79  Line 79 
79          | E.Value _   => err("Value used before expand")          | E.Value _   => err("Value used before expand")
80          | E.Img _     => err("Probe used before expand")          | E.Img _     => err("Probe used before expand")
81          (*end case*))          (*end case*))
82  *)  
83      (* mkapply:mu list*ein_exp->int*ein_exp      (* mkapply:mu list*ein_exp->int*ein_exp
84      * rewrite Apply      * rewrite Apply
85      *)      *)
# Line 155  Line 155 
155              of (_,[]) => (1,E.Div(E.Apply(d1,g),b)) (*Division by a real*)              of (_,[]) => (1,E.Div(E.Apply(d1,g),b)) (*Division by a real*)
156              | (pre,h) => let              | (pre,h) => let
157                  (*quotient rule*)                  (*quotient rule*)
158                    val _=testp["\n** Quotient rule"]
159                  val  E.Partial dels=d1                  val  E.Partial dels=d1
160                  val del0=E.Partial([List.hd(dels)])                  val del0=E.Partial([List.hd(dels)])
161                  val deln=E.Partial( List.tl(dels))                  val deln=E.Partial( List.tl(dels))
# Line 314  Line 315 
315              (changed :=true; E.Sub(E.Prod([e1,e2]@e4), E.Prod([e1,e3]@e4 )))              (changed :=true; E.Sub(E.Prod([e1,e2]@e4), E.Prod([e1,e3]@e4 )))
316  *)  *)
317          | E.Prod((e1 as E.Sqrt(s1))::(e2 as E.Sqrt(s2))::es)=>          | E.Prod((e1 as E.Sqrt(s1))::(e2 as E.Sqrt(s2))::es)=>
318              if(Eq.isEqual3(s1,s2,args)=0) then (print"prod sqrt";s1)              if(Eq.isEqual3(s1,s2,args)=0) then (testp["prod sqrt"];s1)
319              else let              else let
320                  val _ =print"prodsqrt:tried equal and did not find it"                  val _ =testp["prodsqrt:tried equal and did not find it"]
321                  val (_,b)=mkProd([rewriteBody e1, rewriteBody e2]@es)                  val (_,b)=mkProd([rewriteBody e1, rewriteBody e2]@es)
322                  in b end                  in b end
323          (*************Product EPS **************)          (*************Product EPS **************)

Legend:
Removed from v.2922  
changed lines
  Added in v.2923

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