nlft_qsp.solvers.completion.weiss
¶
Module for polynomial completion based on Weiss' algorithm.
Classes:
| Name | Description |
|---|---|
WeissConvergenceError |
This error is thrown where Weiss' algorithm does not converge, more precisely, |
Functions:
| Name | Description |
|---|---|
complete |
Uses Weiss' algorithm to find a complementary polynomial to the given one. The polynomial will also be the unique outer, positive-mean polynomial with this property, according to arXiv:2407.05634. |
ratio |
Uses Weiss' algorithm to compute \(b/a\), where \(a\) is the unique outer, positive-mean polynomial such that \(|a|^2 + |b|^2 = 1\), up to working precision. |
weiss_internal |
Internal function for Weiss' algorithm. The user should call |
WeissConvergenceError
¶
Bases: Exception
This error is thrown where Weiss' algorithm does not converge, more precisely,
when the error in Weiss' algorithm does not improve after WEISS_MAX_ATTEMPTS steps.
Source code in nlft_qsp/solvers/completion/weiss.py
complete(b: Polynomial, eps: float = -1, verbose=False) -> Polynomial
¶
Uses Weiss' algorithm to find a complementary polynomial to the given one. The polynomial will also be the unique outer, positive-mean polynomial with this property, according to arXiv:2407.05634.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
Polynomial
|
The polynomial to complete. |
required |
eps
|
float
|
The desired tolerance. If not specified, it will be set to working precision. |
-1
|
verbose
|
bool
|
verbosity during the procedure. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Polynomial
|
A polynomial \(a(z)\) satisfying \(|a|^2 + |b|^2 = 1\) on the unit circle (up to eps). |
Source code in nlft_qsp/solvers/completion/weiss.py
ratio(b: Polynomial, eps: float = -1, verbose=False) -> Polynomial
¶
Uses Weiss' algorithm to compute \(b/a\), where \(a\) is the unique outer, positive-mean polynomial such that \(|a|^2 + |b|^2 = 1\), up to working precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
Polynomial
|
The polynomial to complete. |
required |
eps
|
float
|
The desired tolerance. If not specified, it will be set to working precision. |
-1
|
verbose
|
bool
|
verbosity during the procedure. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Polynomial
|
A polynomial \(a(z)\) satisfying \(|a(z)|^2 + |b(z)|^2 = 1\) on the unit circle (up to working precision), and a polynomial \(c\) that approximates \(b/a\). |
Source code in nlft_qsp/solvers/completion/weiss.py
weiss_internal(b: Polynomial, eps: float = -1, compute_ratio=False, verbose=False) -> Polynomial | tuple[Polynomial, Polynomial]
¶
Internal function for Weiss' algorithm. The user should call weiss.complete, or weiss.ratio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b
|
Polynomial
|
The starting polynomial to complete. |
required |
eps
|
float
|
The desired tolerance. If not specified, it will be set to working precision. |
-1
|
compute_ratio
|
bool
|
If True, then also a |
False
|
verbose
|
bool
|
verbosity during the procedure. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
Polynomial |
Polynomial | tuple[Polynomial, Polynomial]
|
A polynomial \(a(z)\) satisfying \(|a|^2 + |b|^2 = 1\) on the unit circle (up to working precision). If |