1 : |
jhr |
16 |
\documentclass[11pt]{article}
|
2 : |
|
|
|
3 : |
|
|
\input{defs}
|
4 : |
|
|
|
5 : |
|
|
\setlength{\textwidth}{6in}
|
6 : |
|
|
\setlength{\oddsidemargin}{0.25in}
|
7 : |
|
|
\setlength{\evensidemargin}{0.25in}
|
8 : |
|
|
\setlength{\parskip}{5pt}
|
9 : |
|
|
|
10 : |
jhr |
17 |
\title{Diderot design}
|
11 : |
jhr |
16 |
\author{
|
12 : |
|
|
Gordon Kindlmann \\
|
13 : |
|
|
University of Chicago \\
|
14 : |
|
|
{\small\tt{}glk@cs.uchicago.edu} \\
|
15 : |
|
|
\and
|
16 : |
|
|
John Reppy \\
|
17 : |
|
|
University of Chicago \\
|
18 : |
|
|
{\small\tt{}jhr@cs.uchicago.edu} \\
|
19 : |
jhr |
17 |
\and
|
20 : |
|
|
Thomas Schultz \\
|
21 : |
|
|
University of Chicago \\
|
22 : |
|
|
{\small\tt{}t.schultz@uchicago.edu} \\
|
23 : |
jhr |
16 |
}
|
24 : |
|
|
\date{\today}
|
25 : |
|
|
|
26 : |
|
|
\begin{document}
|
27 : |
|
|
|
28 : |
|
|
\maketitle
|
29 : |
|
|
\thispagestyle{empty}
|
30 : |
|
|
|
31 : |
|
|
\section{Introduction}
|
32 : |
glk |
20 |
This document is a semi-formal design of Diderot.
|
33 : |
jhr |
16 |
|
34 : |
|
|
\section{Types}
|
35 : |
jhr |
17 |
The syntax of Diderot types is given in \figref{fig:types}.
|
36 : |
|
|
\begin{figure}[t]
|
37 : |
|
|
\begin{displaymath}
|
38 : |
|
|
\begin{array}{rclr}
|
39 : |
glk |
21 |
\rho & ::= & $\ldots$ & \text{NRRD scalar types} \\[1em]
|
40 : |
jhr |
17 |
\iota & ::= & \TYbool & \text{booleans} \\
|
41 : |
|
|
& \mid & \TYint & \text{integers} \\[1em]
|
42 : |
glk |
21 |
% \mu for memory, where images of rawtensors will live (or on disk)
|
43 : |
jhr |
43 |
\mu & ::= & \TYrawten{\Seq{d}}{\rho} & \begin{minipage}[l]{3in}\begin{flushright}
|
44 : |
jhr |
44 |
tensors of order $|\Seq{d}|$ and dimensions $\Seq{d}$,\\with coefficients of type $\rho$
|
45 : |
glk |
21 |
\end{flushright}\end{minipage}\\[1em]
|
46 : |
jhr |
43 |
\theta & ::= & \TYtensor{\Seq{d}} & \begin{minipage}[l]{3in}\begin{flushright}
|
47 : |
jhr |
44 |
tensors of order $|\Seq{d}|$ and dimensions $\Seq{d}$,\\with real coefficients
|
48 : |
glk |
21 |
\end{flushright}\end{minipage}\\[1em]
|
49 : |
jhr |
17 |
\tau & ::= & \iota \\
|
50 : |
|
|
& \mid & \theta \\
|
51 : |
|
|
& \mid & \TYmatrix{n}{m} & \text{$n\times{}m$ matrix} \\
|
52 : |
glk |
21 |
& \mid & \TYimage{d}{\mu} & \text{$d$-dimension image of $\mu$ values}\\
|
53 : |
jhr |
17 |
& \mid & \TYkern{k} & \text{convolution kernel with $k$ derivatives} \\
|
54 : |
glk |
21 |
& \mid & \TYfield{k}{d}{\theta} & \text{$d$-dimension field of $\theta$ values with $k$ derivatives} \\
|
55 : |
jhr |
17 |
\end{array}%
|
56 : |
|
|
\end{displaymath}%
|
57 : |
|
|
where $o\in\Nat$ is the tensor order, $d,n,m\in\SET{2,3}$ are dimensions,
|
58 : |
|
|
and $k\in\Nat$ is the differentiability of a field.
|
59 : |
|
|
\caption{Diderot types}
|
60 : |
|
|
\label{fig:types}
|
61 : |
|
|
\end{figure}%
|
62 : |
|
|
We use some type abbreviations for common cases:
|
63 : |
jhr |
16 |
\begin{eqnarray*}
|
64 : |
jhr |
43 |
\TYreal & = & \TYtensor{\epsilon} \quad\text{for any $d$} \\
|
65 : |
|
|
\TYvec{d} & = & \TYtensor{d}
|
66 : |
jhr |
16 |
\end{eqnarray*}%
|
67 : |
|
|
|
68 : |
|
|
\section{Operations}
|
69 : |
|
|
|
70 : |
|
|
\subsection{Scalar operations}
|
71 : |
glk |
22 |
\noindent{}\point Arithmetic:
|
72 : |
jhr |
16 |
\begin{displaymath}
|
73 : |
jhr |
17 |
\begin{array}{cl}
|
74 : |
|
|
\BinopTy{{\odot}}{\tau}{\tau}{\tau}
|
75 : |
jhr |
44 |
& \text{for $\odot\in\SET{\OP{+},\OP{-},\OP{*},\OP{/}}$ and $\tau\in\SET{\TYint,\TYreal}$} \\
|
76 : |
|
|
\UnopTy{\OP{-}}{\tau}{\tau}
|
77 : |
jhr |
17 |
& \text{for $\tau\in\SET{\TYint,\TYreal}$}
|
78 : |
|
|
\end{array}%
|
79 : |
jhr |
16 |
\end{displaymath}%
|
80 : |
|
|
|
81 : |
glk |
22 |
\noindent{}\point Comparisons:
|
82 : |
jhr |
16 |
\begin{displaymath}
|
83 : |
|
|
\BinopTy{{\odot}}{\tau}{\tau}{\TYbool}
|
84 : |
jhr |
44 |
\qquad\text{for $\odot\in\SET{\OP{<},{\leq},\OP{=},{\neq}\OP{>},{\geq}}$ and $\tau\in\SET{\TYint,\TYreal}$}
|
85 : |
jhr |
16 |
\end{displaymath}%
|
86 : |
|
|
|
87 : |
|
|
|
88 : |
|
|
\subsection{Matrix operations}
|
89 : |
|
|
|
90 : |
|
|
\subsection{Tensor operations}
|
91 : |
|
|
|
92 : |
glk |
22 |
\noindent{}\point Addition:
|
93 : |
jhr |
16 |
\begin{displaymath}
|
94 : |
jhr |
43 |
\BinopTy{{\odot}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}
|
95 : |
jhr |
44 |
\qquad\text{for $\odot\in\SET{\OP{+},\OP{-}}$}
|
96 : |
glk |
22 |
\end{displaymath}%
|
97 : |
|
|
|
98 : |
|
|
\noindent{}\point Negation:
|
99 : |
|
|
\begin{displaymath}
|
100 : |
jhr |
44 |
\UnopTy{\OP{-}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}
|
101 : |
glk |
22 |
\end{displaymath}%
|
102 : |
|
|
|
103 : |
|
|
\noindent{}\point Scalar division:
|
104 : |
|
|
\begin{displaymath}
|
105 : |
jhr |
44 |
\BinopTy{\OP{/}}{\TYtensor{\Seq{d}}}{\TYreal}{\TYtensor{\Seq{d}}}
|
106 : |
glk |
22 |
\end{displaymath}%
|
107 : |
|
|
|
108 : |
|
|
\noindent{}\point Scalar multiplication (scalar times order-N):
|
109 : |
|
|
\begin{displaymath}
|
110 : |
jhr |
16 |
\begin{array}{c}
|
111 : |
jhr |
44 |
\BinopTy{\OP{*}}{\TYreal}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}} \\
|
112 : |
|
|
\BinopTy{\OP{*}}{\TYtensor{\Seq{d}}}{\TYreal}{\TYtensor{\Seq{d}}}
|
113 : |
jhr |
16 |
\end{array}%
|
114 : |
|
|
\end{displaymath}%
|
115 : |
|
|
|
116 : |
glk |
22 |
\noindent{}\point Tensor scalar multiplication (contraction of two order-N
|
117 : |
|
|
tensors down to a scalar, \eg{} dot product of vectors, double dot
|
118 : |
|
|
product of 2nd-order tensors)
|
119 : |
jhr |
17 |
\begin{displaymath}
|
120 : |
glk |
22 |
\begin{array}{c}
|
121 : |
jhr |
43 |
\BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}{\TYreal}
|
122 : |
glk |
22 |
\end{array}%
|
123 : |
jhr |
17 |
\end{displaymath}%
|
124 : |
glk |
22 |
Defined by $c = A_{\vec{i}}B_{\vec{i}}$
|
125 : |
|
|
~(\eg{} $\mathbf{a}\cdot\mathbf{b} = a_ib_i$ or $\mathbf{A:B} = A_{ij}B_{ij}$)
|
126 : |
|
|
NOTE: In this and subsequent index notation expressions, a vector over the index variable
|
127 : |
|
|
(\eg{} $\vec{i}$) means that the variable is in fact standing for a sequence of
|
128 : |
|
|
contiguous index variables \\
|
129 : |
|
|
Possible direct notation syntax: ~~ {\tt .} (period) ~~ {\tt :} (colon) ~~ {\tt dot} ~~ {\tt o}
|
130 : |
jhr |
17 |
|
131 : |
glk |
22 |
\noindent{}\point Tensor product (aka outer product; order output is sum of orders)
|
132 : |
jhr |
16 |
\begin{displaymath}
|
133 : |
glk |
22 |
\begin{array}{c}
|
134 : |
jhr |
43 |
\BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d'}}}{\TYtensor{\Seq{d}\Seq{d'}}}
|
135 : |
glk |
22 |
\end{array}%
|
136 : |
jhr |
16 |
\end{displaymath}%
|
137 : |
glk |
22 |
Defined by $C_{\vec{i}\vec{j}} = A_{\vec{i}}B_{\vec{j}}$ \\
|
138 : |
|
|
Possible direct notation syntax: ~~ {\tt x} ~~ {\tt (x)} ~~ {\tt out}
|
139 : |
jhr |
16 |
|
140 : |
glk |
22 |
\noindent{}\point Matrix Multiply
|
141 : |
jhr |
17 |
\begin{displaymath}
|
142 : |
glk |
22 |
\begin{array}{c}
|
143 : |
jhr |
43 |
\BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{d_1 d_2}}{\TYtensor{\Seq{d}}} \\
|
144 : |
|
|
\BinopTy{{?}}{\TYtensor{d_1 d_2}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}
|
145 : |
glk |
22 |
\end{array}%
|
146 : |
jhr |
17 |
\end{displaymath}%
|
147 : |
glk |
22 |
Defined by $C_{i\vec{k}} = A_{ij}B_{j\vec{k}}$ and $C_{\vec{i}k} = B_{\vec{i}j}A_{jk}$
|
148 : |
|
|
~(\eg{} $u_i = M_{ij}v_j$ or $T_{ijl} = S_{ijk}M_{kl}$) \\
|
149 : |
|
|
Possible direct notation syntax: ~~ ?
|
150 : |
jhr |
17 |
|
151 : |
glk |
22 |
\noindent{}\point Contracting out last or first index of tensor (order $o \geq 1$)
|
152 : |
|
|
with vector
|
153 : |
|
|
\begin{displaymath}
|
154 : |
|
|
\begin{array}{c}
|
155 : |
jhr |
43 |
\BinopTy{{?}}{\TYtensor{d'\Seq{d}}}{\TYvec{d}}{\TYtensor{\Seq{d}}} \\
|
156 : |
|
|
\BinopTy{{?}}{\TYvec{d}}{\TYtensor{d'\Seq{d}}}{\TYtensor{\Seq{d}}}
|
157 : |
glk |
22 |
\end{array}%
|
158 : |
|
|
\end{displaymath}%
|
159 : |
|
|
Defined by $C_{\vec{i}} = A_{\vec{i}j}v_j$ and $C_{\vec{j}} = v_iA_{j\vec{j}}$ \\
|
160 : |
|
|
Possible direct notation syntax: ~~ ?
|
161 : |
|
|
|
162 : |
|
|
\noindent{}\point Arbitrary ``tensor comprehension''. The product can also be
|
163 : |
|
|
expressed in general index notation, and which may increase, preserve, or
|
164 : |
|
|
decrease the tensor order.
|
165 : |
|
|
\begin{displaymath}
|
166 : |
|
|
\begin{array}{c}
|
167 : |
jhr |
43 |
\BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{p}{d}}{\TYtensor{q}{d}}
|
168 : |
glk |
22 |
\end{array}%
|
169 : |
|
|
\end{displaymath}%
|
170 : |
|
|
Defined by the conventions of Einstein summation notation. \\
|
171 : |
|
|
Possible syntax: {\tt <A.i.j.k,B.j.k.l>} ~~ {\tt <A\_i\_j\_k,B\_j\_k\_l>}
|
172 : |
|
|
|
173 : |
jhr |
16 |
\subsection{Field operations}
|
174 : |
|
|
|
175 : |
glk |
22 |
\noindent{}\point Creation from an image:
|
176 : |
jhr |
16 |
\begin{displaymath}
|
177 : |
jhr |
43 |
\BinopTy{\OPconvolve}{\TYkern{k}}{\TYimage{d'}{\TYrawten{\Seq{d}}{\rho}}}{\TYfield{k}{d'}{\TYtensor{\Seq{d}}}}
|
178 : |
jhr |
16 |
\end{displaymath}%
|
179 : |
|
|
|
180 : |
glk |
22 |
\noindent{}\point Scalar multiplication:
|
181 : |
jhr |
17 |
\begin{displaymath}
|
182 : |
|
|
\begin{array}{c}
|
183 : |
jhr |
44 |
\BinopTy{\OP{*}}{\TYreal}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}} \\
|
184 : |
|
|
\BinopTy{\OP{*}}{\TYfield{k}{d}{\theta}}{\TYreal}{\TYfield{k}{d}{\theta}}
|
185 : |
jhr |
17 |
\end{array}%
|
186 : |
|
|
\end{displaymath}%
|
187 : |
|
|
|
188 : |
glk |
22 |
\noindent{}\point Scalar division:
|
189 : |
jhr |
17 |
\begin{displaymath}
|
190 : |
jhr |
44 |
\BinopTy{\OP{/}}{\TYfield{k}{d}{\theta}}{\TYreal}{\TYfield{k}{d}{\theta}}
|
191 : |
jhr |
17 |
\end{displaymath}%
|
192 : |
|
|
|
193 : |
glk |
22 |
\noindent{}\point Negation:
|
194 : |
glk |
21 |
\begin{displaymath}
|
195 : |
jhr |
44 |
\UnopTy{\OP{-}}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}}
|
196 : |
glk |
21 |
\end{displaymath}%
|
197 : |
|
|
|
198 : |
glk |
22 |
\noindent{}\point Addition:
|
199 : |
jhr |
16 |
\begin{displaymath}
|
200 : |
glk |
21 |
\begin{array}{c}
|
201 : |
|
|
\BinopTy{{\odot}}{\TYfield{k}{d}{\theta}}{\theta}{\TYfield{k}{d}{\theta}} \\
|
202 : |
|
|
\BinopTy{{\odot}}{\theta}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}} \\
|
203 : |
jhr |
17 |
\BinopTy{{\odot}}{\TYfield{k_1}{d}{\theta}}{\TYfield{k_2}{d}{\theta}}{\TYfield{\min(k_1,k_2)}{d}{\theta}}
|
204 : |
glk |
21 |
\end{array}%
|
205 : |
jhr |
44 |
\qquad\text{for $\odot\in\SET{\OP{+},\OP{-}}$}
|
206 : |
jhr |
16 |
\end{displaymath}%
|
207 : |
|
|
|
208 : |
glk |
22 |
\noindent{}\point Differentiation:
|
209 : |
jhr |
16 |
\begin{displaymath}
|
210 : |
jhr |
43 |
\UnopTy{\OPdiff}{\TYfield{k}{d'}{\TYtensor{\Seq{d}}}}{\TYfield{k-1}{d'}{\TYtensor{d'\Seq{d}}}}
|
211 : |
jhr |
16 |
\qquad\text{for $k > 0$}
|
212 : |
|
|
\end{displaymath}%
|
213 : |
|
|
|
214 : |
glk |
22 |
\noindent{}\point Probing:
|
215 : |
jhr |
16 |
\begin{displaymath}
|
216 : |
jhr |
44 |
\BinopTy{\OP{@}}{\TYfield{k}{d}{\theta}}{\TYvec{d}}{\theta}
|
217 : |
jhr |
16 |
\end{displaymath}%
|
218 : |
|
|
|
219 : |
|
|
\end{document}
|