regularization_matrix()#
- Mfr.regularization_matrix(x: ndarray, eps: float = 1e-06, derivative_weights: Collection[float] | None = None) csc_matrixSource#
Compute nonlinear regularization matrix from provided derivative matrices and a solution vector.
Multiple derivative matrices can be used allowing to combine matrices computed by different numerical schemes.
Each matrix can have different weight coefficients assigned to introduce anisotropy.
The expression of the regularization matrix \(\mathbf{H}(\mathbf{x})\) with a solution vector \(\mathbf{x}\) is:
\[\mathbf{H}(\mathbf{x}) = \sum_{\mu,\nu} \alpha_{\mu\nu} \mathbf{D}_\mu^\mathsf{T} \mathbf{W}(\mathbf{x}) \mathbf{D}_\nu\]where \(\mathbf{D}_\mu\) and \(\mathbf{D}_\nu\) are derivative matrices along to \(\mu\) and \(\nu\) directions, respectively, \(\alpha_{\mu\nu}\) is the anisotropic coefficient, and \(\mathbf{W}\) is the diagonal weight matrix defined as the inverse of \(\mathbf{x}_i\):
\[\left[\mathbf{W}\right]_{ij} = \frac{\delta_{ij}}{ \max\left(\mathbf{x}_i, \epsilon_0\right) },\]where \(\delta_{ij}\) is the Kronecker delta, \(\mathbf{x}_i\) is the \(i\)-th element of the solution vector \(\mathbf{x}\), and \(\epsilon_0\) is a small umber to avoid division by zero and to push the solution to be positive.
- Parameters:
- x(
N, )array Solution vector \(\mathbf{x}\).
- eps
float,optional Small number \(\epsilon_0\) to avoid division by zero, by default 1.0e-6.
- derivative_weights
Collection[float],optional Allows to specify anisotropy by assigning weights \(\alpha_{ij}\) for each matrix, by default ones vector (\(\alpha_{ij}=1\) for all matrices).
- x(
- Returns:
scipy.sparse.csc_matrixRegularization matrix \(\mathbf{H}(\mathbf{x})\).