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_weightsCollection[float], optional

Allows to specify anisotropy by assigning weights for each matrix, by default ones vector.

epsfloat, optional

Small number to avoid division by zero, by default 1e-6.

tolfloat, optional

Tolerance for solution convergence, by default 1e-3.

miterint, optional

Maximum number of MFR iterations, by default 4.

regularizerType[_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 path argument.

pathstr or Path, optional

Directory path to store regularizer objects, by default None. If path is None, the regularizer objects will be stored in the current directory if store_regularizers is True.

use_gpubool, optional

Same as compute_svd’s use_gpu argument, by default False.

dtypestr or numpy dtype, optional

Same as compute_svd’s dtype argument, 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.

**kwargsdict, optional

Additional keyword arguments passed to the regularizer class’s solve method.

Returns:
x(N, ) array or None

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.

statusdict[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.

Examples

>>> x, status = mfr.solve()