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

SCM Repository

[diderot] Diff of /trunk/src/compiler/high-il/check-high-il.sml
ViewVC logotype

Diff of /trunk/src/compiler/high-il/check-high-il.sml

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

revision 2355, Sun Apr 7 11:35:08 2013 UTC revision 2356, Sun Apr 7 14:45:25 2013 UTC
# Line 47  Line 47 
47              | Op.MulMatVec(ty as Ty.TensorTy[d1, d2]) => (Ty.TensorTy[d1], [ty, Ty.TensorTy[d2]])              | Op.MulMatVec(ty as Ty.TensorTy[d1, d2]) => (Ty.TensorTy[d1], [ty, Ty.TensorTy[d2]])
48              | Op.MulMatMat(ty1 as Ty.TensorTy[d1, d2], ty2 as Ty.TensorTy[d2', d3]) =>              | Op.MulMatMat(ty1 as Ty.TensorTy[d1, d2], ty2 as Ty.TensorTy[d2', d3]) =>
49                  (Ty.TensorTy[d1, d3], [ty1, ty2])                  (Ty.TensorTy[d1, d3], [ty1, ty2])
50                | Op.MulVecTen3(ty as Ty.TensorTy[d1, d2, d3]) =>
51                    (Ty.TensorTy[d2, d3], [Ty.TensorTy[d1], ty])
52                | Op.MulTen3Vec(ty as Ty.TensorTy[d1, d2, d3]) =>
53                    (Ty.TensorTy[d1, d2], [ty, Ty.TensorTy[d3]])
54                | Op.ColonMul(ty1 as Ty.TensorTy dd1, ty2 as Ty.TensorTy(d21::d22::dd2)) => let
55                    fun last2 ([d1, d2], prefix) = (prefix, d1, d2)
56                      | last2 (d::dd, prefix) = last2(dd, d::prefix)
57                      | last2 _ = raise Fail("sigOf: invalid operator " ^ Op.toString rator)
58                    val (prefix, d11, d12) = last2 (dd1, [])
59                    in
60                      if (d11 <> d21) orelse (d12 <> d22)
61                        then raise Fail("sigOf: invalid operator " ^ Op.toString rator)
62                        else (Ty.TensorTy(List.revAppend(prefix, dd2)), [ty1, ty2])
63                    end
64              | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])              | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])
65              | Op.Outer(ty as Ty.TensorTy[d1, d2]) => (ty, [Ty.TensorTy[d1], Ty.TensorTy[d2]])              | Op.Outer(ty as Ty.TensorTy[d1, d2]) => (ty, [Ty.TensorTy[d1], Ty.TensorTy[d2]])
66              | Op.Norm ty => (Ty.realTy, [ty])              | Op.Norm ty => (Ty.realTy, [ty])
# Line 58  Line 72 
72              | Op.Identity d => (Ty.TensorTy[d,d], [])              | Op.Identity d => (Ty.TensorTy[d,d], [])
73              | Op.Zero ty => (ty, [])              | Op.Zero ty => (ty, [])
74              | Op.Trace ty => (Ty.realTy, [ty])              | Op.Trace ty => (Ty.realTy, [ty])
75                | Op.Transpose(d1, d2) => (Ty.TensorTy[d2, d1], [Ty.TensorTy[d1, d2]])
76              | Op.Slice(ty as Ty.TensorTy dd, m) => let              | Op.Slice(ty as Ty.TensorTy dd, m) => let
77                  val (resDims, idxDims) = let                  val (resDims, idxDims) = let
78                        fun f (d, false, (rds, ids)) = (d::rds, ids)                        fun f (d, false, (rds, ids)) = (d::rds, ids)
# Line 87  Line 102 
102              | Op.AddField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])              | Op.AddField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])
103              | Op.SubField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])              | Op.SubField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])
104              | Op.ScaleField => (Ty.FieldTy, [Ty.realTy, Ty.FieldTy])              | Op.ScaleField => (Ty.FieldTy, [Ty.realTy, Ty.FieldTy])
105                | Op.OffsetField => (Ty.FieldTy, [Ty.FieldTy, Ty.realTy])
106              | Op.NegField => (Ty.FieldTy, [Ty.FieldTy])              | Op.NegField => (Ty.FieldTy, [Ty.FieldTy])
107              | Op.DiffField => (Ty.FieldTy, [Ty.FieldTy])              | Op.DiffField => (Ty.FieldTy, [Ty.FieldTy])
108                | Op.CurlField 2 => (Ty.FieldTy, [Ty.FieldTy])
109                | Op.CurlField 3 => (Ty.FieldTy, [Ty.FieldTy])
110              | Op.Probe(domTy, rngTy) => (rngTy, [Ty.FieldTy, domTy])              | Op.Probe(domTy, rngTy) => (rngTy, [Ty.FieldTy, domTy])
111              | Op.Input(ty, _, _) => (ty, [])              | Op.Input(ty, _, _) => (ty, [])
112              | Op.InputWithDefault(ty, _, _) => (ty, [ty])              | Op.InputWithDefault(ty, _, _) => (ty, [ty])

Legend:
Removed from v.2355  
changed lines
  Added in v.2356

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