Rational Approximation¶
Linearized Rational Fitting¶
-
polyrat.
linearized_ratfit
(X, y, num_degree, denom_degree, Basis=<class 'polyrat.arnoldi.ArnoldiPolynomialBasis'>, simultaneous=True, weight=None)[source]¶ Construct a rational approximation by multiplying through by the denominator.
Suppose we have polynomial discrete bases \(\mathbf{P}\) and \(\mathbf{Q}\) and seek a rational approximation of the form
\[\min_{\mathbf{a}, \mathbf{b} \ne \mathbf{0}} \| \mathbf{y} - \textrm{diag}(\mathbf{Q}\mathbf{b})^{-1} \mathbf{P}\mathbf{a}\|_2.\]The linearized approach multiplies through by the denominator to yield the linear least-squares problem
\[\min_{\mathbf{a}, \mathbf{b} \ne \mathbf{0}} \| \textrm{diag}(\mathbf{y})\mathbf{Q} \mathbf{b} - \mathbf{P}\mathbf{a}\|_2.\]Although this is by no means optimal, this yields a cheap, non-iterative rational approximation.
The origin of this algorithm is unclear; Sanathanan and Koerner [SK63] called this approach old in 1963. There has been renewed interest in this approach due to a 2020 paper by Austin et al. [AKL+20] which proposes this approach with a polynomial basis constructed with Vandermonde with Arnoldi (see
ArnoldiPolynomialBasis
). Their precise algorithm uses a slight variant of the above, estimating \(\mathbf{b}\) by a variable projection-like trick:\[ \begin{align}\begin{aligned}\begin{split}\min_{\mathbf{b} \ne \mathbf{0}} \| (\mathbf{I} - \mathbf{P}\mathbf{P}^*) \textrm{diag}(\mathbf{y})\mathbf{Q} \mathbf{b} \|_2;\\\end{split}\\\mathbf{a} = \mathbf{P}^* \textrm{diag}(\mathbf{y})\mathbf{Q} \mathbf{b}.\end{aligned}\end{align} \]This variant is invoked using by setting simultaneous=True.
Parameters: - X (array-like (M, dim)) – Input coordinates to rational approximation
- y (array-like (M,..)) – Output values the rational approximation should try to take
- num_degree (int or list of ints) – degree of the numerator polynomial
- denom_degree (int or list of ints) – degree of the denominator polynomial
- Basis (
PolynomialBasis
) – basis in which to construct the numerator and denominator - simultaneous (bool) – If true, identify the numerator and denominator coefficients by solving one linear system; if false, identfy the denominator coefficients first and then recover the numerator coefficients. The first case is, in general, more numerically stable, but can recover a zero-polynomial in the denominator.
Returns: - numerator (
Polynomial
) – numerator polynomial - denominator (
Polynomial
) – denominator polynomial
-
class
polyrat.
LinearizedRationalApproximation
(num_degree, denom_degree, **kwargs)[source]¶ Construct a rational approximation using a linearized fit
Parameters: - num_degree (int or list of ints) – degree of the numerator polynomial
- denom_degree (int or list of ints) – degree of the denominator polynomial
- **kwargs – Additional keyword arguments are passed to
polyrat.linearized_ratfit()
-
fit
(X, y, weight=None)[source]¶ Construct a rational approximation for the given data
Parameters: - X (array-like (M, dim)) – Input coordinates to rational approximation
- y (array-like (M,..)) – Output values the rational approximation should try to take
- weight (None) – Optional weighting for those methods that support it
Vector Fitting¶
Sanathanan-Koerner Iteration¶
Stabilized Sanathanan-Koerner Iteration¶
Details¶
-
class
polyrat.util.
LinearizedRatfitOperator
(P, Q, Y)[source]¶ A linear operator in many Sanathanan-Koerner style algorithms for array-valued problems.
Many algorithms that solve rational approximation by “linearizing” by multiplying through the denominator. In the scalar-valued case this yields an minimization problem
\[\begin{split}\min_{\mathbf{a}, \mathbf{b} \ne \mathbf{0} } \left\| \begin{bmatrix} \mathbf{P} & -\textrm{diag}(\mathbf{y}) \mathbf{Q} \end{bmatrix} \begin{bmatrix} \mathbf{a} \\ \mathbf{b} \end{bmatrix} \right\|_2.\end{split}\]As \(\mathbf{P}\) and \(\mathbf{Q}\) are dense, we simply solve this problem using a dense SVD.
In the array-valued setting, we need to solve a larger, sparse system
\[\begin{split}\min_{\mathbf{a}^{(1)}, \mathbf{a}^{(2)}, \ldots, \mathbf{a}^{(N)}, \mathbf{b}} \left\| \begin{bmatrix} \mathbf{P} & & & & -\textrm{diag}(\mathbf{y}^{(1)}) \mathbf{Q} \\ & \mathbf{P} & & & -\textrm{diag}(\mathbf{y}^{(2)}) \mathbf{Q} \\ & & \ddots & & \vdots \\ & & & \mathbf{P} & -\textrm{diag}(\mathbf{y}^{(N)}) \mathbf{Q} \end{bmatrix} \begin{bmatrix} \mathbf{a}^{(1)} \\ \mathbf{a}^{(2)} \\ \vdots \\ \mathbf{a}^{(N)} \\ \mathbf{b} \end{bmatrix} \right\|_2.\end{split}\]This class implements a
LinearOperator
representing this block sparse matrix for use with iterative SVD algorithms.Parameters: