Skip to content

Commit 036aacb

Browse files
committed
deploy: 6deab0d
1 parent 0ef3865 commit 036aacb

File tree

7 files changed

+168
-11
lines changed

7 files changed

+168
-11
lines changed

_sources/pyclassify.rst.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Submodule: utils
2222
Submodule: helpers_secular
2323
================
2424

25-
.. automodule:: pyclassify.helpers_secular
25+
.. automodule:: pyclassify.zero_finder
2626
:members:
2727
:undoc-members:
2828
:show-inheritance:

genindex.html

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,40 @@
3636
<h1 id="index">Index</h1>
3737

3838
<div class="genindex-jumpbox">
39-
<a href="#C"><strong>C</strong></a>
39+
<a href="#B"><strong>B</strong></a>
40+
| <a href="#C"><strong>C</strong></a>
4041
| <a href="#E"><strong>E</strong></a>
42+
| <a href="#F"><strong>F</strong></a>
4143
| <a href="#I"><strong>I</strong></a>
4244
| <a href="#L"><strong>L</strong></a>
4345
| <a href="#M"><strong>M</strong></a>
4446
| <a href="#P"><strong>P</strong></a>
4547
| <a href="#R"><strong>R</strong></a>
48+
| <a href="#S"><strong>S</strong></a>
4649

4750
</div>
48-
<h2 id="C">C</h2>
51+
<h2 id="B">B</h2>
4952
<table style="width: 100%" class="indextable genindextable"><tr>
5053
<td style="width: 33%; vertical-align: top;"><ul>
51-
<li><a href="pyclassify.html#pyclassify.utils.check_square_matrix">check_square_matrix() (in module pyclassify.utils)</a>
54+
<li><a href="pyclassify.html#pyclassify.zero_finder.bisection">bisection() (in module pyclassify.zero_finder)</a>
5255
</li>
5356
</ul></td>
57+
</tr></table>
58+
59+
<h2 id="C">C</h2>
60+
<table style="width: 100%" class="indextable genindextable"><tr>
5461
<td style="width: 33%; vertical-align: top;"><ul>
62+
<li><a href="pyclassify.html#pyclassify.utils.check_square_matrix">check_square_matrix() (in module pyclassify.utils)</a>
63+
</li>
5564
<li><a href="pyclassify.html#pyclassify.utils.check_symm_square">check_symm_square() (in module pyclassify.utils)</a>
5665
</li>
66+
</ul></td>
67+
<td style="width: 33%; vertical-align: top;"><ul>
5768
<li><a href="pyclassify.html#pyclassify.EigenSolver.compute_eigenval">compute_eigenval() (pyclassify.EigenSolver method)</a>
69+
</li>
70+
<li><a href="pyclassify.html#pyclassify.zero_finder.compute_outer_zero">compute_outer_zero() (in module pyclassify.zero_finder)</a>
71+
</li>
72+
<li><a href="pyclassify.html#pyclassify.zero_finder.compute_Psi">compute_Psi() (in module pyclassify.zero_finder)</a>
5873
</li>
5974
</ul></td>
6075
</tr></table>
@@ -75,6 +90,14 @@ <h2 id="E">E</h2>
7590
</ul></td>
7691
</tr></table>
7792

93+
<h2 id="F">F</h2>
94+
<table style="width: 100%" class="indextable genindextable"><tr>
95+
<td style="width: 33%; vertical-align: top;"><ul>
96+
<li><a href="pyclassify.html#pyclassify.zero_finder.find_root">find_root() (in module pyclassify.zero_finder)</a>
97+
</li>
98+
</ul></td>
99+
</tr></table>
100+
78101
<h2 id="I">I</h2>
79102
<table style="width: 100%" class="indextable genindextable"><tr>
80103
<td style="width: 33%; vertical-align: top;"><ul>
@@ -98,15 +121,15 @@ <h2 id="M">M</h2>
98121
</li>
99122
<li><a href="pyclassify.html#pyclassify.utils.max_iteration_warning">max_iteration_warning() (in module pyclassify.utils)</a>
100123
</li>
101-
</ul></td>
102-
<td style="width: 33%; vertical-align: top;"><ul>
103124
<li>
104125
module
105126

