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

SCM Repository

[diderot] Annotation of /trunk/doc/report/types.tex
ViewVC logotype

Annotation of /trunk/doc/report/types.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2636 - (view) (download) (as text)

1 : jhr 101 %!TEX root = report.tex
2 :     %
3 :     \chapter{Types}
4 :     \label{chap:types}
5 :    
6 :     The grammar of Diderot types is as follows:
7 :     \begin{Grammar}
8 :     \TypeRULES{}
9 :     \end{Grammar}%
10 :    
11 :     \section{Value types}
12 :     Diderot supports four types of concrete values: booleans, integers, strings, and tensors.
13 :     The grammar of these types is
14 :     \begin{Grammar}
15 :     \ValueTypeRULES{}
16 :     \DimensionsRULES{}
17 :     \end{Grammar}%
18 :    
19 :     The tensor type \mbox{\kw{tensor}\kw{[}$d_1,\ldots{},d_n$\kw{]}} is the of type order-$n$ tensors
20 :     with shape $d_1,\ldots{},d_n$.
21 :     Tensors include scalars (order-0) and vectors (order-1).
22 :     Because these types are frequently used, Diderot supports the following predefined type definitions:
23 :     \begin{center}
24 :     \begin{tabular}{r@{$\quad\equiv\quad$}l}
25 :     \kw{real} & \texttt{\kw{tensor}\kw{[}\kw{]}} \\
26 :     \kw{vec2} & \texttt{\kw{tensor}\kw{[}2\kw{]}} \\
27 :     \kw{vec3} & \texttt{\kw{tensor}\kw{[}3\kw{]}} \\
28 :     \kw{vec4} & \texttt{\kw{tensor}\kw{[}4\kw{]}}
29 :     \end{tabular}
30 :     \end{center}%
31 :    
32 :     \section{Images}
33 : jhr 161 Images are rectangular arrays of tensor data that are used to represent the data sets
34 :     that Diderot programs are analysing, as well as other data.
35 :     The syntax of an image type is
36 :     \begin{center}
37 :     \kw{image}\kw{(} $n$ \kw{)} \kw{[} $d_1,\ldots{},d_n$ \kw{]}
38 :     \end{center}%
39 :     where $n$ is the dimension of the field (typically 2 or 3) and $d_1,\ldots{},d_n$ is the
40 :     shape of the tensor data (\ie{}, the elements of the image are tensors
41 :     of type \kw{tensor[}$d_1,\ldots{},d_n$\kw{]}).
42 : jhr 101
43 :     \section{Fields}
44 : jhr 161 Fields are functions from some $n$-dimensional vector space to some tensor type.
45 :     The syntax of a field type is
46 :     \begin{center}
47 :     \kw{field}\kw{\#} $k$ \kw{(} $n$ \kw{)} \kw{[} $d_1,\ldots{},d_n$ \kw{]}
48 :     \end{center}%
49 :     where $k \geq 0$ is the number of levels of differentiation supported by the field,
50 :     $n$ is the dimension of the field (typically 2 or 3), and $d_1,\ldots{},d_n$ is the shape of the field.
51 :     Probing the field will produce a tensor of type \kw{tensor[}$d_1,\ldots{},d_n$\kw{]}.
52 : jhr 101
53 :     \section{Kernels}
54 :     Kernels are abstract types that represent the \emph{convolution kernels} used
55 :     to reconstruct continuous fields from image data.
56 :     The syntax of a kernel type is \mbox{\kw{kernel}\kw{\#}$k$}, where
57 :     $k \geq 0$ gives the number of levels of differentiation supported by the
58 :     kernel.
59 : jhr 2636
60 :     \section{Type promotion}
61 :     Diderot's type system supports three kinds of \emph{implicit} type coercions that are
62 :     added by the type checker when necessary:
63 :     \begin{enumerate}
64 :     \item
65 :     Integer-typed expressions will be implicitly promoted to real-typed expressions.
66 :     \item
67 :     Static sequences will be implicitly promoted to dynamic sequences.
68 :     \item
69 :     A field-typed expression with continuity $k$ will be implicitly converted to a
70 :     field with lower continuity.
71 :     \end{enumerate}%

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