solve()#
- Mfr.solve(x0: ~numpy.ndarray | None = None, derivative_weights: ~collections.abc.Collection[float] | None = None, eps: float = 1e-06, tol: float = 0.001, miter: int = 4, regularizer: ~typing.Type[~cherab.inversion.core._SVDBase] = <class 'cherab.inversion.lcurve.Lcurve'>, store_regularizers: bool = False, path: str | ~pathlib.Path | None = None, use_gpu: bool = False, dtype=None, verbose: bool = False, spinner: bool = True, **kwargs) tuple[ndarray | None, dict]Source#
Solve the inverse problem using MFR scheme.
MFR is an iterative scheme that combines Singular Value Decomposition (SVD) and a optimizer to find the optimal regularization parameter.
The detailed workflow of the MFR scheme is described in MFR theory.
- Parameters:
- x0(
N, )array,optional Initial solution vector, by default ones vector.
- derivative_weights
Collection[float],optional Allows to specify anisotropy by assigning weights for each matrix, by default ones vector.
- eps
float,optional Small number to avoid division by zero, by default 1e-6.
- tol
float,optional Tolerance for solution convergence, by default 1e-3.
- miter
int,optional Maximum number of MFR iterations, by default 4.
- regularizer
Type[_SVDBase],optional Regularizer class to use, by default
Lcurve.- store_regularizersbool,
optional If True, store regularizer objects at each iteration, by default False. The path to store regularizer objects can be specified using
pathargument.- path
strorPath,optional Directory path to store regularizer objects, by default None. If
pathis None, the regularizer objects will be stored in the current directory ifstore_regularizersis True.- use_gpubool,
optional Same as
compute_svd’suse_gpuargument, by default False.- dtype
strornumpydtype,optional Same as
compute_svd’sdtypeargument, by default numpy.float64.- verbosebool,
optional If True, print iteration information regarding SVD computation, by default False.
- spinnerbool,
optional If True, show spinner during the computation, by default True.
- **kwargs
dict,optional Additional keyword arguments passed to the regularizer class’s
solvemethod.
- x0(
- Returns:
- x(
N, )arrayorNone Optimal solution vector \(\mathbf{x}\) found by the MFR scheme. If the unintended error occurs during the first MFR iteration, the solution will be None.
- status
dict[str,Any] Dictionary containing the following keys: -
elapsed_time: elapsed time for the inversion calculation. -niter: number of iterations. -diffs: list of differences between the current and previous solutions. -converged: boolean value indicating the convergence. -regularizer: regularizer object.
- x(
Examples
>>> x, status = mfr.solve()