Skip to content

Commit

Permalink
Merge pull request #3403 from HansOlsson/Fix11
Browse files Browse the repository at this point in the history
Fix11
  • Loading branch information
HansOlsson committed Aug 31, 2023
2 parents 7015202 + 28cb60e commit 07bdf70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 6 additions & 4 deletions chapters/arrays.tex
Original file line number Diff line number Diff line change
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
\end{lstlisting}
Note that \lstinline!fill(0.0, m, n)! will be an empty matrix if \lstinline!m! or \lstinline!n! is zero.

\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}
2 changes: 1 addition & 1 deletion chapters/connectors.tex
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ \section{Generation of Connection Equations}\label{generation-of-connection-equa
\begin{lstlisting}[language=modelica]
connect(a, b);
\end{lstlisting}
the primitive components of \lstinline!a! and \lstinline!b! form a connection set, together with an indication of whether they are from an inside or an outside connector.
a connection set is generated for each pair of corresponding primitive components of \lstinline!a! and \lstinline!b! together with an indication of whether they are from an inside or an outside connector.
\begin{definition}[Primitive elements]\label{primitive-elements}\index{primitive element}\index{element!primitive}
The primitive elements are of simple types or of types defined as \lstinline!operator record! (i.e., a component of an \lstinline!operator record! type is not split into sub-components).
\end{definition}
Expand Down
10 changes: 4 additions & 6 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -875,17 +875,15 @@ \subsection{Automatic Vectorization}\label{scalar-functions-applied-to-array-arg
= [sin(1), sin(2); sin(3), sin(4)]
\end{lstlisting}
\begin{lstlisting}[language=modelica]
function Add
function add
input Real e1, e2;
output Real sum1;
algorithm
sum1 := e1 + e2;
end Add;
end add;
\end{lstlisting}
\lstinline!Add(1, [1,2,3])! adds one to each of the elements of the second
argument giving the result \lstinline![2,3,4]!. However, it is illegal to
write \lstinline!1 + [1,2,3]!, because the rules for the built-in
operators are more restrictive.
\lstinline!add(1, [1,2,3])! adds one to each of the elements of the second argument giving the result \lstinline![2,3,4]!.
For built-in operators one can do this with \lstinline!1 .+ [1,2,3]! but not with \lstinline!1 + [1,2,3]!, because the rules for the built-in operators are more restrictive.
\end{example}

\subsection{Empty Function Calls}\label{empty-function-calls}
Expand Down

0 comments on commit 07bdf70

Please sign in to comment.