You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: L0_setup.html
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -413,7 +413,7 @@ <h2><span class="section-number">1.7. </span>Running your work<a class="headerli
413
413
<p>To use IPython, type <cite>ipython</cite> in the Terminal (when the venv is
414
414
activated). You may need to install it first using <cite>python -m pip install
415
415
ipython</cite> (you must start the venv first). Then you can import
416
-
<codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils</span></code> interactively using <cite>from cla_utils import *</cite>. To exit
416
+
<aclass="reference internal" href="cla_utils.html#module-cla_utils" title="cla_utils"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils</span></code></a> interactively using <cite>from cla_utils import *</cite>. To exit
417
417
IPython type Ctrl-D.</p>
418
418
<divclass="proof proof-type-task" id="id10">
419
419
@@ -423,7 +423,7 @@ <h2><span class="section-number">1.7. </span>Running your work<a class="headerli
423
423
</div><divclass="proof-content">
424
424
<p>Briefly read this <aclass="reference external" href="https://object-oriented-python.github.io/2_programs_in_files.html#ipython">Information about IPython</a>.</p>
425
425
</div></div><p>If you also import <cite>numpy</cite> then you can create
426
-
example <cite>numpy</cite> arrays and pass them to <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils</span></code> functions to try
426
+
example <cite>numpy</cite> arrays and pass them to <aclass="reference internal" href="cla_utils.html#module-cla_utils" title="cla_utils"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils</span></code></a> functions to try
427
427
them out. You can also do this in a script, e.g.:</p>
@@ -491,8 +491,7 @@ <h2><span class="section-number">1.9. </span>Coding style and commenting<a class
491
491
editor modes which can help you with this. The skeleton implementation
492
492
follows PEP8 quite closely. You are encouraged, especially if you are
493
493
a more experienced programmer, to follow PEP8 in your
494
-
implementation. However nobody is going to lose marks for PEP8
495
-
failures.</p>
494
+
implementation. Full code marks will require PEP8 compliance.</p>
496
495
</section>
497
496
<sectionid="skeleton-code-documentation">
498
497
<h2><spanclass="section-number">1.10. </span>Skeleton code documentation<aclass="headerlink" href="#skeleton-code-documentation" title="Permalink to this heading">¶</a></h2>
Copy file name to clipboardExpand all lines: L1_preliminaries.html
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -193,15 +193,15 @@ <h3><span class="section-number">2.1.1. </span>Your first programming exercises<
193
193
available when you import <aclass="reference external" href="https://numpy.org/doc/stable/reference/index.html#module-numpy" title="(in NumPy v1.26)"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">numpy</span></code></a> itself. There is one exception,
194
194
which is that <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">numpy.linalg.norm()</span></code> is quite useful, but also covers a lot
195
195
of different cases which are not very edifying to replicate. Hence,
196
-
we have included <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">numpy.linalg.norm()</span></code> in the <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils</span></code> package as
196
+
we have included <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">numpy.linalg.norm()</span></code> in the <aclass="reference internal" href="cla_utils.html#module-cla_utils" title="cla_utils"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils</span></code></a> package as
197
197
<codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">cla_utils.norm()</span></code>, should you wish to use it.</p>
198
198
<divclass="proof proof-type-exercise" id="id2">
199
199
<spanid="ex-basic-matvec"></span>
200
200
<divclass="proof-title">
201
201
<spanclass="proof-type">Exercise 2.1</span>
202
202
203
203
</div><divclass="proof-content">
204
-
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.basic_matvec()</span></code> function has been left
204
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises1.basic_matvec" title="cla_utils.exercises1.basic_matvec"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.basic_matvec()</span></code></a> function has been left
205
205
unimplemented. To finish the function, add code so that it
206
206
computes the matrix-vector product <spanclass="math notranslate nohighlight">\(b=Ax\)</span> from inputs <spanclass="math notranslate nohighlight">\(A\)</span> and <spanclass="math notranslate nohighlight">\(x\)</span>.
207
207
In this first implementation, you should simply implement
@@ -230,7 +230,7 @@ <h3><span class="section-number">2.1.1. </span>Your first programming exercises<
230
230
<spanclass="proof-type">Exercise 2.2</span>
231
231
232
232
</div><divclass="proof-content">
233
-
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.column_matvec()</span></code> function has been
233
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises1.column_matvec" title="cla_utils.exercises1.column_matvec"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.column_matvec()</span></code></a> function has been
234
234
left unimplemented. To finish the function, add code so that it
235
235
computes the matrix-vector product <spanclass="math notranslate nohighlight">\(b=Ax\)</span> from inputs <spanclass="math notranslate nohighlight">\(A\)</span> and <spanclass="math notranslate nohighlight">\(x\)</span>.
236
236
This second implementation should use the column-space formulation
@@ -255,7 +255,7 @@ <h3><span class="section-number">2.1.1. </span>Your first programming exercises<
255
255
<spanclass="proof-type">Exercise 2.3</span>
256
256
257
257
</div><divclass="proof-content">
258
-
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.time_matvecs()</span></code> function computes
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.rank2()</span></code> function has been left
383
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises1.rank2" title="cla_utils.exercises1.rank2"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.rank2()</span></code></a> function has been left
384
384
unimplemented. To finish the function, add code so that it
385
385
computes the rank-2 matrix <spanclass="math notranslate nohighlight">\(A = u_1v_1^* + u_2v_2^*\)</span> from
386
386
<spanclass="math notranslate nohighlight">\(u_1,u_2\in \mathbb{C}^m\)</span> and <spanclass="math notranslate nohighlight">\(v_1,v_2 \in \mathbb{C}^n\)</span>. As you
@@ -480,12 +480,12 @@ <h2><span class="section-number">2.3. </span>Invertibility and inverses<a class=
480
480
m\)</span> identity matrix, and <spanclass="math notranslate nohighlight">\(u,v \in \mathbb{C}^m\)</span>, show that whenever
481
481
<spanclass="math notranslate nohighlight">\(A\)</span> is invertible, the inverse is of the form <spanclass="math notranslate nohighlight">\(A^{-1} = I + \alpha uv^*\)</span>
482
482
where <spanclass="math notranslate nohighlight">\(\alpha \in \mathbb{C}\)</span>, and calculate the form of <spanclass="math notranslate nohighlight">\(\alpha\)</span>.</p>
483
-
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.rank1pert_inv()</span></code> function has been
483
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises1.rank1pert_inv" title="cla_utils.exercises1.rank1pert_inv"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.rank1pert_inv()</span></code></a> function has been
484
484
left unimplemented. To finish the function, add code so that it
485
485
computes <spanclass="math notranslate nohighlight">\(A^{-1}\)</span> using your formula (and not any built-in matrix
486
486
inversion routines). The test script <codeclass="docutils literal notranslate"><spanclass="pre">test_exercises1.py</span></code> in the
487
487
<codeclass="docutils literal notranslate"><spanclass="pre">test</span></code> directory will also test this function.</p>
488
-
<p>Add a function to <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils.exercises1</span></code> that measures the
488
+
<p>Add a function to <aclass="reference internal" href="cla_utils.html#module-cla_utils.exercises1" title="cla_utils.exercises1"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils.exercises1</span></code></a> that measures the
489
489
time to compute the inverse of <spanclass="math notranslate nohighlight">\(A\)</span> for an input matrix of size 400,
490
490
and compare with the time to compute the inverse of <spanclass="math notranslate nohighlight">\(A\)</span> using the built-in
491
491
inverse:</p>
@@ -543,7 +543,7 @@ <h2><span class="section-number">2.4. </span>Adjoints and Hermitian matrices<a c
543
543
numbers to store), consider equivalently storing a real-valued
544
544
<spanclass="math notranslate nohighlight">\(m\times m\)</span> array <spanclass="math notranslate nohighlight">\(\hat{A}\)</span> with <spanclass="math notranslate nohighlight">\(\hat{A}_{ij}=B_{ij}\)</span> for <spanclass="math notranslate nohighlight">\(i\geq j\)</span>
545
545
and <spanclass="math notranslate nohighlight">\(\hat{A}_{ij}=C_{ij}\)</span> for <spanclass="math notranslate nohighlight">\(i<j\)</span>.</p>
546
-
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.ABiC()</span></code> function has been left
546
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises1.ABiC" title="cla_utils.exercises1.ABiC"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises1.ABiC()</span></code></a> function has been left
547
547
unimplemented. It should implement matrix vector multiplication
548
548
<spanclass="math notranslate nohighlight">\(z=Ax\)</span>, returning the real and imaginary parts of <spanclass="math notranslate nohighlight">\(z\)</span>, given the
549
549
real and imaginary parts of <spanclass="math notranslate nohighlight">\(x\)</span> as inputs, and given the real array
@@ -654,7 +654,7 @@ <h2><span class="section-number">2.6. </span>Orthogonal components of a vector<a
654
654
<spanclass="proof-type">Exercise 2.20</span>
655
655
656
656
</div><divclass="proof-content">
657
-
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises2.orthog_cpts()</span></code> function has been left
657
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises2.orthog_cpts" title="cla_utils.exercises2.orthog_cpts"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises2.orthog_cpts()</span></code></a> function has been left
658
658
unimplemented. It should implement the above computation, returning
659
659
<spanclass="math notranslate nohighlight">\(r\)</span> and the coefficients of the component of <spanclass="math notranslate nohighlight">\(v\)</span> in each
660
660
orthonormal direction. The test script <codeclass="docutils literal notranslate"><spanclass="pre">test_exercises2.py</span></code> in
to work when <spanclass="math notranslate nohighlight">\(Q\)</span> is not unitary or square). The test script
718
718
<codeclass="docutils literal notranslate"><spanclass="pre">test_exercises2.py</span></code> in the <codeclass="docutils literal notranslate"><spanclass="pre">test</span></code> directory will test this
719
719
function.</p>
720
-
<p>Add a function to <codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils.exercises2</span></code> that measures the
720
+
<p>Add a function to <aclass="reference internal" href="cla_utils.html#module-cla_utils.exercises2" title="cla_utils.exercises2"><codeclass="xref py py-mod docutils literal notranslate"><spanclass="pre">cla_utils.exercises2</span></code></a> that measures the
721
721
time to solve <spanclass="math notranslate nohighlight">\(Qx=b\)</span> using <codeclass="docutils literal notranslate"><spanclass="pre">solveQ</span></code> for an input matrix of sizes 100,
722
722
200, 400,
723
723
and compare with the times to solve the equation using the general purpose
<p>The <codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises2.orthog_proj()</span></code> function has been left
924
+
<p>The <aclass="reference internal" href="cla_utils.html#cla_utils.exercises2.orthog_proj" title="cla_utils.exercises2.orthog_proj"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">cla_utils.exercises2.orthog_proj()</span></code></a> function has been left
925
925
unimplemented. Given an orthonormal set <spanclass="math notranslate nohighlight">\(q_1,q_2,\ldots,q_n\)</span>, it
926
926
should provide the orthogonal projector <spanclass="math notranslate nohighlight">\(P\)</span>. The test script
927
927
<codeclass="docutils literal notranslate"><spanclass="pre">test_exercises2.py</span></code> in the <codeclass="docutils literal notranslate"><spanclass="pre">test</span></code> directory will also test
0 commit comments