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

SCM Repository

[diderot] View of /branches/charisee/src/compiler/einTest/examplesN.sml
ViewVC logotype

View of /branches/charisee/src/compiler/einTest/examplesN.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2414 - (download) (annotate)
Mon Aug 19 05:02:14 2013 UTC (6 years, 2 months ago) by cchiw
File size: 7409 byte(s)
changes
structure  ExamplesN =struct

local
structure G = GenericEin
structure E = Ein
structure S = Specialize
structure R = Rewrite
in

(*rewrite rule examples*)

(*--------------------probe del conv---------R1 R2 *)
val t= E.Tensor(0,[])
val R1=E.Probe(E.Prod[E.Partial([2]),E.Conv(E.Field(0,[0]),[])],t)
val R2=E.Probe(E.Prod[E.Partial([2]),E.Conv(E.Field(0,[0]),[(0,3)])],t)
val probedelconv4=E.Prod[ E.Partial([5]),E.Conv(E.Field(0,[0]),[(0,3), (0,2)])]
val probedelconv5=E.Prod[ E.Partial([5,1]),E.Conv(E.Field(0,[0]),[(0,3), (0,2)])]
val probedelconv3=E.Prod[E.Partial([4]), E.Partial([5]),E.Conv(E.Field(0,[0]),[(0,3)])]

                            (*R3*)
val R3b=E.Prod[E.Tensor(0,[1,2]),E.Add[E.Tensor(1,[1,2]),E.Tensor(2,[1,2])]]
val R3= E.Prod[ E.Tensor(3,[1,2]), E.Add[E.Tensor(0,[1,2]),E.Tensor(2,[2,3]) ]]
val R3c= E.Prod[ E.Tensor(3,[1,2]), E.Sub(E.Tensor(0,[1,2]),E.Tensor(2,[2,3]) )]
                            (*R4*)
val R4=E.Apply( E.Partial([2]), E.Add[E.Tensor(0,[1,2]),E.Tensor(2,[2,3]) ])
                            (*R5*)
val R5=E.Prod[ E.Tensor(0,[0]),E.Add[E.Tensor(1,[1]) ,E.Tensor(2,[1]) ]]

(*-----------------------------R7-----------------------------*)
val R7=E.Apply(E.Partial([2]), E.Prod[E.Tensor(0,[]),E.Tensor(2,[2,3]) ])
val probedelA= E.Probe(E.Apply(E.Partial([2]), E.Prod[E.Tensor(0,[]),E.Tensor(2,[2,3]) ]), t)
val probedelA2= E.Probe(E.Apply(E.Partial([2]), E.Prod[E.Tensor(0,[]),E.Tensor(2,[2,3]), E.Tensor(4, [2])]), t)

                            (*R8*)
val chainrule3=(E.Apply(E.Partial([2]),E.Prod[E.Tensor(0,[1,2]),E.Tensor(2,[2,3]) ,E.Tensor(5,[2,4])]))
val R8=(E.Apply(E.Partial([2]),E.Prod[E.Tensor(0,[1,2]),E.Tensor(2,[2,3])]))

                            (*R9*)
val R9= (E.Apply(E.Prod[E.Partial([1,2]), E.Partial([2,4])],E.Tensor(2,[2,3])))

                (*-eps to Delta- R10*)
(*eps change*)
val R10=(E.Sum(4,E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Tensor(0,[3]), E.Tensor(1,[4]) ]))
val R10b=(E.Sum(4,E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Tensor(0,[3]), E.Tensor(1,[5]) ]))
val R10c=(E.Sum(4,E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Tensor(0,[5]), E.Tensor(1,[6]) ]))

(*extra eps*)
val R10d=(E.Sum(4,E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Epsilon(5,6,7),E.Tensor(0,[3]), E.Tensor(1,[4]) ]))
val R10e=(E.Sum(4,E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Epsilon(5,6,7),E.Tensor(0,[3]), E.Tensor(1,[5]) ]))
val R10f=(E.Sum(4,E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Epsilon(5,6,7),E.Tensor(0,[5]), E.Tensor(1,[6]) ]))