106127
<ul>
107128
<li><a href="pyclassify.html#module-pyclassify">pyclassify</a>
108129
</li>
109130
<li><a href="pyclassify.html#module-pyclassify.utils">pyclassify.utils</a>
131+
</li>
132+
<li><a href="pyclassify.html#module-pyclassify.zero_finder">pyclassify.zero_finder</a>
110133
</li>
111134
</ul></li>
112135
</ul></td>
@@ -121,20 +144,27 @@ <h2 id="P">P</h2>
121144
</li>
122145
<li><a href="pyclassify.html#pyclassify.power_method_numba">power_method_numba() (in module pyclassify)</a>
123146
</li>
124-
</ul></td>
125-
<td style="width: 33%; vertical-align: top;"><ul>
126147
<li>
127148
pyclassify
128149

129150
<ul>
130151
<li><a href="pyclassify.html#module-pyclassify">module</a>
131152
</li>
132153
</ul></li>
154+
</ul></td>
155+
<td style="width: 33%; vertical-align: top;"><ul>
133156
<li>
134157
pyclassify.utils
135158

136159
<ul>
137160
<li><a href="pyclassify.html#module-pyclassify.utils">module</a>
161+
</li>
162+
</ul></li>
163+
<li>
164+
pyclassify.zero_finder
165+
166+
<ul>
167+
<li><a href="pyclassify.html#module-pyclassify.zero_finder">module</a>
138168
</li>
139169
</ul></li>
140170
</ul></td>
@@ -148,6 +178,14 @@ <h2 id="R">R</h2>
148178
</ul></td>
149179
</tr></table>
150180

181+
<h2 id="S">S</h2>
182+
<table style="width: 100%" class="indextable genindextable"><tr>
183+
<td style="width: 33%; vertical-align: top;"><ul>
184+
<li><a href="pyclassify.html#pyclassify.zero_finder.secular_solver_python">secular_solver_python() (in module pyclassify.zero_finder)</a>
185+
</li>
186+
</ul></td>
187+
</tr></table>
188+
151189

152190

153191
</div>

index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ <h1>Table of Contents<a class="headerlink" href="#table-of-contents" title="Link
6565
<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>
6666
</ul>
6767
</li>
68-
<li class="toctree-l1"><a class="reference internal" href="pyclassify.html#submodule-helpers-secular">Submodule: helpers_secular</a></li>
68+
<li class="toctree-l1"><a class="reference internal" href="pyclassify.html#submodule-helpers-secular">Submodule: helpers_secular</a><ul>
69+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.zero_finder.bisection"><code class="docutils literal notranslate"><span class="pre">bisection()</span></code></a></li>
70+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.zero_finder.compute_Psi"><code class="docutils literal notranslate"><span class="pre">compute_Psi()</span></code></a></li>
71+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.zero_finder.compute_outer_zero"><code class="docutils literal notranslate"><span class="pre">compute_outer_zero()</span></code></a></li>
72+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.zero_finder.find_root"><code class="docutils literal notranslate"><span class="pre">find_root()</span></code></a></li>
73+
<li class="toctree-l2"><a class="reference internal" href="pyclassify.html#pyclassify.zero_finder.secular_solver_python"><code class="docutils literal notranslate"><span class="pre">secular_solver_python()</span></code></a></li>
74+
</ul>
75+
</li>
6976
</ul>
7077
</div>
7178
</section>

objects.inv

56 Bytes
Binary file not shown.

py-modindex.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ <h1>Python Module Index</h1>
5757
<td>&#160;&#160;&#160;
5858
<a href="pyclassify.html#module-pyclassify.utils"><code class="xref">pyclassify.utils</code></a></td><td>
5959
<em></em></td></tr>
60+
<tr class="cg-1">
61+
<td></td>
62+
<td>&#160;&#160;&#160;
63+
<a href="pyclassify.html#module-pyclassify.zero_finder"><code class="xref">pyclassify.zero_finder</code></a></td><td>
64+
<em></em></td></tr>
6065
</table>
6166

6267

