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
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">check_symm_square</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">A</span></span></em><spanclass="sig-paren">)</span><aclass="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>.
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">make_symmetric</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">A</span></span></em><spanclass="sig-paren">)</span><aclass="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>
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">max_iteration_warning</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="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>
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">poisson_2d_structure</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">n</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">k</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="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>
<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>
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">profile_numpy_eigvals</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">A</span></span></em><spanclass="sig-paren">)</span><aclass="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>.
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">poisson_2d</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">n</span></span></em><spanclass="sig-paren">)</span><aclass="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>
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">profile_scipy_eigvals</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">A</span></span></em><spanclass="sig-paren">)</span><aclass="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>.
<spanclass="sig-prename descclassname"><spanclass="pre">pyclassify.utils.</span></span><spanclass="sig-name descname"><spanclass="pre">read_config</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">file</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">str</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">dict</span></span></span><aclass="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>
0 commit comments