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 2585, Thu Apr 17 03:52:19 2014 UTC revision 2603, Thu Apr 24 03:58:37 2014 UTC
# Line 358  Line 358 
358      val op_cross = monoVar (N.op_cross, crossTy)      val op_cross = monoVar (N.op_cross, crossTy)
359      end      end
360    
361    
362    
363        val op_crossField  = polyVar (N.op_cross, all([DK],
364            fn [Ty.DIFF k] => let
365                  fun field' (k, d, dd) = field(k, Ty.DimConst d, Ty.Shape(List.map Ty.DimConst dd))
366                (*Hard-coded 2, should be 3 *)
367                val f = field' (Ty.DiffVar(k, 0), 2, [2])
368                in
369                    [f, f] --> f
370                end))
371    
372    (* the inner product operator (including dot product) is treated as a special case in the    (* the inner product operator (including dot product) is treated as a special case in the
373     * typechecker.  It is not included in the basis environment, but we define its type scheme     * typechecker.  It is not included in the basis environment, but we define its type scheme
374     * here.  There is an implicit constraint on its type to have the following scheme:     * here.  There is an implicit constraint on its type to have the following scheme:
# Line 481  Line 492 
492          val d' = Ty.DimVar d          val d' = Ty.DimVar d
493          val f = field(k0, d', Ty.Shape[d'])          val f = field(k0, d', Ty.Shape[d'])
494         (* val h = field(k0, d',  Ty.Shape[d',d'])*)         (* val h = field(k0, d',  Ty.Shape[d',d'])*)
495          val h = field(k0, d',  Ty.Shape[Ty.DimConst 3, Ty.DimConst 2])          val h = field(k0, d',  Ty.Shape[ d', d'])
496          in          in
497              [f, f] --> h              [f, f] --> h
498          end          end
# Line 540  Line 551 
551      val fn_trace = polyVar (N.fn_trace, all([NK],      val fn_trace = polyVar (N.fn_trace, all([NK],
552              fn [Ty.DIM d] => [matrix(Ty.DimVar d)] --> Ty.realTy))              fn [Ty.DIM d] => [matrix(Ty.DimVar d)] --> Ty.realTy))
553    
554        local
555            fun mktraceField [Ty.DIFF k, Ty.DIM d,Ty.SHAPE dd1] = let
556            val k0=Ty.DiffVar(k, 0)
557            val d' = Ty.DimVar d
558            val d1 = Ty.ShapeVar dd1
559            val f = field(k0, d', Ty.ShapeExt(Ty.ShapeExt(d1,d'),d'))
560            val h = field(k0, d', d1)
561            in
562                [f] --> h
563            end
564        in
565            val fn_traceField = polyVar (N.fn_trace, all([DK,NK,SK], mktraceField))
566    end
567    
568    
569    
570      val fn_transpose = polyVar (N.fn_transpose, all([NK, NK],      val fn_transpose = polyVar (N.fn_transpose, all([NK, NK],
571              fn [Ty.DIM d1, Ty.DIM d2] =>              fn [Ty.DIM d1, Ty.DIM d2] =>
572                [tensor[Ty.DimVar d1, Ty.DimVar d2]] --> tensor[Ty.DimVar d2, Ty.DimVar d1]))                [tensor[Ty.DimVar d1, Ty.DimVar d2]] --> tensor[Ty.DimVar d2, Ty.DimVar d1]))
573    
574    
575        local
576            fun mktransposeField [Ty.DIFF k, Ty.DIM d,Ty.DIM a, Ty.DIM b] = let
577            val k0=Ty.DiffVar(k, 0)
578            val d' = Ty.DimVar d
579             val a' = Ty.DimVar a
580             val b' = Ty.DimVar b
581            val f = field(k0, d', Ty.Shape[a',b'])
582            val h = field(k0, d', Ty.Shape[b',a'])
583            in
584                [f] --> h
585            end
586        in
587            val fn_transposeField = polyVar (N.fn_transpose, all([DK,NK,NK,NK], mktransposeField))
588        end
589    
590    
591    (* kernels *)    (* kernels *)
592  (* FIXME: we should really get the continuity info from the kernels themselves *)  (* FIXME: we should really get the continuity info from the kernels themselves *)
593      val kn_bspln3 = monoVar (N.kn_bspln3, Ty.T_Kernel(Ty.DiffConst 2))      val kn_bspln3 = monoVar (N.kn_bspln3, Ty.T_Kernel(Ty.DiffConst 2))

Legend:
Removed from v.2585  
changed lines
  Added in v.2603

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