From 32f8c4f9b24b91d068c2876be1c0ac85dd9cb665 Mon Sep 17 00:00:00 2001 From: Henrik Tidefelt Date: Tue, 16 Jun 2020 23:10:10 +0200 Subject: [PATCH] Fix misc styling of array reductions --- chapters/arrays.tex | 83 +++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/chapters/arrays.tex b/chapters/arrays.tex index aa03060b1..0dc0dec82 100644 --- a/chapters/arrays.tex +++ b/chapters/arrays.tex @@ -350,87 +350,82 @@ \subsection{Reduction Functions and Operators}\doublelabel{reduction-functions-a \lstinline!min(A)! & Returns the least element of array expression \lstinline!A!; as defined by \lstinline!!.\\ \hline -\lstinline!max(x,y)! +\lstinline!max(x, y)! & Returns the greatest element of the scalars \lstinline!x! and \lstinline!y!; as defined by \lstinline!>!.\\ \hline \begin{tabular}{@{}p{4cm}@{}} -\lstinline!max(e(i, ..., j)!\\ -\lstinline! for i in u,!\\ -\lstinline! ..., j in v)! +\lstinline[mathescape=true]!max(e(i, $\ldots$, j)!\\ +\lstinline[mathescape=true]! for i in u, $\ldots$,!\\ +\lstinline[mathescape=true]! j in v)! \end{tabular} & \begin{tabular}{@{}p{10cm}@{}} -Also described in \autoref{reduction-expressions} -Returns the greatest value (as defined by \lstinline!>!) of the scalar -expression \lstinline!e(i, ..., j)! evaluated for all combinations of \lstinline!i! in \lstinline!u!, \ldots, \lstinline!j! -in \lstinline!v!: +Also described in \autoref{reduction-expressions}. Returns the greatest value (as defined by \lstinline!>!) of the scalar expression +\lstinline[mathescape=true]!e(i, $\ldots$, j)! evaluated for all combinations of \lstinline!i! in \lstinline!u!, \ldots, \lstinline!j! in \lstinline!v!. \end{tabular}\\ \hline \lstinline!sum(A)! & \begin{tabular}{@{}p{10cm}@{}} -Returns the scalar sum of all the elements of array expression:\\ -\lstinline!=sum(A[j,k,...]) for j,k,...! +Returns the scalar sum of all the elements of array expression \lstinline!A!:\\ +\lstinline[mathescape=true]!= sum(A[j, k, $\ldots$] for j, k, $\ldots$)! \end{tabular}\\ \hline \begin{tabular}{@{}p{5cm}@{}} -\lstinline!sum(e(i, ..., j)!\\ -\lstinline! for i in u,!\\ -\lstinline! ..., j in v)! +\lstinline[mathescape=true]!sum(e(i, $\ldots$, j)!\\ +\lstinline[mathescape=true]! for i in u, $\ldots$,!\\ +\lstinline[mathescape=true]! j in v)! \end{tabular} & \begin{tabular}{@{}p{10cm}@{}} -Also described in \autoref{reduction-expressions}\\ -Returns the sum of the expression e(i, ..., j) evaluated for all -combinations of i in u, ..., j in v: For \lstinline!Integer! indexing this is - e(u{[}1{]},... - ,v{[}1{]})+e(u{[}2{]},... ,v{[}1{]})+... +e(u{[}end{]},... - ,v{[}1{]})+...+e(u{[}end{]},... ,v{[}end{]}) - For non-\lstinline!Integer! indexing this uses all valid indices instead of 1..\lstinline!end!. - The type of sum(e(i, ..., j) for i in u, ..., j - in v) is the same as the type of e(i,...j). +Also described in \autoref{reduction-expressions}. Returns the sum of the expression \lstinline[mathescape=true]!e(i, $\ldots$, j)! evaluated for all +combinations of \lstinline[mathescape=true]!i in u!, $\ldots$, \lstinline[mathescape=true]!j in v!: For \lstinline!Integer! indexing this is +\begin{lstlisting}[language=modelica,mathescape=true] +e(u[1], $\ldots$, v[1]) + e(u[2], $\ldots$, v[1]) + $\ldots$ + + e(u[end], $\ldots$, v[1]) + $\ldots$ + + e(u[end], $\ldots$, v[end]) +\end{lstlisting} +For non-\lstinline!Integer! indexing this uses all valid indices instead of 1..\lstinline!end!. +The type of \lstinline[mathescape=true]!sum(e(i, $\ldots$, j) for i in u, $\ldots$, j in v)! is the same as the type of \lstinline[mathescape=true]!e(i, $\ldots$, j)!. \end{tabular}\\ \hline \lstinline!product(A)! & \begin{tabular}{@{}p{10cm}@{}} -Returns the scalar product of all the elements of array expression A.\\ - \lstinline!=product(A[j,k,...] for j,k,...! +Returns the scalar product of all the elements of array expression \lstinline!A!:\\ +\lstinline[mathescape=true]!= product(A[j, k, $\ldots$] for j, k, $\ldots$)! \end{tabular}\\ \hline \begin{tabular}{@{}p{4cm}@{}} -\lstinline!product(e(i, ..., j)!\\ -\lstinline! for i in u,!\\ -\lstinline! ..., j in v)! +\lstinline[mathescape=true]!product(e(i, $\ldots$, j)!\\ +\lstinline[mathescape=true]! for i in u, $\ldots$,!\\ +\lstinline[mathescape=true]! j in v)! \end{tabular} & \begin{tabular}{@{}p{10cm}@{}} -Also described in \autoref{reduction-expressions}.\\ -Returns the product of the scalar expression e(i, ..., j) evaluated for -all combinations of i in u, ..., j in v: For \lstinline!Integer! indexing this is -\begin{lstlisting}[language=modelica] - e(u[1],...,v[1])*e(u[2],...,v[1])*... - *(u[end],...,v[1])*...*e(u[end],...,v[end]) +Also described in \autoref{reduction-expressions}. Returns the product of the scalar expression \lstinline[mathescape=true]!e(i, $\ldots$, j)! evaluated for +all combinations of \lstinline!i in u!, \ldots, \lstinline!j in v!: For \lstinline!Integer! indexing this is +\begin{lstlisting}[language=modelica,mathescape=true] +e(u[1], $\ldots$, v[1]) * e(u[2], $\ldots$, v[1]) * $\ldots$ + * e(u[end], $\ldots$, v[1]) * $\ldots$ + * e(u[end], $\ldots$, v[end]) \end{lstlisting} - For non-\lstinline!Integer! indexing this uses all valid indices instead of 1..\lstinline!end!. - The type of product(e(i, ..., j) for i in u, ..., j - in v) is the same as the type of e(i,...j). +For non-\lstinline!Integer! indexing this uses all valid indices instead of 1..\lstinline!end!. +The type of \lstinline[mathescape=true]!product(e(i, $\ldots$, j) for i in u, $\ldots$, j in v)! is the same as the type of \lstinline[mathescape=true]!e(i, $\ldots$, j)!. \end{tabular} \\ \hline \end{longtable}