next up previous
Next: How to Run the Up: MP3 CS603 Organization of Previous: Purpose

Problem Description

Do Exercises 1, 5, and 7 on pages 88-89 of the textbook. Use the function names exactly as given below. Items numbered 2-5 are for problem 5 and item 6 is for problem 7.
  1. (count x M ) which counts the number of occurrences of scalar x in matrix M.

  2. (id n) $\begin{array}{cccc}
1 & 0 & \cdots & 0 \\
0 & 1 & \cdots & 0 \\
\vdots & & \ddots & \vdots \\
0 & 0 & \cdots & 1
\end{array}$

  3. (revId n) $\begin{array}{cccc}
0 & \cdots & 0 & 1 \\
0 & \cdots & 1 & 0 \\
\vdots & & \ddots & \vdots \\
1 & 0 & \cdots & 0
\end{array}$

  4. (upper n) $\begin{array}{cccc}
1 & 1 & \cdots & 1 \\
0 & 1 & \cdots & 1 \\
\vdots & & \ddots & \vdots \\
0 & 0 & \cdots & 1
\end{array}$

  5. (lowerIdx n) $\begin{array}{ccccc}
1 & 0 & 0 & \cdots & 0 \\
1 & 2 & 0 & \cdots & 0 \\
\vdots & & & \ddots & \vdots \\
1 & 2 & 3 & \cdots & n
\end{array}$

  6. (lowerDiag n) $\begin{array}{ccccc}
1 & 0 & 0 & \cdots & 0 \\
2 & 1 & 0 & \cdots & 0 \\
\vdots & & & \ddots & \vdots \\
n & n - 1 & n - 2 & \cdots & 1
\end{array}$

  7. (+\ $v$) using only value-op's (no control operations, i.e. if, while, etc.) for vectors only


2002-02-21