Macro processor slides: minor improvements

master
Sébastien Villemot 2022-05-24 12:20:00 +02:00
parent edf75e48a3
commit d2ef844696
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 20 additions and 25 deletions

View File

@ -16,7 +16,7 @@
\institute[CEPREMAP]{\includegraphics[scale=0.15]{../logos/cepremap.jpg}} \institute[CEPREMAP]{\includegraphics[scale=0.15]{../logos/cepremap.jpg}}
\date{11 April 2022} \date{3 June 2022}
\setbeamertemplate{title page} \setbeamertemplate{title page}
@ -132,7 +132,7 @@
\item conditional statements: \verb+@#if/@#ifdef/@#ifndef/@#else/@#elseif/@#endif+ \item conditional statements: \verb+@#if/@#ifdef/@#ifndef/@#else/@#elseif/@#endif+
\item loop statements: \verb+@#for/@#endfor+ \item loop statements: \verb+@#for/@#endfor+
\end{itemize} \end{itemize}
\item Most directives fit on one line. If needed however, two backslashes (i.e. \verb+\\+) at the end of a line indicate that the directive is continued on the next line. \item Most directives fit on one line. If needed however, two backslashes (\textit{i.e.} \verb+\\+) at the end of a line indicate that the directive is continued on the next line.
\item Directives are not terminated with a semicolon \item Directives are not terminated with a semicolon
\end{itemize} \end{itemize}
\end{frame} \end{frame}
@ -142,9 +142,9 @@
\begin{itemize} \begin{itemize}
\item The macro processor can handle values of 5 different types: \item The macro processor can handle values of 5 different types:
\begin{enumerate} \begin{enumerate}
\item boolean \item boolean (logical value, true or false)
\item real \item real (double precision floating point number)
\item string \item string (of characters)
\item tuple \item tuple
\item array \item array
\end{enumerate} \end{enumerate}
@ -163,7 +163,7 @@
\begin{frame}[fragile=singleslide] \begin{frame}[fragile=singleslide]
\frametitle{Macro-expressions (1/8)} \frametitle{Macro-expressions (1/8)}
\begin{itemize} \begin{itemize}
\item Macro-expressions are constructed using literals (i.e.\ fixed values) of the 5 basic types \item Macro-expressions are constructed using literals (\textit{i.e.} fixed values) of the 5 basic types
described above, macro-variables, standard operators, function calls and comprehensions. described above, macro-variables, standard operators, function calls and comprehensions.
\item Macro-expressions can be used in two places: \item Macro-expressions can be used in two places:
\begin{itemize} \begin{itemize}
@ -180,7 +180,12 @@
\begin{block}{Operators on booleans} \begin{block}{Operators on booleans}
\begin{itemize} \begin{itemize}
\item comparison operators: \texttt{== !=} \item comparison operators: \texttt{== !=}
\item logical operators: \texttt{\&\& || !} \item logical operators:
\begin{itemize}
\item conjunction (“and”): \texttt{\&\&}
\item disjunction (“or”): \texttt{||}
\item negation (“not”): \texttt{!}
\end{itemize}
\end{itemize} \end{itemize}
\end{block} \end{block}
\end{frame} \end{frame}
@ -194,7 +199,7 @@
\item logical operators: \verb+&& || !+ \item logical operators: \verb+&& || !+
\item range with unit increment: \texttt{1:4} is equivalent to \item range with unit increment: \texttt{1:4} is equivalent to
real array \texttt{[1, 2, 3, 4]}. (NB: \texttt{[1:4]} is equivalent to an real array \texttt{[1, 2, 3, 4]}. (NB: \texttt{[1:4]} is equivalent to an
array containing an array of reals, i.e. \texttt{[[1, 2, 3, 4]]}) array containing an array of reals, \textit{i.e.} \texttt{[[1, 2, 3, 4]]})
\item range with user-defined increment: \texttt{4:-1.1:-1} is equivalent to real array \texttt{[4, 2.9, 1.8, 0.7, -0.4]}. \item range with user-defined increment: \texttt{4:-1.1:-1} is equivalent to real array \texttt{[4, 2.9, 1.8, 0.7, -0.4]}.
\end{itemize} \end{itemize}
\end{block} \end{block}
@ -202,9 +207,9 @@
\begin{block}{Functions for reals} \begin{block}{Functions for reals}
\begin{itemize} \begin{itemize}
\item \texttt{min}, \texttt{max}, \texttt{exp}, \texttt{ln} (or \texttt{log}), \texttt{log10} \item \texttt{min}, \texttt{max}, \texttt{exp}, \texttt{ln} (or \texttt{log}), \texttt{log10}
\item \texttt{sign}, \texttt{floor}, \texttt{ceil}, \texttt{trunc}, \texttt{round}, \texttt{mod}
\item \texttt{sin}, \texttt{cos}, \texttt{tan}, \texttt{asin}, \texttt{acos}, \texttt{atan} \item \texttt{sin}, \texttt{cos}, \texttt{tan}, \texttt{asin}, \texttt{acos}, \texttt{atan}
\item \texttt{sqrt}, \texttt{cbrt}, \texttt{sign}, \texttt{floor}, \texttt{ceil}, \texttt{trunc}, \texttt{mod} \item \texttt{sqrt}, \texttt{cbrt}, \texttt{erf}, \texttt{erfc}, \texttt{normpdf}, \texttt{normcdf}, \texttt{gamma}, \texttt{lgamma}
\item \texttt{erf}, \texttt{erfc}, \texttt{normpdf}, \texttt{normcdf}, \texttt{gamma}, \texttt{lgamma}, \texttt{round}
\end{itemize} \end{itemize}
\end{block} \end{block}
\end{frame} \end{frame}
@ -230,7 +235,7 @@
\begin{block}{Operators on tuples} \begin{block}{Operators on tuples}
\begin{itemize} \begin{itemize}
\item comparison operators: \texttt{== !=} \item comparison operators: \texttt{== !=}
\item functions: \texttt{length}, \texttt{isempty} \item functions: \texttt{length()}, \texttt{isempty()}
\item testing membership in tuple: \texttt{in} operator \\ (example: \item testing membership in tuple: \texttt{in} operator \\ (example:
\texttt{"b" in ("a", "b", "c")} returns \texttt{true}) \texttt{"b" in ("a", "b", "c")} returns \texttt{true})
\end{itemize} \end{itemize}
@ -246,7 +251,7 @@
\item comparison operators: \texttt{== !=} \item comparison operators: \texttt{== !=}
\item dereferencing: if \texttt{v} is an array, then \texttt{v[2]} is its $2^{\textrm{nd}}$ element \item dereferencing: if \texttt{v} is an array, then \texttt{v[2]} is its $2^{\textrm{nd}}$ element
\item concatenation: \texttt{+} \item concatenation: \texttt{+}
\item functions: \texttt{sum}, \texttt{length}, \texttt{isempty} \item functions: \texttt{sum()}, \texttt{length()}, \texttt{isempty()}
\item extraction of sub-arrays: \textit{e.g.} \texttt{v[4:6]} \item extraction of sub-arrays: \textit{e.g.} \texttt{v[4:6]}
\item testing membership of an array: \texttt{in} operator \\ (example: \item testing membership of an array: \texttt{in} operator \\ (example:
\texttt{"b" in ["a", "b", "c"]} returns \texttt{true}) \texttt{"b" in ["a", "b", "c"]} returns \texttt{true})
@ -271,6 +276,8 @@
For example: if \texttt{A} and \texttt{B} are arrays, then the following For example: if \texttt{A} and \texttt{B} are arrays, then the following
set operations are valid: \texttt{A|B}, \texttt{A\&B}, \texttt{A-B}, set operations are valid: \texttt{A|B}, \texttt{A\&B}, \texttt{A-B},
\texttt{A*B}, \texttt{A\^{}3}. \texttt{A*B}, \texttt{A\^{}3}.
NB: the array resulting from Cartesian product or power has tuples as its elements.
\end{frame} \end{frame}
\begin{frame}[fragile=singleslide] \begin{frame}[fragile=singleslide]
@ -841,7 +848,7 @@ end
\begin{itemize} \begin{itemize}
\item The loop is not unrolled \item The loop is not unrolled
\item MATLAB/Octave manages the iterations \item MATLAB/Octave manages the iterations
\item NB: always check whether the error flag `info(1)==0` to prevent erroneously relying on stale results from previous iterations \item NB: always check whether the error flag \texttt{info(1)==0} to prevent erroneously relying on stale results from previous iterations
\end{itemize} \end{itemize}
\end{frame} \end{frame}
@ -885,18 +892,6 @@ rhos = [ 0.8, 0.9, 1];
\end{itemize} \end{itemize}
\end{frame} \end{frame}
% \begin{frame}[fragile=singleslide]
% \frametitle{Possible future developments}
% \begin{itemize}
% \item Find a nicer syntax for indexed sums/products
% \item Implement other control structures: \texttt{elsif}, \texttt{switch/case}, \texttt{while/until} loops
% \item Implement macro-functions (or templates), with a syntax like:
% \small
% \verb+@#define QUADRATIC_COST(x, x_ss, phi) = phi/2*(x/x_ss-1)^2+
% \normalsize
% \end{itemize}
% \end{frame}
\begin{frame} \begin{frame}
\begin{center} \begin{center}
\vfill {\LARGE Thanks for your attention!} \vfill \vfill {\LARGE Thanks for your attention!} \vfill