Skip to content

Commit 3cd656c

Browse files
committed
deploy: 6cc3e71
1 parent 0d0b3c0 commit 3cd656c

File tree

5 files changed

+101
-30
lines changed

5 files changed

+101
-30
lines changed

genindex.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,25 @@ <h2 id="M">M</h2>
138138
<h2 id="P">P</h2>
139139
<table style="width: 100%" class="indextable genindextable"><tr>
140140
<td style="width: 33%; vertical-align: top;"><ul>
141-
<li><a href="pyclassify.html#pyclassify.utils.poisson_2d">poisson_2d() (in module pyclassify.utils)</a>
141+
<li><a href="pyclassify.html#pyclassify.utils.poisson_2d_structure">poisson_2d_structure() (in module pyclassify.utils)</a>
142142
</li>
143143
<li><a href="pyclassify.html#pyclassify.power_method">power_method() (in module pyclassify)</a>
144144
</li>
145145
<li><a href="pyclassify.html#pyclassify.power_method_numba">power_method_numba() (in module pyclassify)</a>
146146
</li>
147+
<li><a href="pyclassify.html#pyclassify.utils.profile_numpy_eigvals">profile_numpy_eigvals() (in module pyclassify.utils)</a>
148+
</li>
149+
<li><a href="pyclassify.html#pyclassify.utils.profile_scipy_eigvals">profile_scipy_eigvals() (in module pyclassify.utils)</a>
150+
</li>
151+
</ul></td>
152+
<td style="width: 33%; vertical-align: top;"><ul>
147153
<li>
148154
pyclassify
149155

150156
<ul>
151157
<li><a href="pyclassify.html#module-pyclassify">module</a>
152158
</li>
153159
</ul></li>
154-
</ul></td>
155-
<td style="width: 33%; vertical-align: top;"><ul>
156160
<li>
157161
pyclassify.utils
158162

index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ <h1>Table of Contents<a class="headerlink" href="#table-of-contents" title="Link
6161
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.check_symm_square"><code class="docutils literal notranslate"><span class="pre">check_symm_square()</span></code></a></li>
6262
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.make_symmetric"><code class="docutils literal notranslate"><span class="pre">make_symmetric()</span></code></a></li>
6363
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.max_iteration_warning"><code class="docutils literal notranslate"><span class="pre">max_iteration_warning()</span></code></a></li>
64-
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.poisson_2d"><code class="docutils literal notranslate"><span class="pre">poisson_2d()</span></code></a></li>
64+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.poisson_2d_structure"><code class="docutils literal notranslate"><span class="pre">poisson_2d_structure()</span></code></a></li>
65+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.profile_numpy_eigvals"><code class="docutils literal notranslate"><span class="pre">profile_numpy_eigvals()</span></code></a></li>
66+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.profile_scipy_eigvals"><code class="docutils literal notranslate"><span class="pre">profile_scipy_eigvals()</span></code></a></li>
6567
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.utils.read_config"><code class="docutils literal notranslate"><span class="pre">read_config()</span></code></a></li>
6668
</ul>
6769
</li>

objects.inv

29 Bytes
Binary file not shown.

pyclassify.html

