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

SCM Repository

[diderot] Annotation of /branches/charisee/src/compiler/ein/ein-rep-fn.sml
ViewVC logotype

Annotation of /branches/charisee/src/compiler/ein/ein-rep-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2414 - (view) (download)

1 : cchiw 2383 (* ein-rep-fn.sml
2 :     *
3 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * Generic representation of Einstein expressions.
7 :     *)
8 :    
9 :     signature EIN_INDEX_REP =
10 :     sig
11 :     type index_kind
12 : cchiw 2412 type param_kind
13 : cchiw 2383 end
14 :    
15 :     functor EinRepFn (I : EIN_INDEX_REP) =
16 :     struct
17 :    
18 :     type field_id = int
19 :     type tensor_id = int
20 :     type index_id = int
21 : cchiw 2399 type var = VarEin.var
22 : cchiw 2383
23 :     type index_kind = I.index_kind
24 : cchiw 2412 type param_kind = I.param_kind
25 : cchiw 2383 datatype ein = EIN of {
26 :     params : param_kind list, (* Parameters to equation are either tensors or fields *)
27 :     (* These variables are named using de Bruijn indexing *)
28 :     index : index_kind list, (* Index variables in the equation. *)
29 :     body : ein_exp
30 :     }
31 :    
32 :    
33 :     (*This will need to use types from types.sml*)
34 :     (* and tensor_type= T_Tensor of int list
35 :     and param_kind = TEN of tensor_type | FLD of tensor_type
36 :     *)
37 :    
38 : cchiw 2412 (*and param_kind = TEN | FLD*)
39 : cchiw 2383
40 :     and ein_exp
41 :     = Const of real
42 :     | Tensor of tensor_id * multiindex
43 :     | Field of field_id * multiindex
44 :     | Add of ein_exp list
45 :     | Sum of int * ein_exp
46 :     | Prod of ein_exp list
47 : cchiw 2394 | Div of ein_exp * ein_exp
48 : cchiw 2383 | Sub of ein_exp * ein_exp
49 :     | Neg of ein_exp
50 :     | Delta of delta
51 :     | Epsilon of index_id * index_id * index_id
52 : cchiw 2414 | Conv of ein_exp * delta list
53 : cchiw 2383 | Partial of multiindex
54 : cchiw 2412 | Probe of ein_exp * ein_exp(*tensor_id Position is a tensor ID*)
55 : cchiw 2407
56 : cchiw 2383 | Apply of ein_exp * ein_exp (*newbie-need to restrict later*)
57 :     withtype multiindex = index_id list
58 :     and delta = index_id * index_id
59 :    
60 :     end

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