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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/basis/basis-vars.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/basis/basis-vars.sml

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

revision 1385, Fri Jun 24 14:26:11 2011 UTC revision 1640, Wed Nov 16 02:19:51 2011 UTC
# Line 170  Line 170 
170      val neq_rr = monoVar(N.op_neq, [Ty.realTy, Ty.realTy] --> Ty.T_Bool)      val neq_rr = monoVar(N.op_neq, [Ty.realTy, Ty.realTy] --> Ty.T_Bool)
171    
172    
173      val neg_i = monoVar(N.op_neg, [Ty.T_Int, Ty.T_Int] --> Ty.T_Bool)      val neg_i = monoVar(N.op_neg, [Ty.T_Int] --> Ty.T_Int)
174      val neg_t = polyVar(N.op_neg, all([SK],      val neg_t = polyVar(N.op_neg, all([SK],
175            fn [Ty.SHAPE dd] => let            fn [Ty.SHAPE dd] => let
176                val t = Ty.T_Tensor(Ty.ShapeVar dd)                val t = Ty.T_Tensor(Ty.ShapeVar dd)
# Line 207  Line 207 
207                  [t, t, Ty.realTy, Ty.realTy, Ty.realTy] --> t                  [t, t, Ty.realTy, Ty.realTy, Ty.realTy] --> t
208                end))                end))
209    
210      (* Eigenvalues/vectors of a matrix; we only support this operation on 2x2 and 3x3 matrices, so
211       * we overload the function.
212       *)
213        local
214          fun evals d = monoVar (N.fn_evals, [matrix d] --> Ty.T_Sequence(Ty.realTy, d))
215          fun evecs d = monoVar (N.fn_evecs, [matrix d] --> Ty.T_Sequence(tensor[d], d))
216        in
217        val evals2x2 = evals(Ty.DimConst 2)
218        val evecs2x2 = evecs(Ty.DimConst 2)
219        val evals3x3 = evals(Ty.DimConst 3)
220        val evecs3x3 = evecs(Ty.DimConst 3)
221        end
222    
223    
224    (***** non-overloaded operators, etc. *****)    (***** non-overloaded operators, etc. *****)
225    
# Line 292  Line 305 
305                  [Ty.T_Tensor(Ty.ShapeVar s1), Ty.T_Tensor(Ty.ShapeVar s2)]                  [Ty.T_Tensor(Ty.ShapeVar s1), Ty.T_Tensor(Ty.ShapeVar s2)]
306                    --> Ty.T_Tensor(Ty.ShapeVar s3)))                    --> Ty.T_Tensor(Ty.ShapeVar s3)))
307    
   (* Eigenvalues of a matrix *)  
     val fn_evals = polyVar (N.fn_trace, all([NK],  
             fn [Ty.DIM d] => let  
                 val d = Ty.DimVar d  
                 in  
                   [matrix d] --> Ty.T_Sequence(Ty.realTy, d)  
                 end))  
   
   (* Eigenvectors of a matrix *)  
     val fn_evecs = polyVar (N.fn_trace, all([NK],  
             fn [Ty.DIM d] => let  
                 val d = Ty.DimVar d  
                 in  
                   [matrix d] --> Ty.T_Sequence(tensor[d], d)  
                 end))  
   
308      val fn_inside = polyVar (N.fn_inside, all([DK, NK, SK],      val fn_inside = polyVar (N.fn_inside, all([DK, NK, SK],
309              fn [Ty.DIFF k, Ty.DIM d, Ty.SHAPE dd] => let              fn [Ty.DIFF k, Ty.DIM d, Ty.SHAPE dd] => let
310                  val k = Ty.DiffVar(k, 0)                  val k = Ty.DiffVar(k, 0)
# Line 373  Line 370 
370      val fn_tan = monoVar (N.fn_tan, [Ty.realTy] --> Ty.realTy)      val fn_tan = monoVar (N.fn_tan, [Ty.realTy] --> Ty.realTy)
371    
372      val fn_trace = polyVar (N.fn_trace, all([NK],      val fn_trace = polyVar (N.fn_trace, all([NK],
373              fn [Ty.DIM d] => let              fn [Ty.DIM d] => [matrix(Ty.DimVar d)] --> Ty.realTy))
                 val d = Ty.DimVar d  
                 in  
                   [matrix d] --> Ty.realTy  
                 end))  
374    
375    (* kernels *)    (* kernels *)
376  (* FIXME: we should really get the continuity info from the kernels themselves *)  (* FIXME: we should really get the continuity info from the kernels themselves *)
# Line 401  Line 394 
394      val zero = polyVar (Atom.atom "$zero", all ([SK],      val zero = polyVar (Atom.atom "$zero", all ([SK],
395              fn [Ty.SHAPE dd] => [] --> Ty.T_Tensor(Ty.ShapeVar dd)))              fn [Ty.SHAPE dd] => [] --> Ty.T_Tensor(Ty.ShapeVar dd)))
396    
397      (* sequence subscript *)
398        val subscript = polyVar (Atom.atom "$sub", all ([TK, NK],
399                fn [Ty.TYPE tv, Ty.DIM d] =>
400                  [Ty.T_Sequence(Ty.T_Var tv, Ty.DimVar d), Ty.T_Int] --> Ty.T_Var tv))
401      end (* local *)      end (* local *)
402    end    end

Legend:
Removed from v.1385  
changed lines
  Added in v.1640

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