Lines changed: 90 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -307,19 +307,19 @@ <h1>PyClassify Module Documentation<a class="headerlink" href="#pyclassify-modul
307307
<dl class="py function">
308308
<dt class="sig sig-object py" id="pyclassify.utils.check_symm_square">
309309
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">check_symm_square</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">A</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.check_symm_square" title="Link to this definition"></a></dt>
310-
<dd><p>Checks if the input matrix is a square symmetric matrix of type SciPy sparse matrix.
311-
This is done to ensure that the input matrix <cite>A</cite> is all of the following:
312-
1. A numpy array or a scipy sparse matrix.
313-
2. A square matrix.
314-
3. Symmetric.</p>
310+
<dd><p>Checks if the input matrix is a square symmetric matrix of type NumPy ndarray or SciPy sparse matrix. It uses check_square_matrix.</p>
311+
<p>This function performs the following steps:
312+
1. Verifies the input type is either <cite>np.ndarray</cite> or <cite>sp.spmatrix</cite>.
313+
2. Checks that the matrix is square.
314+
3. Validates that the matrix is symmetric.</p>
315315
<dl class="field-list simple">
316316
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
317-
<dd class="field-odd"><p><strong>A</strong> (<em>sp.spmatrix</em>) – The matrix to be checked.</p>
317+
<dd class="field-odd"><p><strong>A</strong> (<em>np.ndarray</em><em> or </em><em>sp.spmatrix</em>) – The matrix to be validated.</p>
318318
</dd>
319319
<dt class="field-even">Raises<span class="colon">:</span></dt>
320320
<dd class="field-even"><ul class="simple">
321-
<li><p><strong>TypeError</strong> – If the input is not a NumPy array or SciPy sparse matrix.</p></li>
322-
<li><p><strong>ValueError</strong> – If number of rows != number of columns or the matrix is not symmetric.</p></li>
321+
<li><p><strong>TypeError</strong> – If the input is not a NumPy array or a SciPy sparse matrix.</p></li>
322+
<li><p><strong>ValueError</strong> – If the matrix is not square or not symmetric.</p></li>
323323
</ul>
324324
</dd>
325325
</dl>
@@ -328,12 +328,13 @@ <h1>PyClassify Module Documentation<a class="headerlink" href="#pyclassify-modul
328328
<dl class="py function">
329329
<dt class="sig sig-object py" id="pyclassify.utils.make_symmetric">
330330
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">make_symmetric</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">A</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.make_symmetric" title="Link to this definition"></a></dt>
331-
<dd><p>Ensures the input matrix is symmetric by averaging it with its transpose.</p>
332-
<p>This function first checks if the matrix is square using the <cite>check_square_matrix</cite> function.
333-
Then, it makes the matrix symmetric by averaging it with its transpose.</p>
331+
<dd><p>Ensures that the input matrix is symmetric by averaging it with its transpose.</p>
332+
<p>This function performs the following steps:
333+
1. Checks if the matrix is a square matrix using <cite>check_square_matrix</cite>.
334+
2. Computes the symmetric version of the matrix using the formula: (A + A.T) / 2.</p>
334335
<dl class="field-list simple">
335336
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
336-
<dd class="field-odd"><p><strong>A</strong> (<em>np.ndarray</em><em> or </em><em>sp.spmatrix</em>) – The input square matrix to be made symmetric.</p>
337+
<dd class="field-odd"><p><strong>A</strong> (<em>np.ndarray</em><em> or </em><em>sp.spmatrix</em>) – The input matrix to be symmetrized.</p>
337338
</dd>
338339
<dt class="field-even">Returns<span class="colon">:</span></dt>
339340
<dd class="field-even"><p>The symmetric version of the input matrix.</p>
@@ -343,8 +344,8 @@ <h1>PyClassify Module Documentation<a class="headerlink" href="#pyclassify-modul
343344
</dd>
344345
<dt class="field-even">Raises<span class="colon">:</span></dt>
345346
<dd class="field-even"><ul class="simple">
346-
<li><p><strong>TypeError</strong> – If the input matrix is not a NumPy array or SciPy sparse matrix.</p></li>
347-
<li><p><strong>ValueError</strong> – If the input matrix is not square.</p></li>
347+
<li><p><strong>TypeError</strong> – If the input is not a NumPy array or a SciPy sparse matrix.</p></li>
348+
<li><p><strong>ValueError</strong> – If the matrix is not square.</p></li>
348349
</ul>
349350
</dd>
350351
</dl>
@@ -353,28 +354,90 @@ <h1>PyClassify Module Documentation<a class="headerlink" href="#pyclassify-modul
353354
<dl class="py function">
354355
<dt class="sig sig-object py" id="pyclassify.utils.max_iteration_warning">
355356
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">max_iteration_warning</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.max_iteration_warning" title="Link to this definition"></a></dt>
356-
<dd><p>Function to warn the user that the maximum number of iteration has been reached,
357-
hence suggesting that the method did not converge.</p>
357+
<dd><p>Prints a warning message indicating that the maximum number of iterations has been reached.</p>
358+
<p>This function is used to alert the user that the iterative method likely did not converge,
359+
and suggests that a lower tolerance or alternative approach may be needed.</p>
360+
</dd></dl>
361+
362+
<dl class="py function">
363+
<dt class="sig sig-object py" id="pyclassify.utils.poisson_2d_structure">
364+
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">poisson_2d_structure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.poisson_2d_structure" title="Link to this definition"></a></dt>
365+
<dd><p>Constructs a sparse matrix of size n x n with the same 5-diagonal structure
366+
as the 2D Poisson matrix (main, ±1, ±k). Used for testing structure, not actual PDEs: in real
367+
life, this function would return a matrix of size $n^2$.</p>
368+
<dl class="field-list simple">
369+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
370+
<dd class="field-odd"><ul class="simple">
371+
<li><p><strong>n</strong> (<em>int</em>) – Size of the square matrix.</p></li>
372+
<li><p><strong>k</strong> (<em>int</em><em> or </em><em>None</em>) – The offset for the “long-range” diagonals. If None, uses k = int(sqrt(n)).</p></li>
373+
</ul>
374+
</dd>
375+
<dt class="field-even">Returns<span class="colon">:</span></dt>
376+
<dd class="field-even"><p>A sparse matrix with 5 diagonals for testing.</p>
377+
</dd>
378+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
379+
<dd class="field-odd"><p>scipy.sparse.spmatrix</p>
380+
</dd>
381+
</dl>
382+
</dd></dl>
383+
384+
<dl class="py function">
385+
<dt class="sig sig-object py" id="pyclassify.utils.profile_numpy_eigvals">
386+
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">profile_numpy_eigvals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">A</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.profile_numpy_eigvals" title="Link to this definition"></a></dt>
387+
<dd><p>Profiles the memory usage of computing eigenvalues and eigenvectors using NumPy.</p>
388+
<p>This function performs the following steps:
389+
1. Measures memory before the eigendecomposition.
390+
2. Computes eigenvalues and eigenvectors using <cite>np.linalg.eigh</cite>.
391+
3. Measures memory after the computation.
392+
4. Returns the difference in memory usage.</p>
393+
<dl class="field-list simple">
394+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
395+
<dd class="field-odd"><p><strong>A</strong> (<em>np.ndarray</em>) – A symmetric NumPy array.</p>
396+
</dd>
397+
<dt class="field-even">Returns<span class="colon">:</span></dt>
398+
<dd class="field-even"><p>Memory used in MB during the computation.</p>
399+
</dd>
400+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
401+
<dd class="field-odd"><p>float</p>
402+
</dd>
403+
</dl>
358404
</dd></dl>
359405

