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

Mon Nov 4 21:33:35 2013 UTC (6 years, 11 months ago) by cchiw
File size: 1876 byte(s)
`mid-il fixes`
```structure  tOrder = struct

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

val line="-----------------------------------------------"
fun testO(e)= (
print line; print (P.printerE e ); print("     =>  "); let val u=(O.orderfn e)
in (print(P.printerE(u));print("     =>  "); let val (u2,c)=N.normalize(u)  in print(P.printerE(u2)) end  )  end
)

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

val o1=E.Prod[E.Sum([(E.V 1,0,3)], E.Prod[E.Tensor(0,[E.V 1]), E.Tensor(1, [E.V 1])]),
E.Sum([(E.V 2,0,3), (E.V 3,0,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,0,3)],E.Prod[E.Sum([(E.V 3,0,3),( E.V 4,0,3)],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,0,3), (E.V 2,0,3)],
E.Prod[E.Epsilon(0,1,2),
E.Sum([(E.V 3,0,3), (E.V 4,0,3)],E.Prod[E.Epsilon(1,3,4),E.Tensor(0,[E.V 3]), E.Tensor(1, [E.V 4])]),
E.Sum([(E.V 5,0,3), (E.V 6,0,3)], 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,0,3), (E.V 6,0,3)],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,0,3), (E.V 2,0,3)],E.Prod[E.Tensor(0,[E.V 1]),E.Epsilon(0,5,6)])]

val o6=E.Prod[
E.Sum([(E.V 5,0,3), (E.V 6,0,3)],
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,0,3), (E.V 2,0,3)],
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 *)
```