pyclassify.html

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,106 @@ <h1>PyClassify Module Documentation<a class="headerlink" href="#pyclassify-modul
385385
</section>
386386
<section id="submodule-helpers-secular">
387387
<h1>Submodule: helpers_secular<a class="headerlink" href="#submodule-helpers-secular" title="Link to this heading"></a></h1>
388+
<dl class="py function" id="module-pyclassify.zero_finder">
389+
<dt class="sig sig-object py" id="pyclassify.zero_finder.bisection">
390+
<span class="sig-prename descclassname"><span class="pre">pyclassify.zero_finder.</span></span><span class="sig-name descname"><span class="pre">bisection</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">a</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_iter</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.zero_finder.bisection" title="Link to this definition"></a></dt>
391+
<dd><p>Standard bisection method to find a root of the function f in the interval [a, b].</p>
392+
<p>This implementation is used in <cite>compute_outer_zero</cite> to locate the outer eigenvalue.</p>
393+
<p>Parameters:
394+
f (callable): A continuous function for which f(a) * f(b) &lt; 0.
395+
a (float): Left endpoint of the interval.
396+
b (float): Right endpoint of the interval.
397+
tol (float): Tolerance for convergence. The method stops when the interval is smaller than tol or when f(c) is sufficiently small.
398+
max_iter (int): Maximum number of iterations before stopping.</p>
399+
<p>Returns:
400+
float: Approximation of the root within the specified tolerance.</p>
401+
</dd></dl>
402+
403+
<dl class="py function">
404+
<dt class="sig sig-object py" id="pyclassify.zero_finder.compute_Psi">
405+
<span class="sig-prename descclassname"><span class="pre">pyclassify.zero_finder.</span></span><span class="sig-name descname"><span class="pre">compute_Psi</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">v</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">d</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rho</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.zero_finder.compute_Psi" title="Link to this definition"></a></dt>
406+
<dd><p>This function computes the functions Psi1, and Psi2 and their derivative, accordingly to the equation described
407+
by the notes chapter 5-6 contained in the shared folders.
408+
The equation utilized are the equation 5.27, 5.25 and 5.29.
409+
d is assumed to be already a vector whose elements are already sorted.
410+
Inputs:</p>
411+
<blockquote>
412+
<div><p>-i: It is the index of the i-th smallest eigenvalue that is being computed
413+
-v: Rank one correction
414+
-d: Diagonal element of the Diagonal matrix described in equation 5.7
415+
-rho: off diagonal element used for the splitting.</p>
416+
</div></blockquote>
417+
<dl class="simple">
418+
<dt>Output:</dt><dd><p>Psi1: Lamoba function that returns the value of Psi1 at the point x
419+
Psi2: Lamoba function that returns the value of Psi2 at the point x
420+
dPsi1: Lamoba function that returns the value of the derivative dPsi1/dx at the point x
421+
dPsi2: Lamoba function that returns the value of the derivative dPsi2/dx at the point x</p>
422+
</dd>
423+
</dl>
424+
</dd></dl>
425+
426+
<dl class="py function">
427+
<dt class="sig sig-object py" id="pyclassify.zero_finder.compute_outer_zero">
428+
<span class="sig-prename descclassname"><span class="pre">pyclassify.zero_finder.</span></span><span class="sig-name descname"><span class="pre">compute_outer_zero</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">v</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">d</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rho</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interval_end</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tol</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1e-12</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_iter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1000</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.zero_finder.compute_outer_zero" title="Link to this definition"></a></dt>
429+
<dd><p>Computes the outer eigenvalue (lambda[0] if rho &lt; 0, lambda[n-1] if rho &gt; 0) of a rank-one modified diagonal matrix.</p>
430+
<dl class="simple">
431+
<dt>The secular function behaves such that:</dt><dd><ul class="simple">
432+
<li><p>If rho &gt; 0, the outer eigenvalue lies in (d[n-1], infty), and f is increasing in this interval.</p></li>
433+
<li><p>If rho &lt; 0, the outer eigenvalue lies in (-infty, d[0]), and f is decreasing in this interval.</p></li>
434+
</ul>
435+
</dd>
436+
</dl>
437+
<p>This function:
438+
1. Determines the direction to search based on the sign of rho.
439+
2. Finds an upper bound (or lower bound for rho &lt; 0) where the secular function changes sign.
440+
3. Uses the bisection method to find the root in the determined interval.</p>
441+
<p>Returns:
442+
float: Approximation of the outer eigenvalue.</p>
443+
</dd></dl>
444+
445+
<dl class="py function">
446+
<dt class="sig sig-object py" id="pyclassify.zero_finder.find_root">
447+
<span class="sig-prename descclassname"><span class="pre">pyclassify.zero_finder.</span></span><span class="sig-name descname"><span class="pre">find_root</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">left_center</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">v</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">d</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rho</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lam_0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tol</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1e-15</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxiter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">100</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.zero_finder.find_root" title="Link to this definition"></a></dt>
448+
<dd><p>Find the roots of the secular equation contained inside the interval min(d)=d[0] and max(d)=d[-1].
449+
Inputs:</p>
450+
<blockquote>
451+
<div><p>-i: It is the index of the i-th smallest eigenvalue that is being computed
452+
-left_center: boolen variable. True if the left extreme is the center od the new - shifted reference system.
453+
-v: Rank one correction
454+
-d: Diagonal element of the Diagonal matrix described in equation 5.7
455+
-rho: off diagonal element used for the splitting.
456+
-lam_0: initial guess of the i-th root of the secular equation
457+
-tol: absolute or relative tollerence. For lamba value below 1e-6, tols refers to the absolute tolerance (avoiding division by zero). For</p>
458+
<blockquote>
459+
<div><p>lambda value greater than 1e-6, tol is the absolute tolerance.</p>
460+
</div></blockquote>
461+
<p>-maxiter: Maximum number of iteration of the iterative solver.</p>
462+
</div></blockquote>
463+
<dl class="simple">
464+
<dt>Outputs:</dt><dd><p>-shift + lam_0: i-th smallest eigenvalue
465+
-lam_0: difference between the i-th eigenvalue and the nearest diagonal element.</p>
466+
</dd>
467+
</dl>
468+
</dd></dl>
469+
470+
<dl class="py function">
471+
<dt class="sig sig-object py" id="pyclassify.zero_finder.secular_solver_python">
472+
<span class="sig-prename descclassname"><span class="pre">pyclassify.zero_finder.</span></span><span class="sig-name descname"><span class="pre">secular_solver_python</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rho</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">d</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">v</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pyclassify.zero_finder.secular_solver_python" title="Link to this definition"></a></dt>
473+
<dd><p>Computes all the roots of the secular equation.
474+
Inputs:</p>
475+
<blockquote>
476+
<div><p>-v: Rank one correction
477+
-d: Diagonal element of the Diagonal matrix described in equation 5.7
478+
-rho: off diagonal element used for the splitting.</p>
479+
</div></blockquote>
480+
<dl class="simple">
481+
<dt>Outputs:</dt><dd><p>-eig_val: vector of the roots of the secular equation
482+
-index: vector of the index of the center of the shifted frame of reference associated to the i-ith root
483+
-delta: vector of difference between the i-th eigenvalue and the nearest diagonal element.</p>
484+
</dd>
485+
</dl>
486+
</dd></dl>
487+
388488
</section>
389489

