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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/ein/gen-ein.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/ein/gen-ein.sml

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

revision 2520, Mon Dec 30 05:08:47 2013 UTC revision 2521, Thu Jan 9 02:17:07 2014 UTC
# Line 146  Line 146 
146      in (vE, D @[E])      in (vE, D @[E])
147      end      end
148    
149    (*product of -1 and 1 projection*)
150    fun mkNegV(mapp,[],(vA,id2,ix2))=let
151        val (vB, B)= mkVec(id2,ix2,mapp)
152        val (vD, D)=aaV(g.prodScaV(vA, vB))
153        in (vD,[B,D]) end
154    
155    
156    
157  (*Dot Product like summation  (*Dot Product like summation
# Line 194  Line 200 
200  (*Iterate over the outside index*)  (*Iterate over the outside index*)
201  (*nextfn is the next function*)  (*nextfn is the next function*)
202  (*m are two tensors*)  (*m are two tensors*)
203  fun prodIter(m,index',sx,nextfn)=let  fun prodIter(m,index,sx,nextfn)=let
204    
205        val index'=List.map (fn (e)=>(e-1)) index
206      fun M(a,[],rest,code)=let      fun M(a,[],rest,code)=let
207          val (vF,code')=nextfn(a,sx,m)          val (vF,code')=nextfn(a,sx,m)
208          in (vF, code'@code)          in (vF, code'@code)
# Line 247  Line 255 
255          else  prodIter(orig,index,[],f2)          else  prodIter(orig,index,[],f2)
256      end      end
257    
258    fun handleNeg(index,id, ix)=let
259        val (vA,A)=aaV(g.C( ~1))
260        val (code)=prodIter(("m",id,ix),index,[],mkNegV)
261        in ([A]@code) end
262    
263    
264  (*Prodduct of two tensors*)  (*Prodduct of two tensors*)
# Line 497  Line 508 
508          | E.Tensor(id,[])=>A          | E.Tensor(id,[])=>A
509    
510          (*Potential for Vectorization here *)          (*Potential for Vectorization here *)
511            | E.Neg(E.Tensor(id,ix))=> handleNeg(index,id, ix)
512          | E.Add _ => handleSimpleAdd(body,index)          | E.Add _ => handleSimpleAdd(body,index)
513          | E.Sub(E.Tensor(id1, ix1), E.Tensor(id2, ix2)) =>          | E.Sub(E.Tensor(id1, ix1), E.Tensor(id2, ix2)) =>
514              handleSimpleOp([(id1,ix1),(id2,ix2)],index,mksubVec,mksubSca)              handleSimpleOp([(id1,ix1),(id2,ix2)],index,mksubVec,mksubSca)

Legend:
Removed from v.2520  
changed lines
  Added in v.2521

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