Corrected recipes and added notebook

This commit is contained in:
Nicolas Rougier
2014-05-29 21:48:26 +02:00
parent 6d55b8bcac
commit 4cef439df0
3 changed files with 2411 additions and 137 deletions

View File

@@ -32,23 +32,8 @@ is:</p>
<p class="last">The level names came from an old-game (Dungeon Master)</p>
</div>
<p>Repository is at: <a class="reference external" href="https://github.com/rougier/numpy-100">https://github.com/rougier/numpy-100</a></p>
<p><strong>Contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#neophyte" id="id1">Neophyte</a></li>
<li><a class="reference internal" href="#novice" id="id2">Novice</a></li>
<li><a class="reference internal" href="#apprentice" id="id3">Apprentice</a></li>
<li><a class="reference internal" href="#journeyman" id="id4">Journeyman</a></li>
<li><a class="reference internal" href="#craftsman" id="id5">Craftsman</a></li>
<li><a class="reference internal" href="#artisan" id="id6">Artisan</a></li>
<li><a class="reference internal" href="#adept" id="id7">Adept</a></li>
<li><a class="reference internal" href="#expert" id="id8">Expert</a></li>
<li><a class="reference internal" href="#master" id="id9">Master</a></li>
<li><a class="reference internal" href="#archmaster" id="id10">Archmaster</a></li>
</ul>
</div>
<div class="section" id="neophyte">
<h1><a class="toc-backref" href="#id1">Neophyte</a></h1>
<h1>Neophyte</h1>
<ol class="arabic">
<li><p class="first">Import the numpy package under the name <tt class="docutils literal">np</tt></p>
<pre class="code python literal-block">
@@ -105,7 +90,7 @@ is:</p>
</ol>
</div>
<div class="section" id="novice">
<h1><a class="toc-backref" href="#id2">Novice</a></h1>
<h1>Novice</h1>
<ol class="arabic">
<li><p class="first">Create a 8x8 matrix and fill it with a checkerboard pattern</p>
<pre class="code python literal-block">
@@ -170,7 +155,7 @@ is:</p>
</ol>
</div>
<div class="section" id="apprentice">
<h1><a class="toc-backref" href="#id3">Apprentice</a></h1>
<h1>Apprentice</h1>
<ol class="arabic">
<li><p class="first">Make an array immutable (read-only)</p>
<pre class="code python literal-block">
@@ -260,7 +245,7 @@ consecutive zeros interleaved between each value ?</p>
</ol>
</div>
<div class="section" id="journeyman">
<h1><a class="toc-backref" href="#id4">Journeyman</a></h1>
<h1>Journeyman</h1>
<ol class="arabic">
<li><p class="first">Consider the following file:</p>
<pre class="literal-block">
@@ -336,7 +321,7 @@ using a vector S of same size describing subset indices ?</p>
</ol>
</div>
<div class="section" id="craftsman">
<h1><a class="toc-backref" href="#id5">Craftsman</a></h1>
<h1>Craftsman</h1>
<ol class="arabic">
<li><p class="first">Consider a one-dimensional array Z, build a two-dimensional array whose
first row is (Z[0],Z[1],Z[2]) and each subsequent row is shifted by 1 (last
@@ -378,7 +363,7 @@ np.bincount(A) == C ?</p>
</ol>
</div>
<div class="section" id="artisan">
<h1><a class="toc-backref" href="#id6">Artisan</a></h1>
<h1>Artisan</h1>
<ol class="arabic">
<li><p class="first">Considering a 100x3 matrix, extract rows with unequal values (e.g. [2,2,3])</p>
<pre class="code python literal-block">
@@ -406,7 +391,7 @@ np.bincount(A) == C ?</p>
</ol>
</div>
<div class="section" id="adept">
<h1><a class="toc-backref" href="#id7">Adept</a></h1>
<h1>Adept</h1>
<ol class="arabic">
<li><p class="first">Consider an arbitrary array, write a function that extract a subpart with a
fixed shape and centered on a given element (pad with a <tt class="docutils literal">fill</tt> value when
@@ -451,7 +436,7 @@ array R = [[1,2,3,4], [2,3,4,5], [3,4,5,6], ..., [11,12,13,14]] ?</p>
</ol>
</div>
<div class="section" id="expert">
<h1><a class="toc-backref" href="#id8">Expert</a></h1>
<h1>Expert</h1>
<ol class="arabic">
<li><p class="first">Consider two arrays A and B of shape (8,3) and (2,2). How to find rows of A
that contain elements of each row of B regardless of the order of the elements
@@ -498,7 +483,7 @@ in B ?</p>
</ol>
</div>
<div class="section" id="master">
<h1><a class="toc-backref" href="#id9">Master</a></h1>
<h1>Master</h1>
<ol class="arabic">
<li><p class="first">Given a two dimensional array, how to extract unique rows ?</p>
<div class="note">
@@ -517,7 +502,7 @@ in B ?</p>
</ol>
</div>
<div class="section" id="archmaster">
<h1><a class="toc-backref" href="#id10">Archmaster</a></h1>
<h1>Archmaster</h1>
</div>
</div>
</body>