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 2399 - (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 :     end
13 :    
14 :     functor EinRepFn (I : EIN_INDEX_REP) =
15 :     struct
16 :    
17 :     type field_id = int
18 :     type tensor_id = int
19 :     type index_id = int
20 : cchiw 2399 type var = VarEin.var
21 : cchiw 2383
22 :     type index_kind = I.index_kind
23 :    
24 :     datatype ein = EIN of {
25 :     params : param_kind list, (* Parameters to equation are either tensors or fields *)
26 :     (* These variables are named using de Bruijn indexing *)
27 :     index : index_kind list, (* Index variables in the equation. *)
28 :     body : ein_exp
29 :     }
30 :    
31 :    
32 :     (*This will need to use types from types.sml*)
33 :     (* and tensor_type= T_Tensor of int list
34 :     and param_kind = TEN of tensor_type | FLD of tensor_type
35 :     *)
36 :    
37 :     and param_kind = TEN | FLD
38 :    
39 :     and ein_exp
40 :     = Const of real
41 :     | Tensor of tensor_id * multiindex
42 :     | Field of field_id * multiindex
43 :     | Add of ein_exp list
44 :     | Sum of int * ein_exp
45 :     | Prod of ein_exp list
46 : cchiw 2394 | Div of ein_exp * ein_exp
47 : cchiw 2383 | Sub of ein_exp * ein_exp
48 :     | Neg of ein_exp
49 :     | Delta of delta
50 :     | Epsilon of index_id * index_id * index_id
51 :     | Conv of var * delta list * var * index_id
52 :     | Partial of multiindex
53 :     | Probe of ein_exp * tensor_id (* Position is a tensor ID*)
54 :     | Inside of ein_exp * tensor_id (* Position is a tensor ID*)
55 :     | Apply of ein_exp * ein_exp (*newbie-need to restrict later*)
56 :     withtype multiindex = index_id list
57 :     and delta = index_id * index_id
58 :    
59 :     end

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