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

SCM Repository

[diderot] View of /branches/ein16/src/compiler/ein/ein.sml
ViewVC logotype

View of /branches/ein16/src/compiler/ein/ein.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3682 - (download) (annotate)
Thu Feb 18 20:13:18 2016 UTC (4 years, 5 months ago) by cchiw
File size: 2360 byte(s)
creating stable branch that represents ein ir
structure Ein =
  struct

(*TEN 0-Don't Subst,shape of arguement *)
datatype param_kind = TEN of int *int list | FLD of int|KRN|IMG of int*int list 
type index_kind =int
type field_id = int
type tensor_id = int
type kernel_id = int
type image_id = int
type index_id = int
type var = VarEin.var

datatype ein = EIN of {
    params : param_kind list,
    (* Parameters to equation are either tensors or fields *)
    (* These variables are named using de Bruijn indexing *)
    index : index_kind list,	(* Index variables in the equation. *)
    body : ein_exp
}

and mu = V of index_id| C of int * bool
and unary
    = Neg | Exp | Sqrt
    | Cosine | ArcCosine | Sine | ArcSine| Tangent | ArcTangent
    | PowInt of int | PowReal of RationalEin.rat | PowEmb of (sumrange list) *int
and binary  = Sub | Div 
and opn = Add| Prod
and greekterms
    = Delta of mu * mu
    | Epsilon of index_id * index_id * index_id
    | Eps2 of index_id * index_id
and basics
    = Const of int  | ConstR of RationalEin.rat
and ein_exp
    (* Basic terms *)
    = B of basics
    | Tensor of tensor_id * alpha
    | G of greekterms
    (*High-IL Terms*)
    | Field of field_id* alpha
    | Lift of ein_exp
    | Conv of image_id * alpha * kernel_id * alpha
    | Partial of alpha
    | Apply of ein_exp * ein_exp
    | Probe of ein_exp * ein_exp
    (*Mid-IL Terms*)
    | Value of index_id (*Lift index*)
    | Img of image_id*alpha*pos list
    | Krn of kernel_id* (mu*mu) list * pos
    (* Ops*)
    | Sum of (sumrange list) * ein_exp
    | Op1 of unary*ein_exp
    | Op2 of binary*ein_exp *ein_exp
    | Opn of opn * ein_exp list
    (*new terms of kernel*)

    | BuildPos of int * pos   (*support-s,pos*)
    | EvalKrn of int          (*Differentiate kenerl with dk int*)
    | Holder of int

    withtype alpha= mu list
    and pos=ein_exp
    and sumrange=mu*int*int

fun body(EIN{body,...})=body
fun params(EIN{params,...})=params
fun index(EIN{index,...})=index

fun mkEin(params,index,body)=EIN{params=params, index=index,body=body}
fun setBody(body',EIN{params,index,body})=EIN{params=params,index=index,body=body'}


fun setConst n= B(Const n)
fun setNeg e1 =  Op1(Neg,e1)
fun setExp e1 =  Op1(Exp,e1)
fun setDiv(e1,e2)= Op2(Div,e1,e2)
fun setSub(e1,e2)= Op2(Sub,e1,e2)
fun setProd es= Opn(Prod, es)
fun setAdd es=  Opn(Add, es)
fun setDelta(i,j)=G(Delta(i,j))

end

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