(*--------------------R11--------Deltas--------*)

val R11=E.Sum(1,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[4])])
val R11b=E.Sum(1,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[2])])
val R11c=E.Sum(0,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[5])])
val R11d=E.Sum( 1,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[4]),E.Tensor(1,[5])])
val R11e=E.Sum(1,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[2]),E.Tensor(1,[5])])
val R11f=E.Sum(1,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[5]),E.Tensor(1,[4])])
val R11g=E.Sum(1,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[5]),E.Tensor(1,[2])])
val R11h=E.Sum(2,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[2]),E.Tensor(1,[4])])
val R11i=E.Sum(2,E.Prod[E.Delta(1,2),E.Delta(3,4), E.Tensor(0,[4]),E.Tensor(1,[2])])
val R11j=E.Sum(0,E.Prod[E.Delta(1,2), E.Tensor(0,[4])])
val R11k=E.Sum(1,E.Prod[E.Delta(1,2), E.Tensor(0,[2])])
val R11l=E.Sum(1,E.Prod[E.Delta(1,2), E.Tensor(0,[2]), E.Tensor(0,[5])])
val R11m=E.Sum(0,E.Prod[E.Delta(1,2), E.Tensor(0,[5]), E.Tensor(0,[6])])
val R11n=E.Sum(1,E.Prod[E.Delta(1,2), E.Tensor(0,[5]), E.Tensor(0,[2])])
val R11o= E.Sum(1,E.Prod[E.Delta(1,2), E.Tensor(0,[4]),E.Tensor(1,[5]),E.Tensor(2,[2])])
val R11p= E.Sum(0,E.Prod[E.Delta(1,2), E.Tensor(0,[4]),E.Tensor(1,[5]),E.Tensor(2,[7])])
val R11q= E.Sum(0,E.Prod[E.Delta(1,2), E.Tensor(0,[4]),E.Tensor(1,[5]),E.Tensor(2,[7]),E.Tensor(3,[8])])
val R11r= E.Sum(1,E.Prod[E.Delta(1,2), E.Tensor(0,[4]),E.Tensor(1,[5]),E.Tensor(2,[2]),E.Tensor(3,[8])])


                (*-----------R12-R4c------------------*)



val sR12= E.Sum( 1 ,E.Apply(E.Partial([1]),E.Prod[E.Delta(0,1),E.Tensor(8,[9])]))
val sR13= E.Sum( 2,E.Prod[E.Epsilon(0,1,2),E.Tensor(0,[1,2])])
val sR14= E.Sum( 2,E.Apply(E.Partial([0,1]), E.Prod[E.Epsilon(0,1,2),E.Tensor(0,[1,2])]))
val sR14b= E.Sum(2,E.Apply(E.Partial([1,2]), E.Prod[E.Epsilon(0,1,2),E.Tensor(0,[1,2])]))
val sR14c=E.Sum(2,E.Apply(E.Partial([0,2]), E.Prod[E.Epsilon(0,1,2),E.Tensor(0,[1,2])]))


(*
                (*--------embedded rules*)

val x1= E.Sum[E.Prod[E.Delta(0,1),E.Delta(4,6),E.Prod[E.Delta(8,3),E.Tensor(3,[6]), E.Tensor(8,[3])]]]
val x2= E.Sum[E.Prod[E.Epsilon(8,1,2), E.Epsilon(0,3,4), E.Epsilon(9,7,0), E.Tensor(0,[9])]]
val x3= E.Sum[E.Prod[E.Epsilon(8,1,2), E.Epsilon(0,3,4), E.Epsilon(9,7,0), E.Tensor(0,[4])]]

val x4=E.Sum[E.Prod[E.Epsilon(8,1,2), E.Epsilon(1,3,4), E.Epsilon(9,7,4), E.Tensor(0,[3]), E.Prod[E.Tensor(1,[4]), E.Add[E.Tensor(3, [2]), E.Tensor(4, [2])]]]]



val x8=E.Sum[E.Prod[E.Epsilon(8,1,2),E.Epsilon(9,7,44), E.Epsilon(0,3,4),E.Tensor(0,[9]), E.Prod[E.Tensor(1,[4]), E.Add[E.Tensor(3, [1]), E.Tensor(4, [1])]]]]
val x9=E.Sum[E.Prod[E.Tensor(5, [2]),E.Tensor(1,[4]), E.Add[E.Tensor(3, [1]), E.Tensor(4, [1])]]]

*)
    (*----------------------substitution---------------*)
