%% This documentation was generated with Faust version 0.9.58
%% Thu Jun 13 10:45:16 2013
%% http://faust.grame.fr

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[usenames]{color}
\usepackage{listings}
\usepackage{supertabular}
\usepackage{amsmath}
\usepackage{latexsym, amssymb}
\usepackage{breqn}

% No indent
\setlength{\parindent}{0pt}

% Make LaTeX output a dot when typing an asterisk
\DeclareMathSymbol{*}{\mathbin}{symbols}{"01}

% lstlistings setup
\definecolor{yobg}{rgb}{0.9,0.9,1}
\definecolor{yotxt}{rgb}{0.01,0.01,0.52} % a dark blue.
\definecolor{mylstbg}{rgb}{0.98,0.98,0.98} % a really pale grey.
\definecolor{mylstcmt}{rgb}{0.01,0.52,0.01} % a dark green.
\definecolor{mylstdoc}{rgb}{0.80,0.30,0.80} % a medium pink.

\lstset{%
  language=C++, 
  numbers=left,%none,
  tabsize=4, 
  frame=single, 
  breaklines=true, 
  numberstyle=\tiny\ttfamily, 
  backgroundcolor=\color{mylstbg}, 
  basicstyle=\scriptsize\ttfamily, 
  commentstyle=\slshape\color{mylstcmt}, %\itshape,
  frameround=tttt, 
  columns=flexible, %fixed, 
  showstringspaces=false,
  emptylines=2,
  inputencoding=utf8,
  extendedchars=true,
  literate=	{á}{{\'a}}1 
			{à}{{\`a}}1 
			{ä}{{\"a}}1 
			{â}{{\^a}}1
			{é}{{\'e}}1 
			{è}{{\`e}}1 
			{ë}{{\"e}}1 
			{ê}{{\^e}}1
			{ï}{{\"i}}1 
			{î}{{\^i}}1
			{ö}{{\"o}}1 
			{ô}{{\^o}}1
			{è}{{\`e}}1 
			{ù}{{\`u}}1 
			{û}{{\^u}}1
			{ç}{{\c{c}}}1 
			{Ç}{{\c{C}}}1,
  emph={component, declare, environment, import, library, process},
  emph={[2]ffunction, fconstant, fvariable},
  emph={[3]button, checkbox, vslider, hslider, nentry, vgroup, hgroup, tgroup, vbargraph, hbargraph, attach},
  emphstyle=\color{yotxt}, %\underline, %\bfseries,
  morecomment=[s][\color{mylstdoc}]{<mdoc>}{</mdoc>},
  rulecolor=\color{black}
}

\newcommand{\faustfilename}{/home/wang/Documents/OcamlProjects/interpreter/interpreter11/dsp_files/make_init.dsp}
\newcommand{\faustdocdir}{make_init-mdoc}
\newcommand{\faustprogname}{make_init}
\newcommand{\faustversion}{0.9.58}
\newcommand{\faustdocdate}{June 13, 2013}

\begin{document}
\title{make_init}
\date{\today}
\maketitle

\bigskip
This document provides a mathematical description of the Faust program text stored in the \texttt{\faustfilename} file. See the notice in Section\,\ref{notice} (page\,\pageref{notice}) for details.


\section{Mathematical definition of \texttt{process}}
\label{equation}

The \emph{\faustprogname} program evaluates the signal transformer denoted by \texttt{process}, which is mathematically defined as follows:

% Set of Faust formulas (corresponding to an <equation> tag).
\begin{enumerate}

\item Output signal $y$ such that
	\begin{dgroup*}
		\begin{dmath*}
				y(t) = r_{1}(t)
		\end{dmath*}
	\end{dgroup*}

\item Input signal (none)

\item Intermediate signals  $r_i$ for $i \in [1,2]$,  $q_1$ and  $m_1$ such that
	\begin{dgroup*}
		\begin{dmath*}
				r_{2}(t) = 1
		\end{dmath*}
		\begin{dmath*}
				r_{1}(t) = 2.000001 + q_{1}(t)
		\end{dmath*}
	\end{dgroup*}

\begin{displaymath}
q_{1}(t) = 
\left\{\begin{array}{ll}
2 & \mbox{if \,} \mathrm{int}\left(m_{1}(t)\right) = 0\\
r_{1}(t\!-\!1) & \mbox{if \,} \mathrm{int}\left(m_{1}(t)\right) = 1
\end{array}\right.
\end{displaymath}

\begin{displaymath}
m_{1}(t) = 
\left\{\begin{array}{ll}
0 & \mbox{, when \,} t = 0\\
r_{2}(t\!-\!1) & \mbox{, when \,} t > 0
\end{array}\right.
\end{displaymath}

\end{enumerate}


\section{Block diagram of \texttt{process}}
\label{diagram}

The block diagram of \texttt{process} is shown on Figure\,\ref{figure1} (page\,\pageref{figure1}).
\begin{figure}[ht!]
	\centering
	\includegraphics[width=\textwidth]{../svg/svg-01/process}
	\caption{Block diagram of \texttt{process}}
	\label{figure1}
\end{figure}


\section{Notice}
\label{notice}


\begin{itemize}
	\item This document was generated using Faust version \faustversion\ on \faustdocdate.
	\item The value of a Faust program is the result of applying the signal transformer denoted by the expression to which the \texttt{process} identifier is bound to input signals, running at the $f_S$ sampling frequency.
	\item Faust (\emph{Functional Audio Stream}) is a functional programming language designed for synchronous real-time signal processing and synthesis applications. A Faust program is a set of bindings of identifiers to expressions that denote signal transformers. A signal $s$ in $S$ is a function mapping\footnote{Faust assumes that $\forall \, s \in S, \forall \, t \in \mathbb{Z}, s(t) = 0 \mathrm{\ when\ } t < 0$.} times $t \in \mathbb{Z}$ to values $s(t) \in \mathbb{R}$, while a signal transformer is a function from $S^n$ to $S^m$, where $n,m\in \mathbb{N}$. See the Faust manual for additional information (\textsf{http://faust.grame.fr}).
	\item Every mathematical formula derived from a Faust expression is assumed, in this document, to having been normalized (in an implementation-depen\-dent manner) by the Faust compiler.
	\item A block diagram is a graphical representation of the Faust binding of an identifier I to an expression E; each graph is put in a box labeled by I. Subexpressions of E are recursively displayed as long as the whole picture fits in one page.
	\item $\forall \, x \in \mathbb{R}$, 
	\begin{displaymath}
		\mathrm{int}(x) =
		\left\{\begin{array}{cl}
			\lfloor x \rfloor & \mbox{if \,} x > 0 \\
			\lceil x \rceil & \mbox{if \,} x < 0 \\
			0 & \mbox{if \,} x = 0 \\
		\end{array}\right..
	\end{displaymath}
	\item The \texttt{\faustdocdir/} directory may also include the following subdirectories:
\begin{itemize}
	\item	\texttt{cpp/} for Faust compiled code; 
	\item	\texttt{pdf/} which contains this document; 
	\item	\texttt{src/} for all Faust sources used (even libraries); 
	\item	\texttt{svg/} for block diagrams, encoded using the Scalable Vector Graphics format (\textsf{http://www.w3.org/Graphics/SVG/});
	\item	\texttt{tex/} for the \LaTeX\ source of this document.
\end{itemize}
\end{itemize}


\section{Faust code listing}
\label{listing}

This section provides the listing of the Faust code used to generate this document.

\bigskip\bigskip
\begin{lstlisting}[caption=\texttt{make_init.dsp}]
rec(a, b, i) = a ~ (i : b);

vect0 = case {
	((y, z)) => vect0(y) : vect0(z);
	(y) => _ , y : +;
};

init_value = case {
	((x,y)) => init_value(x) : vect0(y);
	(0) => 0;
	(x) => 0 : vect0(x);
};

make_init(x) = (0, 1 : prefix), init_value(x), _ : select2;

A = +;
B = _;
//B = serialize : _, 2 : vectorize;
I = make_init((2));

//process = _,_ : > ;

//process = (0.000001, 2 : +) : rec(A,B,I);

process = 0.0000010000000000,2:+:+~((0,1:prefix),(0:_,2:+),_:select2:_);
\end{lstlisting}


\end{document}

