scimba_torch.numerical_solvers.preconditioner_deep_ritz¶
Deep Ritz preconditioners.
Classes
|
Energy Natural Gradient preconditioner for Deep Ritz methods. |
|
Matrix-based preconditioner for pinns. |
- class MatrixPreconditionerDeepRitz(space, pde, **kwargs)[source]¶
Bases:
MatrixPreconditionerSolverMatrix-based preconditioner for pinns.
- Parameters:
space (
AbstractApproxSpace) – The approximation space.pde (
RitzFormEllipticPDE|DivAGradUPDE) – The PDE to be solved.**kwargs – Additional keyword arguments.
- Raises:
AttributeError – If the input PDE does not have the required attributes.
- vectorize_along_physical_variables(func)[source]¶
Vectorizes a function along physical variables based on the type of space.
- Parameters:
func (
VarArgAnyCallable) – The function to be vectorized.- Return type:
- Returns:
The vectorized function.
- Raises:
NotImplementedError – If the type of space is not supported.
- class EnergyNaturalGradientPreconditioner(space, pde, **kwargs)[source]¶
Bases:
MatrixPreconditionerDeepRitzEnergy Natural Gradient preconditioner for Deep Ritz methods.
- Parameters:
space (
AbstractApproxSpace) – The approximation space used in the Deep Ritz method.pde (
RitzFormEllipticPDE|DivAGradUPDE) – The elliptic PDE represented as an instance of RitzForm_Elliptic**kwargs – Additional keyword arguments.
- Raises:
ValueError – If the number of unknowns in the space is greater than 1.
- eval_and_gradx(*args)[source]¶
Evaluate the function and compute its gradient.
- Parameters:
*args (
Tensor|dict[str,Parameter]) – Input arguments where the last argument is the parameters of the network.- Returns:
A tensor containing the function evaluation and its gradient.
- eval_and_gradx_and_jactheta(*args)[source]¶
Evaluate the function, compute its gradient, and the Jacobian.
- Parameters:
*args (
Tensor|dict[str,Parameter]) – Input arguments where the last argument is the parameters of the network.- Returns:
A tensor containing the function evaluation, its gradient, and the Jacobian
- compute_preconditioning_matrix(labels, *args, **kwargs)[source]¶
Compute the preconditioning matrix.
- Parameters:
labels (
Tensor) – Tensor of labels corresponding to the input data.*args (
Tensor) – Additional arguments required for computing the matrix.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
The computed preconditioning matrix as a tensor.
- compute_preconditioning_matrix_bc(labels, *args, **kwargs)[source]¶
Compute the boundary condition preconditioning matrix.
- Parameters:
labels (
Tensor) – Tensor of labels corresponding to the boundary condition data.*args (
Tensor) – Additional arguments required for computing the matrix.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
The computed boundary condition preconditioning matrix as a tensor.
- compute_preconditioning_matrix_ic(labels, *args, **kwargs)[source]¶
Compute the initial condition preconditioning matrix.
- Parameters:
labels (
Tensor) – Tensor of labels corresponding to the boundary condition data.*args (
Tensor) – Additional arguments required for computing the matrix.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
NotImplementedError.