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

SCM Repository

[diderot] Diff of /branches/chiw17/src/compiler/mid-to-low/ein-to-scalar.sml
ViewVC logotype

Diff of /branches/chiw17/src/compiler/mid-to-low/ein-to-scalar.sml

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

revision 5009, Thu Jul 6 20:37:31 2017 UTC revision 5010, Thu Jul 6 23:14:28 2017 UTC
# Line 115  Line 115 
115                      | E.Probe(E.Delta e1, e2) => gen(mapp, E.Delta e1)                      | E.Probe(E.Delta e1, e2) => gen(mapp, E.Delta e1)
116                      | E.Probe e => raise Fail("probe ein-exp: " ^ EinPP.expToString body)                      | E.Probe e => raise Fail("probe ein-exp: " ^ EinPP.expToString body)
117                      | E.Field _ => raise Fail("field should have been replaced: " ^ EinPP.expToString body)                      | E.Field _ => raise Fail("field should have been replaced: " ^ EinPP.expToString body)
118                        | E.Poly(id, alpha, n, []) =>   (case n
119                            of 1 => gen(mapp, E.Tensor(id, alpha))
120                            | 2  => gen(mapp, E.Opn(E.Prod, [E.Tensor(id, alpha),E.Tensor(id, alpha)]))
121                            (* end case*))
122    (*
123                         | E.Poly(id, [], 1, [vx]) => gen(mapp, E.Const 0) (* derivative of a scalar? *)
124                         | E.Poly(id, [E.C c], 1, [vx]) =>   let
125                            val dx = Mk.lookupMu (mapp, vx)
126                            val e = if(dx=c) then E.Tensor(id, [E.C c])  else E.Const 0
127                            (* here need to implement partial derivative in respect to an axis *)
128                            in gen(mapp, e) end
129                         | E.Poly(id, [E.C c], 2, [vx]) =>   let
130                            val dx = Mk.lookupMu (mapp, vx)
131                            val ec = E.Const 2
132                            val et = E.Tensor(id, [E.C c])
133                            val e = E.Opn(E.Prod, [ec, et])
134                            in gen(mapp, e) end
135    *)
136                      | _ => raise Fail("unsupported ein-exp: " ^ EinPP.expToString body)                      | _ => raise Fail("unsupported ein-exp: " ^ EinPP.expToString body)
137                    (*end case*)                    (*end case*)
138                  end                  end

Legend:
Removed from v.5009  
changed lines
  Added in v.5010

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