(* This assumes that substitution works correctly*)
(*This just normalized the body in the expression*)


(*-------------------S2-S5------*)
(*dotGrad S2 *)
val dotGrad=E.EIN{
params = [E.TEN],
index = [],
body = E.Sum(1,E.Apply( E.Partial([0,0]), E.Field(1,[]) ))
}

(* dotCross S3 *)
val dotCross=E.EIN{
params = [E.TEN],
index = [],
body = E.Sum(3,E.Apply( E.Partial([0,1]), E.Prod[E.Epsilon(0, 1, 2),E.Tensor(5,[2]) ]))
}

(*crossGrad S4 *)
val crossGrad=E.EIN{
params = [E.TEN],
index = [],
body = E.Sum(2,E.Apply( E.Partial([1,2]),E.Prod[ E.Epsilon(0, 1, 2),E.Tensor(5,[])]))
}

(*curlCurl= S5*)
val curlCurl=E.EIN{
params = [],
index = [],
body = E.Sum(4,E.Apply( E.Partial([1,3]),
E.Prod[ E.Epsilon(0, 1, 2), E.Epsilon( 2,3,4), E.Field(5,[4])]))
}




(*-----------------------------------------------*)
(*S6 Del * (axb)  *)
val S6=E.EIN{
params = [],
index = [],
body = E.Sum(3,E.Apply(    E.Partial([1]), E.Prod[E.Epsilon (1,2,3),
E.Tensor(0,[2]),E.Tensor(1,[3])]))
}

(*S7 Del x (axb)  *)
val S7=E.EIN{
params = [],
index = [],
body = E.Sum(4,E.Apply( E.Partial([2]), E.Prod[E.Epsilon (1,2,3),(E.Epsilon(3,4,5)), E.Tensor(0,[4]),E.Tensor(1,[5])]))
}

(*--------------- no more dels------------*)

(*S8 a * (b x c  *)
val S8=E.EIN{
params = [],
index = [],
body = E.Sum(3,E.Prod[E.Epsilon (1,2,3), E.Tensor(7,[1]),E.Tensor(8,[2]), E.Tensor(9,[3])])
}


(* S9 (axb) x c  *)
val S9=E.EIN{
params = [],
index = [],
body = E.Sum(4,E.Prod[E.Epsilon (1,2,3),(E.Epsilon(2,4,5)),E.Tensor(7,[4]),E.Tensor(8,[5]),E.Tensor(9,[3]) ])
}

(* S10 ax(uxv)*)
val S10=E.EIN{
params = [],
index = [],
body = E.Sum( 4,E.Prod[E.Epsilon (1,2,3),(E.Epsilon(3,4,5)),E.Tensor(0,[2]),E.Tensor(1,[4]),E.Tensor(2,[5]) ])
}


(*S11  (axb) x (cxd)  *)
val S11=E.EIN{
params = [],
index = [],
body = E.Sum( 6 , E.Prod[E.Epsilon (0,3,6),(E.Epsilon(3,4,5)),(E.Epsilon(6,7,8)),E.Tensor(0,[4]),E.Tensor(1,[5]), E.Tensor(2,[7]),E.Tensor(3,[8]) ])
}


(*S12 (axb) * (cxd)*)
val S12=E.EIN{
params = [],
index = [],
body = E.Sum( 5,E.Prod[E.Epsilon (1,2,3),(E.Epsilon(1,4,5)),E.Tensor(0,[2]),E.Tensor(1,[3]),E.Tensor(2,[4]), E.Tensor(3,[5])])
}







end;
end

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