Home My Page Projects Code Snippets Project Openings diderot

SCM Repository

[diderot] View of /branches/charisee/src/compiler/einTest/testOrder.sml
 [diderot] / branches / charisee / src / compiler / einTest / testOrder.sml

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

Fri Oct 11 03:18:53 2013 UTC (7 years ago) by cchiw
File size: 1506 byte(s)
`probe.sml`
```structure  tOrder = struct

local
structure E = Ein
structure EinOp = Operators
structure P= Printer
structure O= OrderEin
structure N = NormalizeEin
in

val line="-----------------------------------------------"
fun testO(e)= (print line; P.printerE e ; print("     =>  ");let val ordered=(O.orderfn e)
in (P.printerE(ordered); print"\n => \n"; (let val n=N.normalize(ordered) in P.printerE(n) end)) end)

fun createO(b)= testO(Ein.EIN{params=[], index=[], body=b})

val o1=E.Prod[E.Sum([E.V 1], E.Prod[E.Tensor(0,[E.V 1]), E.Tensor(1, [E.V 1])]),
E.Sum([E.V 2, E.V 3], E.Prod[E.Epsilon(0,2,3), E.Tensor(2,[E.V 2]), E.Tensor(3, [E.V 3])])]

val o2 =E.Apply(E.Partial([E.V 1]),E.Sum([E.V 1],E.Prod[E.Sum([E.V 3, E.V 4],E.Prod[E.Epsilon(2, 3, 4), E.Tensor(0, [E.V 3]), E.Tensor(1, [E.V 4])]) ,E.Epsilon(0,1,2)]))

(*S11(AxB) x (CxD)*)
val o3=E.Prod[E.Sum([E.V 1, E.V 2],
E.Prod[E.Epsilon(0,1,2),
E.Sum([E.V 3, E.V 4],E.Prod[E.Epsilon(1,3,4),E.Tensor(0,[E.V 3]), E.Tensor(1, [E.V 4])]),
E.Sum([E.V 5, E.V 6], E.Prod[E.Epsilon(2,5,6), E.Tensor(2,[E.V 5]), E.Tensor(3, [E.V 6]) ])]
)]

val o4=E.Prod[E.Epsilon(2,5,6),E.Delta(E.V 1,E.V 2),E.Epsilon(1,5,6),E.Tensor(0,[E.V 1]),E.Epsilon(0,5,6)]

val o5=E.Prod[E.Sum([E.V 5, E.V 6],E.Prod[E.Epsilon(2,5,6),E.Delta(E.V 1,E.V 2),E.Epsilon(1,5,6)]),E.Sum([E.V 1,E.V 2],E.Prod[E.Tensor(0,[E.V 1]),E.Epsilon(0,5,6)])]

(*val r=List.map createO [o1,o2,o3,o4,o5]*)

end; (* local *)

end (* local *)
```