Skip to content

Commit

Permalink
Note about special case, and use proper syntax for example.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Aug 10, 2023
1 parent f68994b commit 721fe8c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions chapters/arrays.tex
Expand Up @@ -1447,14 +1447,16 @@ \section{Empty Arrays}\label{empty-arrays}
\begin{lstlisting}[language=modelica]
Real[0, m] * Real[m, n] = Real[0, n] // empty matrix
Real[m, n] * Real[n, 0] = Real[m, 0] // empty matrix
Real[m, 0] * Real[0, n] = fill(0.0, m, n) // non-empty matrix of zeros
Real[m, 0] * Real[0, n] = fill(0.0, m, n) // matrix of zeros
// Note fill(0.0, m, n) will be an empty matrix if m or n is 0
\end{lstlisting}

\begin{example}
\begin{lstlisting}[language=modelica]
Real u[p], x[n], y[q], A[n, n], B[n, p], C[q, n], D[q, p];
der(x) = A * x + B * u
y = C * x + D * u
Real u[p], x[n], y[q], A[n, n], B[n, p], C[q, n], D[q, p];
equation
der(x) = A * x + B * u
y = C * x + D * u
\end{lstlisting}
Assume $\text{\lstinline!n!} = 0$, $\text{\lstinline!p!} > 0$, $\text{\lstinline!q!} > 0$: Results in \lstinline!y = D * u!.
\end{example}

0 comments on commit 721fe8c

Please sign in to comment.