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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/mid-to-low/field-to-low-set.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/mid-to-low/field-to-low-set.sml

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

revision 3541, Mon Jan 4 18:03:27 2016 UTC revision 3542, Mon Jan 4 19:47:38 2016 UTC
# Line 18  Line 18 
18    
19          in          in
20    
21      val testing=0  
22      fun mkImg e =evalImg.mkImg e      fun mkImg e =evalImg.mkImg e
23      fun mkkrns e =evalKrn.mkkrns e      fun mkkrns e =evalKrn.mkkrns e
24      fun assgnCons e=H.assgnCons e      fun assgnCons e=H.assgnCons e
25      fun mkDotVec e=H.mkDotVec e      fun mkDotVec e=H.mkDotVec e
   
26      fun iTos n=Int.toString n      fun iTos n=Int.toString n
27      fun err str=raise Fail(str)      fun err str=raise Fail(str)
28      fun testp n =(case testing      val testing=false
29          of 0 => 1      fun testp n =if (testing) then (print(String.concat n);1) else 1
         | _  => (print(String.concat n);1)  
         (*end case *))  
30    
31      (**** Helpers used in main evaluation ****)      (**** Helpers used in main evaluation ****)
32      (* sortK:E.ein_exp list*(E.image_id*E.alpha*E.pos list) list*(E.kernel_id* (E.mu*E.mu) list * E.pos) list      (* sortK:E.ein_exp list*(E.image_id*E.alpha*E.pos list) list*(E.kernel_id* (E.mu*E.mu) list * E.pos) list
# Line 69  Line 66 
66      * Product of Image and Kernel      * Product of Image and Kernel
67      *)      *)
68      fun prodImgKrn(setP,imgArg,krnArg,range0,range1)=let      fun prodImgKrn(setP,imgArg,krnArg,range0,range1)=let
   
69          fun ConsInt(setC,args)= assgnCons(setC,"",[range1], args)          fun ConsInt(setC,args)= assgnCons(setC,"",[range1], args)
   
70          fun mul2d(setT,[],rest,code,hy)=   let          fun mul2d(setT,[],rest,code,hy)=   let
71              val (setD,vD,D)=ConsInt(setT,rest)              val (setD,vD,D)=ConsInt(setT,rest)
72              in (setD,vD,code@D) end              in (setD,vD,code@D) end
# Line 91  Line 86 
86              in              in
87                  mul3d(setA,es,rest@[vA],code@A,n-1,consrest,hz)                  mul3d(setA,es,rest@[vA],code@A,n-1,consrest,hz)
88              end              end
   
89      (*Create Product by doing case analysis of the dimension*)      (*Create Product by doing case analysis of the dimension*)
90      in (case (krnArg,imgArg)      in (case (krnArg,imgArg)
91          of ([h0],[i])=> mkDotVec(setP,range1,[i,h0]) (*1-D case*)          of ([h0],[i])=> mkDotVec(setP,range1,[i,h0]) (*1-D case*)
# Line 116  Line 110 
110      *Main function to evaluate image and fields and multiple the results      *Main function to evaluate image and fields and multiple the results
111      *)      *)
112      fun evalField(setG,mapp,(E.Sum(sx,E.Opn(E.Prod, p)),(lhs,e,args)))=let      fun evalField(setG,mapp,(E.Sum(sx,E.Opn(E.Prod, p)),(lhs,e,args)))=let
   
113          val _= testp ["\n************** new direction **********"]          val _= testp ["\n************** new direction **********"]
   
114          val params=E.params e          val params=E.params e
115          val (img1,k1)=sortK(p,[],[])          val (img1,k1)=sortK(p,[],[])
116          val (imgarg,v,h)=getArgs(args,img1,List.hd(k1))          val (imgarg,v,h)=getArgs(args,img1,List.hd(k1))
   
117          val (E.V sid,lb,ub)=hd(sx)          val (E.V sid,lb,ub)=hd(sx)
118          val range0=(ub-lb)          val range0=(ub-lb)
119          val range1=range0+1          val range1=range0+1
 (*  
         val (setG,imgArg,imgCode)= mkImg(setG,mapp,lhs,params,args, sx,img1,v,imgarg,lb,range0,range1)  
         val (setK,krnArg, krnCode)= mkkrns(setI,mapp,lhs,params,args, k1,h,sid,lb,range0,range1)  
         val (setA,vA,A)=prodImgKrn(setK,imgArg,krnArg,range0,range1)  
 *)  
120  val (setG,imgArg,imgCode)= mkImg(setG,mapp,lhs,params,args, sx,img1,v,imgarg,lb,range0,range1)  val (setG,imgArg,imgCode)= mkImg(setG,mapp,lhs,params,args, sx,img1,v,imgarg,lb,range0,range1)
121  val (setG,krnArg, krnCode)= mkkrns(setG,mapp,lhs,params,args, k1,h,sid,lb,range0,range1)  val (setG,krnArg, krnCode)= mkkrns(setG,mapp,lhs,params,args, k1,h,sid,lb,range0,range1)
122  val (setA,vA,A)=prodImgKrn(setG,imgArg,krnArg,range0,range1)  val (setA,vA,A)=prodImgKrn(setG,imgArg,krnArg,range0,range1)
 val _=(String.concat["\n imgcode:",Int.toString(length(imgCode))," krncode: ",Int.toString(length(krnCode))," progimgk: ",Int.toString(length(A))])  
   
         val _=testp["Number of Assignments  in prodImgArg returned",iTos(length(imgArg))]  
123          in          in
124              (setA,vA,imgCode@krnCode@A)              (setA,vA,imgCode@krnCode@A)
125          end          end

Legend:
Removed from v.3541  
changed lines
  Added in v.3542

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