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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2521 - (download) (annotate)
Thu Jan 9 02:17:07 2014 UTC (5 years, 8 months ago) by cchiw
File size: 3016 byte(s)
Added type Checker
(* examples for the rewrite rules *)

structure  ExamplesS =struct

local
structure E = Ein

in

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

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

(*crossGrad S4 *)
val crossGrad=E.EIN{
    params = [E.FLD(3)],
    index = [3],
    body = E.Sum([(E.V 1,0,3), (E.V 2,0,3)],E.Apply( E.Partial([E.V 1,E.V 2]),E.Prod[ E.Epsilon(0, 1, 2),E.Field(0,[])]))
}

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

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

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

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

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


(* S9 (axb) x c  *)
val S9=E.EIN{
params = [E.TEN 1, E.TEN 1, E.TEN 1],
index = [3],
body = E.Sum([ (E.V 1,0,3), (E.V 2,0,3), (E.V 3,0,3)],E.Prod[E.Epsilon (0,1,2), E.Epsilon(1,2,3),E.Tensor(0,[E.V 2]),E.Tensor(1,[E.V 3]),E.Tensor(2,[E.V 2]) ])
}

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


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


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






end;
end

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