scimba_torch.numerical_solvers.preconditioner_pinns¶
Preconditioners for pinns.
Classes
| 
 | Anagram preconditioner. | 
| 
 | Energy-based natural gradient preconditioner. | 
| 
 | Matrix-based preconditioner for pinns. | 
- class MatrixPreconditionerPinn(space, pde, **kwargs)[source]¶
- Bases: - MatrixPreconditionerSolver- Matrix-based preconditioner for pinns. - Parameters:
- space ( - AbstractApproxSpace) – The approximation space.
- pde ( - EllipticPDE|- TemporalPDE|- KineticPDE|- LinearOrder2PDE) – The PDE to be solved.
- **kwargs – - Additional keyword arguments: - in_lhs_name: Name of the operator to be used in the left-hand side assembly. (default: “functional_operator”) 
 
 
 
- class EnergyNaturalGradientPreconditioner(space, pde, is_operator_linear=False, **kwargs)[source]¶
- Bases: - MatrixPreconditionerPinn- Energy-based natural gradient preconditioner. - Parameters:
- space ( - AbstractApproxSpace) – The approximation space.
- pde ( - EllipticPDE|- TemporalPDE|- KineticPDE|- LinearOrder2PDE) – The PDE to be solved, which can be an instance of EllipticPDE, TemporalPDE, KineticPDE, or LinearOrder2PDE.
- is_operator_linear ( - bool) – Whether the operator is linear (default: False).
- **kwargs – - Additional keyword arguments: - matrix_regularization: Regularization parameter for the preconditioning matrix (default: 1e-6). 
 
 
 - eval_and_jactheta(*args)[source]¶
- Evaluate the Jacobian of the network with respect to its parameters. - Parameters:
- *args ( - Tensor|- dict[- str,- Parameter]) – Arguments to be passed to the network, with the last argument being the parameters of the network.
- Return type:
- Tensor
- Returns:
- The Jacobian matrix of the network with respect to its parameters. 
 
 - eval_and_jactheta_and_func(func, *args)[source]¶
- Evaluate the Jacobian of a given function. - With respect to the network parameters. - Parameters:
- func ( - Callable) – The function whose Jacobian is to be computed.
- *args ( - Tensor|- dict[- str,- Parameter]) – Arguments to be passed to the function, with the last argument being the parameters of the network.
 
- Return type:
- Tensor
- Returns:
- The Jacobian matrix of the function with respect to the network parameters.s 
 
 - compute_preconditioning_matrix(labels, *args, **kwargs)[source]¶
- Compute the preconditioning matrix using the main operator. - Parameters:
- labels ( - Tensor) – The labels tensor.
- *args ( - Tensor) – Additional arguments.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The preconditioning matrix. 
 
 - compute_preconditioning_matrix_bc(labels, *args, **kwargs)[source]¶
- Compute the boundary condition preconditioning matrix. - Parameters:
- labels ( - Tensor) – The labels tensor.
- *args ( - Tensor) – Additional arguments.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The boundary condition preconditioning matrix. 
 
 - compute_preconditioning_matrix_ic(labels, *args, **kwargs)[source]¶
- Compute the initial condition preconditioning matrix. - Parameters:
- labels ( - Tensor) – The labels tensor.
- *args ( - Tensor) – Additional arguments.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The initial condition preconditioning matrix. 
 
 - compute_full_preconditioning_matrix(data, **kwargs)[source]¶
- Compute the full preconditioning matrix. - Include contributions from the main operator, boundary conditions, and initial conditions. - Parameters:
- data ( - tuple|- dict) – Input data, either as a tuple or a dictionary.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The full preconditioning matrix. 
 
 
- class AnagramPreconditioner(space, pde, **kwargs)[source]¶
- Bases: - MatrixPreconditionerPinn- Anagram preconditioner. - This preconditioner is based on the anagram method, which aims to improve convergence by transforming the problem into a more favorable form. - Parameters:
- space ( - AbstractApproxSpace) – The approximation space.
- pde ( - EllipticPDE|- TemporalPDE|- KineticPDE|- LinearOrder2PDE) – The PDE to be solved, which can be an instance of EllipticPDE, TemporalPDE, KineticPDE, or LinearOrder2PDE.
- **kwargs – - Additional keyword arguments: - svd_threshold ( - float): Threshold for singular value decomposition (default: 1e-6).
- bc_weight ( - float): Weight for boundary condition contributions (default: 1.0).
- ic_weight ( - float): Weight for initial condition contributions (default: 1.0).
 
 
- Raises:
- AttributeError – If the residual_size, bc_residual_size, or ic_residual_size attributes are not integers. 
 - compute_preconditioning_matrix(labels, *args, **kwargs)[source]¶
- Compute the preconditioning matrix using the main operator. - Parameters:
- labels ( - Tensor) – The labels tensor.
- *args ( - Tensor) – Additional arguments.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The preconditioning matrix. 
 
 - compute_preconditioning_matrix_bc(labels, *args, **kwargs)[source]¶
- Compute the boundary condition preconditioning matrix. - Parameters:
- labels ( - Tensor) – The labels tensor.
- *args ( - Tensor) – Additional arguments.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The boundary condition preconditioning matrix. 
 
 - compute_preconditioning_matrix_ic(labels, *args, **kwargs)[source]¶
- Compute the initial condition preconditioning matrix. - Parameters:
- labels ( - Tensor) – The labels tensor.
- *args ( - Tensor) – Additional arguments.
- **kwargs – Additional keyword arguments. 
 
- Return type:
- Tensor
- Returns:
- The initial condition preconditioning matrix. 
 
 - assemble_right_member(data, res_l, res_r)[source]¶
- Assemble the right-hand side of the equation. - Parameters:
- data ( - tuple|- dict) – Input data, either as a tuple or a dictionary.
- res_l ( - tuple) – Left residuals.
- res_r ( - tuple) – Right residuals.
 
- Return type:
- Tensor
- Returns:
- The assembled right-hand side tensor. 
 
 - assemble_right_member_bc(data, res_l, res_r)[source]¶
- Assemble the right-hand side for boundary conditions. - Parameters:
- data ( - tuple|- dict) – Input data, either as a tuple or a dictionary.
- res_l ( - tuple) – Left residuals.
- res_r ( - tuple) – Right residuals.
 
- Return type:
- Tensor
- Returns:
- The assembled right-hand side tensor for boundary conditions. 
 
 - assemble_right_member_ic(data, res_l, res_r)[source]¶
- Assemble the right-hand side for initial conditions. - Parameters:
- data ( - tuple|- dict) – Input data, either as a tuple or a dictionary.
- res_l ( - tuple) – Left residuals.
- res_r ( - tuple) – Right residuals.
 
- Return type:
- Tensor
- Returns:
- The assembled right-hand side tensor for initial conditions.