Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /trunk/doc/diderot.tex
 [diderot] / trunk / doc / diderot.tex

# Diff of /trunk/doc/diderot.tex

revision 21, Sat Jan 16 18:16:32 2010 UTC revision 44, Tue Apr 6 15:36:27 2010 UTC
# Line 40  Line 40
40        \iota & ::= & \TYbool & \text{booleans} \\        \iota & ::= & \TYbool & \text{booleans} \\
41             & \mid & \TYint & \text{integers} \\[1em]             & \mid & \TYint & \text{integers} \\[1em]
42        % \mu for memory, where images of rawtensors will live (or on disk)        % \mu for memory, where images of rawtensors will live (or on disk)
43        \mu & ::= & \TYrawten{o}{d}{\rho} & \begin{minipage}[l]{3in}\begin{flushright}        \mu & ::= & \TYrawten{\Seq{d}}{\rho} & \begin{minipage}[l]{3in}\begin{flushright}
44            tensors of order $o$ and dimension $d$,\\with coefficients of type $\rho$            tensors of order $|\Seq{d}|$ and dimensions $\Seq{d}$,\\with coefficients of type $\rho$
45            \end{flushright}\end{minipage}\\[1em]            \end{flushright}\end{minipage}\\[1em]
46        \theta & ::= & \TYtensor{o}{d} & \begin{minipage}[l]{3in}\begin{flushright}        \theta & ::= & \TYtensor{\Seq{d}} & \begin{minipage}[l]{3in}\begin{flushright}
47            tensors of order $o$ and dimension $d$,\\with real coefficients            tensors of order $|\Seq{d}|$ and dimensions $\Seq{d}$,\\with real coefficients
48            \end{flushright}\end{minipage}\\[1em]            \end{flushright}\end{minipage}\\[1em]
49        \tau & ::= & \iota \\        \tau & ::= & \iota \\
50             & \mid & \theta \\             & \mid & \theta \\
# Line 61  Line 61
61  \end{figure}%  \end{figure}%
62  We use some type abbreviations for common cases:  We use some type abbreviations for common cases:
63  \begin{eqnarray*}  \begin{eqnarray*}
64    \TYreal & = & \TYtensor{0}{d} \quad\text{for any $d$} \\    \TYreal & = & \TYtensor{\epsilon} \quad\text{for any $d$} \\
65    \TYvec{d} & = & \TYtensor{1}{d}    \TYvec{d} & = & \TYtensor{d}
66  \end{eqnarray*}%  \end{eqnarray*}%
67
68  \section{Operations}  \section{Operations}
69
70  \subsection{Scalar operations}  \subsection{Scalar operations}
71  \noindent{}Arithmetic:  \noindent{}\point Arithmetic:
72  \begin{displaymath}  \begin{displaymath}
73    \begin{array}{cl}    \begin{array}{cl}
74      \BinopTy{{\odot}}{\tau}{\tau}{\tau}      \BinopTy{{\odot}}{\tau}{\tau}{\tau}
75      & \text{for $\odot\in\SET{{+},{-},{*},{/}}$ and $\tau\in\SET{\TYint,\TYreal}$} \\      & \text{for $\odot\in\SET{\OP{+},\OP{-},\OP{*},\OP{/}}$ and $\tau\in\SET{\TYint,\TYreal}$} \\
76      \UnopTy{{-}}{\tau}{\tau}      \UnopTy{\OP{-}}{\tau}{\tau}
77      & \text{for $\tau\in\SET{\TYint,\TYreal}$}      & \text{for $\tau\in\SET{\TYint,\TYreal}$}
78    \end{array}%    \end{array}%
79  \end{displaymath}%  \end{displaymath}%
80
81  \noindent{}Comparisons:  \noindent{}\point Comparisons:
82  \begin{displaymath}  \begin{displaymath}
83    \BinopTy{{\odot}}{\tau}{\tau}{\TYbool}    \BinopTy{{\odot}}{\tau}{\tau}{\TYbool}
84    \qquad\text{for $\odot\in\SET{{<},{\leq},{=},{\neq}{>},{\geq}}$ and $\tau\in\SET{\TYint,\TYreal}$}    \qquad\text{for $\odot\in\SET{\OP{<},{\leq},\OP{=},{\neq}\OP{>},{\geq}}$ and $\tau\in\SET{\TYint,\TYreal}$}
85  \end{displaymath}%  \end{displaymath}%
86
87
# Line 89  Line 89
89
90  \subsection{Tensor operations}  \subsection{Tensor operations}
91
93    \begin{displaymath}
94      \BinopTy{{\odot}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}
95      \qquad\text{for $\odot\in\SET{\OP{+},\OP{-}}$}
96    \end{displaymath}%
97
98    \noindent{}\point Negation:
99    \begin{displaymath}
100      \UnopTy{\OP{-}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}
101    \end{displaymath}%
102
103    \noindent{}\point Scalar division:
104    \begin{displaymath}
105      \BinopTy{\OP{/}}{\TYtensor{\Seq{d}}}{\TYreal}{\TYtensor{\Seq{d}}}
106    \end{displaymath}%
107
108    \noindent{}\point Scalar multiplication (scalar times order-N):
109  \begin{displaymath}  \begin{displaymath}
110    \begin{array}{c}    \begin{array}{c}
111      \BinopTy{{*}}{\TYreal}{\TYtensor{o}{d}}{\TYtensor{o}{d}} \\      \BinopTy{\OP{*}}{\TYreal}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}} \\
112      \BinopTy{{*}}{\TYtensor{o}{d}}{\TYreal}{\TYtensor{o}{d}}      \BinopTy{\OP{*}}{\TYtensor{\Seq{d}}}{\TYreal}{\TYtensor{\Seq{d}}}
113    \end{array}%    \end{array}%
114  \end{displaymath}%  \end{displaymath}%
115
116  \noindent{}Scalar division:  \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  \begin{displaymath}  \begin{displaymath}
120    \BinopTy{{/}}{\TYtensor{o}{d}}{\TYreal}{\TYtensor{o}{d}}    \begin{array}{c}
121        \BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d}}}{\TYreal}
122      \end{array}%
123  \end{displaymath}%  \end{displaymath}%
124    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
131  \noindent{}Addition:  \noindent{}\point Tensor product (aka outer product; order output is sum of orders)
132  \begin{displaymath}  \begin{displaymath}
133    \BinopTy{{\odot}}{\TYtensor{o}{d}}{\TYtensor{o}{d}}{\TYtensor{o}{d}}    \begin{array}{c}
134    \qquad\text{for $\odot\in\SET{{+},{-}}$}      \BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{\Seq{d'}}}{\TYtensor{\Seq{d}\Seq{d'}}}
135      \end{array}%
136  \end{displaymath}%  \end{displaymath}%
137    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
140  \noindent{}Negation:  \noindent{}\point Matrix Multiply
141  \begin{displaymath}  \begin{displaymath}
142    \UnopTy{-}{\TYtensor{o}{d}}{\TYtensor{o}{d}}    \begin{array}{c}
143        \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      \end{array}%
146    \end{displaymath}%
147    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
151    \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        \BinopTy{{?}}{\TYtensor{d'\Seq{d}}}{\TYvec{d}}{\TYtensor{\Seq{d}}} \\
156        \BinopTy{{?}}{\TYvec{d}}{\TYtensor{d'\Seq{d}}}{\TYtensor{\Seq{d}}}
157      \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        \BinopTy{{?}}{\TYtensor{\Seq{d}}}{\TYtensor{p}{d}}{\TYtensor{q}{d}}
168      \end{array}%
169  \end{displaymath}%  \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  \subsection{Field operations}  \subsection{Field operations}
174
175  \noindent{}Creation from an image:  \noindent{}\point Creation from an image:
176  \begin{displaymath}  \begin{displaymath}
177    \BinopTy{\OPconvolve}{\TYkern{k}}{\TYimage{d}{\mu}}{\TYfield{k}{d}{\theta}}    \BinopTy{\OPconvolve}{\TYkern{k}}{\TYimage{d'}{\TYrawten{\Seq{d}}{\rho}}}{\TYfield{k}{d'}{\TYtensor{\Seq{d}}}}
\qquad\text{where $\theta$ is the real conversion of $\mu$.}
178  \end{displaymath}%  \end{displaymath}%
179
180  \noindent{}Scalar multiplication:  \noindent{}\point Scalar multiplication:
181  \begin{displaymath}  \begin{displaymath}
182    \begin{array}{c}    \begin{array}{c}
183      \BinopTy{{*}}{\TYreal}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}} \\      \BinopTy{\OP{*}}{\TYreal}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}} \\
184      \BinopTy{{*}}{\TYfield{k}{d}{\theta}}{\TYreal}{\TYfield{k}{d}{\theta}}      \BinopTy{\OP{*}}{\TYfield{k}{d}{\theta}}{\TYreal}{\TYfield{k}{d}{\theta}}
185    \end{array}%    \end{array}%
186  \end{displaymath}%  \end{displaymath}%
187
188  \noindent{}Scalar division:  \noindent{}\point Scalar division:
189  \begin{displaymath}  \begin{displaymath}
190    \BinopTy{{/}}{\TYfield{k}{d}{\theta}}{\TYreal}{\TYfield{k}{d}{\theta}}    \BinopTy{\OP{/}}{\TYfield{k}{d}{\theta}}{\TYreal}{\TYfield{k}{d}{\theta}}
191  \end{displaymath}%  \end{displaymath}%
192
193  \noindent{}Negation:  \noindent{}\point Negation:
194  \begin{displaymath}  \begin{displaymath}
195    \UnopTy{-}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}}    \UnopTy{\OP{-}}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}}
196  \end{displaymath}%  \end{displaymath}%
197
199  \begin{displaymath}  \begin{displaymath}
200    \begin{array}{c}    \begin{array}{c}
201    \BinopTy{{\odot}}{\TYfield{k}{d}{\theta}}{\theta}{\TYfield{k}{d}{\theta}} \\    \BinopTy{{\odot}}{\TYfield{k}{d}{\theta}}{\theta}{\TYfield{k}{d}{\theta}} \\
202    \BinopTy{{\odot}}{\theta}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}} \\    \BinopTy{{\odot}}{\theta}{\TYfield{k}{d}{\theta}}{\TYfield{k}{d}{\theta}} \\
203    \BinopTy{{\odot}}{\TYfield{k_1}{d}{\theta}}{\TYfield{k_2}{d}{\theta}}{\TYfield{\min(k_1,k_2)}{d}{\theta}}    \BinopTy{{\odot}}{\TYfield{k_1}{d}{\theta}}{\TYfield{k_2}{d}{\theta}}{\TYfield{\min(k_1,k_2)}{d}{\theta}}
204    \end{array}%    \end{array}%
205    \qquad\text{for $\odot\in\SET{{+},{-}}$}    \qquad\text{for $\odot\in\SET{\OP{+},\OP{-}}$}
206  \end{displaymath}%  \end{displaymath}%
207
208  \noindent{}Differentiation:  \noindent{}\point Differentiation:
209  \begin{displaymath}  \begin{displaymath}
210    \UnopTy{\OPdiff}{\TYfield{k}{d}{\TYtensor{o}{d}}}{\TYfield{k-1}{d}{\TYtensor{o+1}{d}}}    \UnopTy{\OPdiff}{\TYfield{k}{d'}{\TYtensor{\Seq{d}}}}{\TYfield{k-1}{d'}{\TYtensor{d'\Seq{d}}}}
211    \qquad\text{for $k > 0$}    \qquad\text{for $k > 0$}
212  \end{displaymath}%  \end{displaymath}%
213
214  \noindent{}Probing:  \noindent{}\point Probing:
215  \begin{displaymath}  \begin{displaymath}
216    \BinopTy{@}{\TYfield{k}{d}{\theta}}{\TYvec{d}}{\theta}    \BinopTy{\OP{@}}{\TYfield{k}{d}{\theta}}{\TYvec{d}}{\theta}
217  \end{displaymath}%  \end{displaymath}%
218
219  \end{document}  \end{document}

Legend:
 Removed from v.21 changed lines Added in v.44