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

Tue Oct 29 05:29:46 2013 UTC (6 years, 11 months ago) by cchiw
File size: 1737 byte(s)
`changes to high-to-mid`
```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 u=(O.orderfn e)
in (P.printerE(u);print("     =>  "); P.printerE(N.normalize(u))  )  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 o6=E.Prod[
E.Sum([E.V 5, E.V 6],
E.Prod[E.Epsilon(2,0,3),E.Delta(E.V 1,E.V 2),E.Epsilon(1,5,6),E.Tensor(1,[E.V 0])]),
E.Sum([E.V 1,E.V 2],
E.Prod[E.Tensor(0,[E.V 1]),E.Value(1), E.Tensor(1,[]),E.Epsilon(0,5,6)])]

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

end; (* local *)

end (* local *)
```