-
Notifications
You must be signed in to change notification settings - Fork 52
/
notation_index.tex
44 lines (40 loc) · 1.94 KB
/
notation_index.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
\lab{Index of Pseudocode Notation}{Index of Notation}
\label{notation_index}
\section*{Objects}
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{l l}
$A$ & A capitol letter typically denotes a matrix, or 2-D NumPy array\\
$[[a, b], [c, d]]$ & The explicit array $\left(\begin{array}{cc}
a & b\\
c & d\\\end{array}\right)$\\
$A \gets \allocate{m}{n}$,
$\v \gets \allocate{k}$ & Allocate memory for an $m \times n$ NumPy array $A$
or for a vector $\v$ of length $k$\\
$\Id{n}$ & The $n\times n$ array with 1's on the diagonal and 0's elsewhere \\
$a$ & A lowercase letter typically denotes a scalar\\
$A[:, j], \v[i]$ & Slice the 2-D array $A$ or 1-D array $\v$ as in Python\\
$\v$ & A boldface letter typically denotes a vector, or 1-D NumPy array\\
$\zeros{m}{n}$,
$\zeros{k}$ & The $m\times n$ array or length-$k$ vector of zeros
\end{tabular}
\section*{Operations}
\begin{tabular}{l l}
$\makecopy{A}$ & Make a copy of the array $A$\\
$A/a$, $\v/a$, $b/a$ & Divide by the scalar $a$\\
$AB$, $aB$ & Multiply scalars or matrices\\
$\norm{\v}, \norm{\v}_2$ & Find the (Euclidean) norm of $\v$\\
$\shape{A}$ & Return the dimensions of the array $A$\\
$\sign(a)$ & Return the sign of the scalar $a$\\
$\size{A}$ & Return the number of elements in the array $A$\\
$A\trp$ & Transpose the array $A$
\end{tabular}
\section*{Programming constructs}
\begin{tabular}{p{5.5cm} p{8cm}}
$\vartriangleright$ & Comment\\
${\bf for}\; i=1 \ldots n\; {\bf do}$ & ``For'' loop. Iterate from 1 to $n$.\\
$\gets$ & Assignment operator. If $a \gets b$ then $a$ is assigned the value of $b$.\\
$\bf{if} \;\ldots\; \bf{else}$ & ``If'' construction with optional ``else''\\
$\bf{Procedure}<${\sc Name}$>$(Parameters) & Defines the start of the algorithm called $<${\sc Name}$>$ which accepts the specified parameters as inputs\\
$\bf{while}$ & ``While'' construction\\
$\bf{return}$ & End of algorithm. Return any values specified.
\end{tabular}