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

SCM Repository

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

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

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

revision 2610, Fri May 2 18:31:56 2014 UTC revision 2611, Mon May 5 21:21:12 2014 UTC
# Line 86  Line 86 
86      | filterPartial(E.Partial d1::es)=d1@filterPartial(es)      | filterPartial(E.Partial d1::es)=d1@filterPartial(es)
87      | filterPartial _= err"Found non-Partial in Apply"      | filterPartial _= err"Found non-Partial in Apply"
88    
89    
90    fun filterEps eps=let
91  fun findeps(eps,[],rest)                  = (eps,rest,[])  fun findeps(eps,[],rest)                  = (eps,rest,[])
92    | findeps(eps,e1::es ,rest)=(case e1    | findeps(eps,e1::es ,rest)=(case e1
93      of (E.Epsilon eps1)                   => findeps(eps@[e1],es ,rest)      of (E.Epsilon eps1)                   => findeps(eps@[e1],es ,rest)
94      | E.Prod p                            => findeps(eps,p@es, rest)      | E.Prod p                            => findeps(eps,p@es, rest)
95      | E.Field _                           => findeps(eps,es,rest@[e1])      | E.Field _                           => findeps(eps,es,rest@[e1])
96      | E.Tensor _                          => findeps(eps,es,rest@[e1])      | E.Tensor _                          => findeps(eps,es,rest@[e1])
97      | E.Sum(c,E.Prod(E.Epsilon eps1::ps)) => (eps@[E.Epsilon eps1], rest@ps@es,c)          | E.Sum(c,E.Prod(E.Epsilon eps1::ps)) => (eps,rest@es,[e1])
98      |  _                                  => (eps,rest@[e1]@es,[])      |  _                                  => (eps,rest@[e1]@es,[])
99      (*end case*))      (*end case*))
100        in
101            findeps([], eps,[])
102        end
103    
104  (* filter Scalars outside Summation product *)  (* filter Scalars outside Summation product *)
105  fun filterSca(c,e)= let  fun filterSca(c,e)= let
# Line 190  Line 195 
195      in filter([],[],p)      in filter([],[],p)
196      end      end
197    
198    (*Count Occurences*)
199        fun findOcc(i,[])=0
200        | findOcc(i,E.V v::es)=if(i=v) then 1+findOcc(i, es) else findOcc(i,es)
201        | findOcc(i,v::es)=findOcc(i, es)
202    
203    
204  end  end
205    

Legend:
Removed from v.2610  
changed lines
  Added in v.2611

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