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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/einTest/testNormalize.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/einTest/testNormalize.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2448, Tue Oct 1 00:57:08 2013 UTC revision 2449, Thu Oct 3 20:15:16 2013 UTC
# Line 5  Line 5 
5      structure E = Ein      structure E = Ein
6      structure P= Printer      structure P= Printer
7          structure N = NormalizeEin          structure N = NormalizeEin
8     structure ExN =ExamplesN    (* structure ExN =ExamplesN*)
9      in      in
10    
11    
12    
13  fun test(e)=   (print"------------------ " ; P.printerE(e); print("     =>  ");  P.printerE(N.normalize(e));print" \n ------------------------")  fun test(e)=   (print"------------------ " ; P.printerE(e); let val n=N.normalize(e) in (*P.printerE*) n end ;print" \n ------------------------")
14    
15    
16  fun create(b)= E.EIN{params=[], index=[], body=b}  fun create(b)= E.EIN{params=[], index=[], body=b}
17    
18    
19  (*-----Test more complicated terms in Normalize Function:normalize.sml---------------*)  (*-----Test more complicated terms in Normalize Function:normalize.sml---------------*)
20    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]) ]))
21    
22    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]) ]))
23    
24    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]) ]))
25    
26    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]) ]] ]  ))
27    
28    
29  fun run set=  fun run set=
30       let       let
31          val base=[]          val base=[]
32    
33            val r0=List.map create[R10,R10b, R10c,R10d]
34          val r1= List.map create [ExN.R1,ExN.R2,ExN.R3, ExN.R4,ExN.R5,ExN.R7, ExN.R8, ExN.R9]  (*        val r1= List.map create [ExN.R1,ExN.R2,ExN.R3, ExN.R4,ExN.R5,ExN.R7, ExN.R8, ExN.R9]
35                  (*Test R5 change eps to delts*)                  (*Test R5 change eps to delts*)
36          val r2= List.map create [ExN.R10, ExN.R10b,ExN.R10c,ExN.R10d, ExN.R10e, ExN.R10f]          val r2= List.map create [ExN.R10, ExN.R10b,ExN.R10c,ExN.R10d, ExN.R10e, ExN.R10f]
37                  (*dels*)                  (*dels*)
# Line 32  Line 40 
40    
41          val s1=  [ExN.dotGrad, ExN.dotCross,ExN.crossGrad,ExN.curlCurl]          val s1=  [ExN.dotGrad, ExN.dotCross,ExN.crossGrad,ExN.curlCurl]
42          val s2=[ ExN.S6, ExN.S7]          val s2=[ ExN.S6, ExN.S7]
43          val s3=[ExN.S8,ExN.S9, ExN.S10,ExN.S11, ExN.S12]          val s3=[ExN.S8,ExN.S9, ExN.S10,ExN.S11, ExN.S12]*)
44    
45      in      in
46          if(set=0) then List.map test base          List.map test r0
47           (* if(set=0) then List.map test base
48          else if(set=1) then List.map test r1          else if(set=1) then List.map test r1
49          else if(set=2) then List.map test r2          else if(set=2) then List.map test r2
50          else if(set=3) then List.map test r3          else if(set=3) then List.map test r3
# Line 44  Line 53 
53          else if(set=5) then List.map test s1          else if(set=5) then List.map test s1
54          else if(set=6) then List.map test s2          else if(set=6) then List.map test s2
55          else if(set=7) then List.map test s3          else if(set=7) then List.map test s3
56          else List.map test base          else List.map test base*)
57      end      end
58    
59  val r=run 0  val r=run 2
60    
61    
62    

Legend:
Removed from v.2448  
changed lines
  Added in v.2449

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