390490

@@ -434,7 +534,14 @@ <h1 class="logo"><a href="index.html">final_project</a></h1>
434534
<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>
435535
</ul>
436536
</li>
437-
<li class="toctree-l1"><a class="reference internal" href="#submodule-helpers-secular">Submodule: helpers_secular</a></li>
537+
<li class="toctree-l1"><a class="reference internal" href="#submodule-helpers-secular">Submodule: helpers_secular</a><ul>
538+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.zero_finder.bisection"><code class="docutils literal notranslate"><span class="pre">bisection()</span></code></a></li>
539+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.zero_finder.compute_Psi"><code class="docutils literal notranslate"><span class="pre">compute_Psi()</span></code></a></li>
540+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.zero_finder.compute_outer_zero"><code class="docutils literal notranslate"><span class="pre">compute_outer_zero()</span></code></a></li>
541+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.zero_finder.find_root"><code class="docutils literal notranslate"><span class="pre">find_root()</span></code></a></li>
542+
<li class="toctree-l2"><a class="reference internal" href="#pyclassify.zero_finder.secular_solver_python"><code class="docutils literal notranslate"><span class="pre">secular_solver_python()</span></code></a></li>
543+
</ul>
544+
</li>
438545
</ul>
439546

440547
<div class="relations">

0 commit comments

Comments
 (0)