360406
<dl class="py function">
361-
<dt class="sig sig-object py" id="pyclassify.utils.poisson_2d">
362-
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">poisson_2d</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.poisson_2d" title="Link to this definition"></a></dt>
363-
<dd><p>Helper function to return an nxn scipy sparse matrix, in particular the one resulting from the discretization of the Laplacian on a 2D grid.</p>
407+
<dt class="sig sig-object py" id="pyclassify.utils.profile_scipy_eigvals">
408+
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">profile_scipy_eigvals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">A</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.utils.profile_scipy_eigvals" title="Link to this definition"></a></dt>
409+
<dd><p>Profiles the memory usage of computing eigenvalues and eigenvectors using SciPy.</p>
410+
<p>This function performs the following steps:
411+
1. Measures memory before the eigendecomposition.
412+
2. Computes eigenvalues and eigenvectors using <cite>scipy.linalg.eigh</cite>.
413+
3. Measures memory after the computation.
414+
4. Returns the difference in memory usage.</p>
415+
<dl class="field-list simple">
416+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
417+
<dd class="field-odd"><p><strong>A</strong> (<em>np.ndarray</em>) – A symmetric NumPy array.</p>
418+
</dd>
419+
<dt class="field-even">Returns<span class="colon">:</span></dt>
420+
<dd class="field-even"><p>Memory used in MB during the computation.</p>
421+
</dd>
422+
<dt class="field-odd">Return type<span class="colon">:</span></dt>
423+
<dd class="field-odd"><p>float</p>
424+
</dd>
425+
</dl>
364426
</dd></dl>
365427

