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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 2636 - (download) (as text) (annotate)
Tue May 27 16:18:36 2014 UTC (7 years, 8 months ago) by jhr
File size: 2733 byte(s)
  Merging changes from vis12 branch (via staging).  The main change is the new
  syntax for inputs (especially image inputs).
%!TEX root = report.tex

The grammar of Diderot types is as follows:

\section{Value types}
Diderot supports four types of concrete values: booleans, integers, strings, and tensors.
The grammar of these types is

The tensor type \mbox{\kw{tensor}\kw{[}$d_1,\ldots{},d_n$\kw{]}} is the of type order-$n$ tensors
with shape $d_1,\ldots{},d_n$.
Tensors include scalars (order-0) and vectors (order-1).
Because these types are frequently used, Diderot supports the following predefined type definitions:
    \kw{real} & \texttt{\kw{tensor}\kw{[}\kw{]}} \\
    \kw{vec2} & \texttt{\kw{tensor}\kw{[}2\kw{]}} \\
    \kw{vec3} & \texttt{\kw{tensor}\kw{[}3\kw{]}} \\
    \kw{vec4} & \texttt{\kw{tensor}\kw{[}4\kw{]}}

Images are rectangular arrays of tensor data that are used to represent the data sets
that Diderot programs are analysing, as well as other data.
The syntax of an image type is
  \kw{image}\kw{(} $n$ \kw{)} \kw{[} $d_1,\ldots{},d_n$ \kw{]}
where $n$ is the dimension of the field (typically 2 or 3) and $d_1,\ldots{},d_n$ is the
shape of the tensor data (\ie{}, the elements of the image are tensors
of type \kw{tensor[}$d_1,\ldots{},d_n$\kw{]}).

Fields are functions from some $n$-dimensional vector space to some tensor type.
The syntax of a field type is
  \kw{field}\kw{\#} $k$ \kw{(} $n$ \kw{)} \kw{[} $d_1,\ldots{},d_n$ \kw{]}
where $k \geq 0$ is the number of levels of differentiation supported by the field,
$n$ is the dimension of the field (typically 2 or 3), and $d_1,\ldots{},d_n$ is the shape of the field.
Probing the field will produce a tensor of type \kw{tensor[}$d_1,\ldots{},d_n$\kw{]}.

Kernels are abstract types that represent the \emph{convolution kernels} used
to reconstruct continuous fields from image data.
The syntax of a kernel type is \mbox{\kw{kernel}\kw{\#}$k$}, where
$k \geq 0$ gives the number of levels of differentiation supported by the

\section{Type promotion}
Diderot's type system supports three kinds of \emph{implicit} type coercions that are
added by the type checker when necessary:
    Integer-typed expressions will be implicitly promoted to real-typed expressions.
    Static sequences will be implicitly promoted to dynamic sequences.
    A field-typed expression with continuity $k$ will be implicitly converted to a
    field with lower continuity.

ViewVC Help
Powered by ViewVC 1.0.0