Skip to content

Commit

Permalink
Cleanup related to 'each'
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 12, 2020
1 parent b9fdb4e commit 3962fdd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 29 deletions.
10 changes: 2 additions & 8 deletions chapters/classes.tex
Expand Up @@ -928,15 +928,9 @@ \section{Balanced Models}\label{balanced-models}
The local number of unknowns of a \lstinline!model! or \lstinline!block! class is the sum based on the components:
\begin{itemize}
\item
For each declared component of specialized class \lstinline!type! (Real, Integer,
String, Boolean, enumeration and arrays of those, etc.) or \lstinline!record!, or
\lstinline!operator record! not declared as \lstinline!outer!, it is the number of unknown
variables inside it (i.e., excluding parameters and constants and
counting the elements after expanding all records, operator record,
and arrays to a set of scalars of primitive types).
For each declared component of specialized class \lstinline!type! (\lstinline!Real!, \lstinline!Integer!, \lstinline!String!, \lstinline!Boolean!, enumeration and arrays of those, etc.) or \lstinline!record!, or \lstinline!operator record! not declared as \lstinline!outer!, it is the number of unknown variables inside it (i.e., excluding parameters and constants and counting the elements after expanding all records, operator record, and arrays to a set of scalars of primitive types).
\item
Each declared component of specialized class \lstinline!type! or record declared
as \lstinline!outer! is ignored.
Each declared component of specialized class \lstinline!type! or \lstinline!record! declared as \lstinline!outer! is ignored.
\begin{nonnormative}
I.e., all variables inside the component are treated as known.
\end{nonnormative}
Expand Down
2 changes: 1 addition & 1 deletion chapters/connectors.tex
Expand Up @@ -76,7 +76,7 @@ \subsection{Connection Sets}\label{connection-sets}

\subsection{Inside and Outside Connectors}\label{inside-and-outside-connectors}

In an element instance \lstinline!M!, each connector element of \lstinline!M! is called an \firstuse(outside connector} with respect to \lstinline!M!. Any other connector elements that is hierarchically inside \lstinline!M!, but not in one of the outside connectors of \lstinline!M!, is called an \firstuse{inside connector} with respect to \lstinline!M!. This is done before resolving \lstinline!outer! elements to corresponding \lstinline!inner! ones.
In an element instance \lstinline!M!, each connector element of \lstinline!M! is called an \firstuse{outside connector} with respect to \lstinline!M!. Any other connector elements that is hierarchically inside \lstinline!M!, but not in one of the outside connectors of \lstinline!M!, is called an \firstuse{inside connector} with respect to \lstinline!M!. This is done before resolving \lstinline!outer! elements to corresponding \lstinline!inner! ones.

\begin{example}
\begin{figure}[H]
Expand Down
2 changes: 1 addition & 1 deletion chapters/inheritance.tex
Expand Up @@ -354,7 +354,7 @@ \subsection{Merging of Modifications}\label{merging-of-modifications}
it is an error if this overrides a final prefix for a component, or if
value for a simple component would override part of the value of a
non-simple component. When merging modifiers each modification keeps its
own each-prefix.
own \lstinline!each! prefix.

\begin{example}
The following larger example demonstrates several aspects:
Expand Down
29 changes: 10 additions & 19 deletions chapters/overloaded.tex
Expand Up @@ -220,9 +220,8 @@ \section{Overloaded Binary Operations}\label{overloaded-binary-operations}
class \lstinline!B!.

