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

SCM Repository

[diderot] Diff of /branches/chiw17/src/compiler/ein/mk-operators.sml
ViewVC logotype

Diff of /branches/chiw17/src/compiler/ein/mk-operators.sml

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

revision 5013, Fri Jul 7 20:18:01 2017 UTC revision 5014, Mon Jul 10 03:06:01 2017 UTC
# Line 97  Line 97 
97      val expT : Ein.ein      val expT : Ein.ein
98    
99      val powFI : dim * int -> Ein.ein      val powFI : dim * int -> Ein.ein
100        val powTI : int -> Ein.ein
101    
102      val sqrtR : Ein.ein      val sqrtR : Ein.ein
103      val sqrtF : dim -> Ein.ein      val sqrtF : dim -> Ein.ein
104      val cosR  : Ein.ein      val cosR  : Ein.ein
# Line 135  Line 137 
137      val dotimes : dim * shape -> Ein.ein (* ?? *)      val dotimes : dim * shape -> Ein.ein (* ?? *)
138      val divergence : dim * shape -> Ein.ein      val divergence : dim * shape -> Ein.ein
139      val poly: shape*shape -> Ein.ein      val poly: shape*shape -> Ein.ein
140       val polyProbe: shape * dim -> Ein.ein list       val polyProbe: shape * dim -> Ein.ein
141    end = struct    end = struct
142    
143      structure E = Ein      structure E = Ein
# Line 894  Line 896 
896                body = E.Op1(rator, E.Field(0, []))                body = E.Op1(rator, E.Field(0, []))
897              }              }
898      in      in
899      fun powFI (dim, n) = E.EIN{      fun powFI (dim, n) = let
900            val e =  E.EIN{
901              params = [E.FLD dim],              params = [E.FLD dim],
902              index = [], body = E.Op1(E.PowInt n, E.Field(0, []))              index = [], body = E.Op1(E.PowInt n, E.Field(0, []))
903            }            }
904            val _ = print(String.concat["pow FI", EinPP.toString(e)])
905             in e end
906        fun powTI (n) = let
907             val e =  E.EIN{ params = [mkTEN []],index = [], body = E.Op1(E.PowInt n, E.Tensor(0, []))}
908             val _ = print(String.concat["pow TI", EinPP.toString(e)])
909             in e end
910      val sqrtR = tensorFn E.Sqrt      val sqrtR = tensorFn E.Sqrt
911      val sqrtF = liftFn E.Sqrt      val sqrtF = liftFn E.Sqrt
912      val cosR  = tensorFn E.Cosine      val cosR  = tensorFn E.Cosine
# Line 1125  Line 1134 
1134      (***************************** field definitions ****************************)      (***************************** field definitions ****************************)
1135      (* other definitions for fields *)      (* other definitions for fields *)
1136      fun poly (talpha, falpha) = let      fun poly (talpha, falpha) = let
1137            val expindex = specialize(talpha, 0)          val expindex = specialize(falpha, 0)
           fun p1(ix) =  
           E.Opn(E.Prod, [E.Tensor(1, [E.C ix]), E.Delta(E.C ix, E.V 0)])  
1138    
1139           val e1 =           val e1 =
1140            E.EIN {            E.EIN {
1141              params = [mkTEN talpha, mkTEN talpha], index = talpha,              params = [mkTEN talpha, mkTEN falpha], index = falpha,
1142              body = E.PolyWrap(E.Tensor(0,expindex), E.Tensor(1, expindex), [])              body = E.PolyWrap(E.Tensor(0,expindex), E.Tensor(1, expindex), [])
1143              }              }
1144              val _ = print(String.concat["\npoly term: ",EinPP.toString(e1)])              val _ = print(String.concat["\npoly term: ",EinPP.toString(e1)])
# Line 1147  Line 1154 
1154                params = [E.FLD dim, mkTEN [dim]], index = alpha,                params = [E.FLD dim, mkTEN [dim]], index = alpha,
1155                body = E.Probe(E.Field(0, expindex), E.Tensor(1, [E.V 0]))                body = E.Probe(E.Field(0, expindex), E.Tensor(1, [E.V 0]))
1156                }                }
1157            in eProbe end
   
         val eTen = E.EIN{  
             params = [mkTEN [dim]], index = alpha,  
             body =   E.Tensor(0, expindex)  
             }  
   
         fun p1(ix) =  
             E.Opn(E.Prod, [E.Tensor(0, [E.C ix]), E.Delta(E.C ix, E.V 0)])  
         val eDelta = E.EIN{  
               params = [mkTEN [dim]], index = [dim],  
               body = E.Opn(E.Add,[p1(0), p1(1)])  
               }  
   
   
         in [eProbe, eTen, eDelta]  
         end  
1158    
1159    
1160    end (* mkOperators *)    end (* mkOperators *)

Legend:
Removed from v.5013  
changed lines
  Added in v.5014

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