pymor.reductors.aaa
¶
Module Contents¶
- class pymor.reductors.aaa.PAAAReductor(sampling_values, samples_or_fom, conjugate=True, nsp_tol=1e-16, post_process=True, L_rk_tol=1e-08)[source]¶
Bases:
pymor.core.base.BasicObject
Reductor implementing the parametric AAA algorithm.
The reductor implements the parametric AAA algorithm and can be used either with data or a given full-order model, which can be a
TransferFunction
or any model which has atransfer_function
attribute. MIMO and non-parametric data is accepted. See [NSeteT18] for the non-parametric and [CRBG23] for the parametric version of the algorithm. The reductor computes approximations based on the multivariate barycentric form \(H(s,p,...)\) (seemake_bary_func
), where the inputs \(s,p,...\) are referred to as the variables. Further, \(s\) is the Laplace variable and \(p\) as well as other remaining inputs are parameters.Note
The dimension of the Loewner matrix which will be assembled in the algorithm has
len(sampling_values[0])*...*len(sampling_values[-1])
rows. This reductor should only be used with a low number of variables.Parameters
- sampling_values
Values where sample data has been evaluated or the full-order model should be evaluated. Sampling values are represented as a list of
NumPy arrays
such thatsampling_values[i]
corresponds to sampling values of thei
-th variable given as aNumPy array
. The first variable is the Laplace variable. In the non-parametric case (i.e., the only variable is the Laplace variable) this can also be aNumPy array
representing the sampling values.- samples_or_fom
Can be either a full-order model (
TransferFunction
orModel
with atransfer_function
attribute) or data sampled at the values specified insampling_values
as aNumPy array
. Samples are represented as a tensorS
. E.g., for 3 inputsS[i,j,k]
corresponds to the sampled value at(sampling_values[0][i],sampling_values[1][j],sampling_values[2][k])
. The samples (i.e.,S[i,j,k]
) need to be provided as 2-dimensionalNumPy arrays
. E.g., in the MIMO caseS[i,j,k]
represents a matrix of dimensiondim_output
timesdim_input
.- conjugate
Whether to compute complex conjugates of first sampling variables and enforce interpolation in complex conjugate pairs (allows for constructing real system matrices).
- nsp_tol
Tolerance for null space of higher-dimensional Loewner matrix to check for interpolation or convergence.
- post_process
Whether to do post-processing or not. If the Loewner matrix has a null space of dimension greater than 1, it is assumed that the algorithm converged to a non-minimal order interpolant which may cause numerical issues. In this case, the post-processing procedure computes an interpolant of minimal order.
- L_rk_tol
Tolerance for ranks of 1-D Loewner matrices computed in post-processing.
- itpl_part[source]¶
A nested list such that
itpl_part[i]
corresponds to indices of interpolated values with respect to thei
-th variable. I.e.,self.sampling_values[i][itpl_part[i]]
represents a list of all interpolated samples of thei
-th variable.
Methods
Reduce using p-AAA.
- reduce(tol=1e-07, itpl_part=None, max_itpl=None)[source]¶
Reduce using p-AAA.
Parameters
- tol
Convergence tolerance for relative error of
rom
over the set of samples.- itpl_part
Initial partition for interpolation values. Should be
None
or a nested list such thatitpl_part[i]
corresponds to indices of interpolated values with respect to thei
-th variable. I.e.,self.sampling_values[i][itpl_part[i]]
represents a list of all initially interpolated samples of thei
-th variable. IfNone
p-AAA will start with no interpolated values.- max_itpl
Maximum number of interpolation points to use with respect to each variable. Should be
None
or a list such thatself.num_vars == len(max_itpl)
. IfNone
max_itpl[i]
will be set tolen(self.sampling_values[i]) - 1
.
Returns
- rom
Reduced
TransferFunction
model.
- pymor.reductors.aaa.full_nd_loewner(samples, svs, itpl_part)[source]¶
Compute higher-dimensional Loewner matrix using all combinations of partitions.
Note
For non-parametric data this is simply the regular Loewner matrix.
Parameters
- samples
Tensor of samples (see
PAAAReductor
).- svs
List of sampling values (see
PAAAReductor
).- itpl_part
Nested list such that
itpl_part[i]
is a list of indices for interpolated sampling values insvs[i]
.
Returns
- L
(Parametric) Loewner matrix based on all combinations of partitions.
- pymor.reductors.aaa.make_bary_func(itpl_nodes, itpl_vals, coefs, removable_singularity_tol=1e-14)[source]¶
Return function for (multivariate) barycentric form.
The multivariate barycentric form for two variables is given by
\[H(s,p) = \frac{\sum_{i=1}^{k}\sum_{j=1}^{q}\frac{\alpha_{ij}H(s_i,p_j)}{(s-s_i)(p-p_j)}} {\sum_{i=1}^{k}\sum_{j=1}^{q}\frac{\alpha_{ij}}{(s-s_i)(p-p_j)}}\]where for \(i=1,\ldots,k\) and \(j=1,\ldots,q\) we have that \(s_i\) and \(p_j\) are interpolation nodes, \(H(s_i,p_j)\) are interpolation values and \(\alpha_{ij}\) represent the barycentric coefficients. This implementation can also handle single-variable barycentric forms as well as barycentric forms with more than two variables.
Parameters
- itpl_nodes
Nested list such that
itpl_nodes[i]
contains interpolation nodes of thei
-th variable.- itpl_vals
Vector of interpolation values with
len(itpl_nodes[0])*...*len(itpl_nodes[-1])
entries.- coefs
Vector of barycentric coefficients with
len(itpl_nodes[0])*...*len(itpl_nodes[-1])
entries.- removable_singularity_tol
Tolerance for evaluating the barycentric function at a removable singularity and performing pole cancellation.
Returns
- bary_func
(Multi-variate) rational function in barycentric form.
- pymor.reductors.aaa.nd_loewner(samples, svs, itpl_part)[source]¶
Compute higher-dimensional Loewner matrix using only LS partitions.
Note
For non-parametric data this is simply the regular Loewner matrix.
Parameters
- samples
Tensor of samples (see
PAAAReductor
).- svs
List of sampling values (see
PAAAReductor
).- itpl_part
Nested list such that
itpl_part[i]
is a list of indices for interpolated sampling values insvs[i]
.
Returns
- L
(Parametric) Loewner matrix based only on LS partition.