\begin{enumerate}
\item
If \lstinline!A! and \lstinline!B! are predefined types of such, then the
corresponding built-in operation is performed.
\item\label{overloaded-binary-predefined}
If \lstinline!A! and \lstinline!B! are predefined types of such, then the corresponding built-in operation is performed.
\item
Otherwise, if there exists \emph{exactly one} function $f$ in the
union of \lstinline!A.$\theop$! and \lstinline!B.$\theop$! such that
Expand All @@ -245,39 +244,32 @@ \section{Overloaded Binary Operations}\label{overloaded-binary-operations}
gives the unique match. If the sum of the sizes is larger than one it
is an error.
\begin{nonnormative}
Informally, this means: If there is no direct match of \lstinline!a $\theop$ b!, then it is tried to find a direct match by automatic type casts
of \lstinline!a! or \lstinline!b!, by converting either \lstinline!a! or \lstinline!b! to the needed
type using an appropriate constructor function from one of the
operator record classes used as arguments of the overloaded \lstinline!op!
functions. Example using the Complex-definition below:
Informally, this means: If there is no direct match of \lstinline!a $\theop$ b!, then it is tried to find a direct match by automatic type casts of \lstinline!a! or \lstinline!b!, by converting either \lstinline!a! or \lstinline!b! to the needed type using an appropriate constructor function from one of the operator record classes used as arguments of the overloaded \lstinline!op! functions. Example using the \lstinline!Complex!-definition below:
\begin{lstlisting}[language=modelica]
Real a;
Complex b;
Complex c = a*b; // interpreted as:
Complex c = a * b; // interpreted as:
// Complex.'*'.multiply(Complex.'constructor'.fromReal(a),b);
\end{lstlisting}
\end{nonnormative}
\item
\item\label{overloaded-binary-arrays}
Otherwise, if \lstinline!a! or \lstinline!b! is an array expression, then the expression is
conceptually evaluated according to the rules of \cref{scalar-vector-matrix-and-array-operator-functions} with the
following exceptions concerning \cref{matrix-and-vector-multiplication-of-numeric-arrays}:
\begin{enumerate}
\def\labelenumii{(\alph{enumii})}
\item
vector*vector should be left undefined.
\lstinline!$\mathit{vector}$ * $\mathit{vector}$! should be left undefined.
\begin{nonnormative}
The scalar product of \cref{tab:product} does not generalize to the expected linear and conjugate linear scalar product of complex numbers.
\end{nonnormative}
\item
vector*matrix should be left undefined.
\lstinline!$\mathit{vector}$ * $\mathit{matrix}$! should be left undefined.
\begin{nonnormative}
The corresponding definition of \cref{tab:product} does not generalize to complex numbers in the expected way.
\end{nonnormative}
\item
If the inner dimension for matrix*vector or matrix*matrix is zero,
this uses the overloaded \lstinline!'0'! operator of the result array element
type. If the operator \lstinline!'0'! is not defined for that class it is an
error if the inner dimension is zero.
If the inner dimension for \lstinline!$\mathit{matrix}$ * $\mathit{vector}$! or \lstinline!$\mathit{matrix}$ * $\mathit{matrix}$! is zero, this uses the overloaded \lstinline!'0'! operator of the result array element type. If the operator \lstinline!'0'! is not defined for that class it is an error if the inner dimension is zero.
\end{enumerate}

\begin{nonnormative}
Expand All @@ -286,12 +278,11 @@ \section{Overloaded Binary Operations}\label{overloaded-binary-operations}
multiplicative identity.
\end{nonnormative}

\item
\item\label{overloaded-binary-error}
Otherwise the expression is erroneous.
\end{enumerate}

%henrikt-ma: Insane to refer to items by hard-coded numbers.
For an element-wise operator, \lstinline!a .op b!, items 1, 4, and 5 are used; e.g.\ the operator \lstinline!.+! will always be defined in terms of \lstinline!'+'!.
For an element-wise operator, \lstinline!a .op b!, items~\ref{overloaded-binary-predefined}, \ref{overloaded-binary-arrays}, and~\ref{overloaded-binary-error} are used; e.g.\ the operator \lstinline!.+! will always be defined in terms of \lstinline!'+'!.

Restrictions:
\begin{itemize}
Expand Down

0 comments on commit 3962fdd

Please sign in to comment.