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

# SCM Repository

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

# View of /branches/charisee/src/compiler/einTest/testNormalize.sml

Revision 2449 - (download) (annotate)
Thu Oct 3 20:15:16 2013 UTC (5 years, 11 months ago) by cchiw
File size: 2585 byte(s)
` `
```(*Test transform function*)
structure  tNormalize = struct

local
structure E = Ein
structure P= Printer
structure N = NormalizeEin
(* structure ExN =ExamplesN*)
in

fun test(e)=   (print"------------------ " ; P.printerE(e); let val n=N.normalize(e) in (*P.printerE*) n end ;print" \n ------------------------")

fun create(b)= E.EIN{params=[], index=[], body=b}

(*-----Test more complicated terms in Normalize Function:normalize.sml---------------*)
val R10=(E.Sum([E.V 0, E.V 1, E.V 2, E.V 3, E.V 4],E.Prod[E.Epsilon(0,1,2),E.Epsilon(0,3,4),E.Tensor(0,[E.V 3]), E.Tensor(1,[E.V 4]),E.Tensor(2,[E.V 1]), E.Tensor(3,[E.V 2]) ]))

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

val R10c=(E.Sum([E.V 0, E.V 1, E.V 2, E.V 3, E.V 4],E.Prod[E.Epsilon(0,1,2),E.Epsilon(8,9,11),E.Epsilon(0,3,4),E.Tensor(0,[E.V 3]), E.Tensor(1,[E.V 4]),E.Tensor(2,[E.V 1]), E.Tensor(3,[E.V 2]) ]))

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

fun run set=
let
val base=[]

val r0=List.map create[R10,R10b, R10c,R10d]
(*        val r1= List.map create [ExN.R1,ExN.R2,ExN.R3, ExN.R4,ExN.R5,ExN.R7, ExN.R8, ExN.R9]
(*Test R5 change eps to delts*)
val r2= List.map create [ExN.R10, ExN.R10b,ExN.R10c,ExN.R10d, ExN.R10e, ExN.R10f]
(*dels*)
val r3=List.map create [ExN.R11, ExN.R11b, ExN.R11c, ExN.R11d, ExN.R11e, ExN.R11f, ExN.R11g, ExN.R11h, ExN.R11i, ExN.R11j, ExN.R11k ,ExN.R11l, ExN.R11m, ExN.R11n, ExN.R11o ,ExN.R11p, ExN.R11q, ExN.R11r]
val r4=List.map create [ExN.sR12,ExN.sR13,ExN.sR14, ExN.sR14b, ExN.sR14c]

val s1=  [ExN.dotGrad, ExN.dotCross,ExN.crossGrad,ExN.curlCurl]
val s2=[ ExN.S6, ExN.S7]
val s3=[ExN.S8,ExN.S9, ExN.S10,ExN.S11, ExN.S12]*)

in
List.map test r0
(* if(set=0) then List.map test base
else if(set=1) then List.map test r1
else if(set=2) then List.map test r2
else if(set=3) then List.map test r3
else if(set=4) then List.map test r4

else if(set=5) then List.map test s1
else if(set=6) then List.map test s2
else if(set=7) then List.map test s3
else List.map test base*)
end

val r=run 2

end; (* local *)

end (* local *)
```

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