System Equation#

class SystemEquation(list_equation, reduction=None)[source]#

Bases: EquationInterface

Implementation of the System of Equations. Every equation passed to a Condition object must be either a Equation or a SystemEquation instance.

Initialization of the SystemEquation class.

Parameters:
  • equation (Callable) – A torch callable function used to compute the residual of a mathematical equation.

  • reduction (str) – The reduction method to aggregate the residuals of each equation. Available options are: None, mean, sum, callable. If None, no reduction is applied. If mean, the output sum is divided by the number of elements in the output. If sum, the output is summed. callable is a user-defined callable function to perform reduction, no checks guaranteed. Default is None.

Raises:

NotImplementedError – If the reduction is not implemented.

residual(input_, output_, params_=None)[source]#

Compute the residual for each equation in the system of equations and aggregate it according to the reduction specified in the __init__ method.

Parameters:
  • input (LabelTensor) – Input points where each equation of the system is evaluated.

  • output (LabelTensor) – Output tensor, eventually produced by a torch.nn.Module instance.

  • params (dict) – Dictionary of unknown parameters, associated with a InverseProblem instance. If the equation is not related to a InverseProblem instance, the parameters must be initialized to None. Default is None.

Returns:

The aggregated residuals of the system of equations.

Return type:

LabelTensor