Context: P is a QSP polynomial if $|P(e^{i\theta})| \le 1$ for every $\theta \in [0, 2\pi)$.
When computing polynomial approximations for functions (that have infinite series), the polynomials may end up having max abs. value on the complex unit circle larger than 1, even if the actual function's absolute value is always at most 1 on the unit circle.
Context: P is a QSP polynomial if $|P(e^{i\theta})| \le 1$ for every $\theta \in [0, 2\pi)$.
When computing polynomial approximations for functions (that have infinite series), the polynomials may end up having max abs. value on the complex unit circle larger than 1, even if the actual function's absolute value is always at most 1 on the unit circle.
Current fix (https://github.com/quantumlib/Qualtran/pull/851) evaluate polynomial on (2**17 ~= 1.3e5) uniformly spaced points on the complex unit circle to compute the maximum absolute value, and scale down P by that.
Issues:
If anyone has ideas for correct and more efficient ways to compute the optimal scaling, please do share!
cc @tanujkhattar @skushnir123 @NoureldinYosri @ncrubin