366428
<dl class="py function">
367429
<dt class="sig sig-object py" id="pyclassify.utils.read_config">
368430
<span class="sig-prename descclassname"><span class="pre">pyclassify.utils.</span></span><span class="sig-name descname"><span class="pre">read_config</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span></span></span><a class="headerlink" href="#pyclassify.utils.read_config" title="Link to this definition"></a></dt>
369-
<dd><p>Reads a YAML configuration file and returns its contents as a dictionary.</p>
370-
<p>This function constructs the absolute path to a YAML file (by appending the ‘.yaml’ extension
371-
to the provided base file name), opens the file, and parses its content using yaml.safe_load.</p>
431+
<dd><p>Reads a YAML configuration file and loads its contents into a dictionary.</p>
432+
<p>This function performs the following steps:
433+
1. Constructs the absolute path to the YAML file by appending ‘.yaml’ to the given base name.
434+
2. Opens and parses the file using <cite>yaml.safe_load</cite>.</p>
372435
<dl class="field-list simple">
373436
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
374-
<dd class="field-odd"><p><strong>file</strong> (<em>str</em>) – The base name of the YAML file (without the ‘.yaml’ extension).</p>
437+
<dd class="field-odd"><p><strong>file</strong> (<em>str</em>) – The base name of the YAML file (without extension).</p>
375438
</dd>
376439
<dt class="field-even">Returns<span class="colon">:</span></dt>
377-
<dd class="field-even"><p>A dictionary containing the configuration parameters loaded from the YAML file.</p>
440+
<dd class="field-even"><p>A dictionary containing the configuration parameters.</p>
378441
</dd>
379442
<dt class="field-odd">Return type<span class="colon">:</span></dt>
380443
<dd class="field-odd"><p>dict</p>
@@ -530,7 +593,9 @@ <h1 class="logo"><a href="index.html">final_project</a></h1>
530593
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.check_symm_square"><code class="docutils literal notranslate"><span class="pre">check_symm_square()</span></code></a></li>
531594
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.make_symmetric"><code class="docutils literal notranslate"><span class="pre">make_symmetric()</span></code></a></li>
532595
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.max_iteration_warning"><code class="docutils literal notranslate"><span class="pre">max_iteration_warning()</span></code></a></li>
533-
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.poisson_2d"><code class="docutils literal notranslate"><span class="pre">poisson_2d()</span></code></a></li>
596+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.poisson_2d_structure"><code class="docutils literal notranslate"><span class="pre">poisson_2d_structure()</span></code></a></li>
597+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.profile_numpy_eigvals"><code class="docutils literal notranslate"><span class="pre">profile_numpy_eigvals()</span></code></a></li>
598+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.profile_scipy_eigvals"><code class="docutils literal notranslate"><span class="pre">profile_scipy_eigvals()</span></code></a></li>
534599
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.utils.read_config"><code class="docutils literal notranslate"><span class="pre">read_config()</span></code></a></li>
535600
</ul>
536601
</li>

0 commit comments

Comments
 (0)