scimba_torch.numerical_solvers.pinn_preconditioners.anagram_ng

Preconditioner for pinns.

Classes

AnagramPreconditioner(space, pde, **kwargs)

Anagram preconditioner.

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:
Keyword Arguments:

svd_threshold (float) – Threshold for singular value decomposition (default: 1e-6).

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_preconditioning_matrix_dl(*args, **kwargs)[source]

Computes the Gram matrix of the network for the given input tensors.

Parameters:
  • *args (Tensor) – Input tensors for computing the Gram matrix.

  • **kwargs – Additional keyword arguments.

Return type:

Tensor

Returns:

The computed Gram 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.

assemble_right_member_dl(data, res_l, res_r)[source]

Assembles the right member for the preconditioning.

Parameters:
  • data (tuple | dict) – The input data for assembling the right member.

  • res_l (tuple) – The left residuals.

  • res_r (tuple) – The right residuals.

Return type:

Tensor

Returns:

The assembled right member.