scimba_torch.numerical_solvers.preconditioner_solvers¶
Matrix preconditioner for solvers.
Functions
|
Default pre-processing function that concatenates input tensors. |
|
Identity functional operator that directly calls the input function. |
Classes
|
Matrix-based preconditioner solver. |
- functional_operator_id(func, *args)[source]¶
Identity functional operator that directly calls the input function.
- Parameters:
func (
VarArgAnyCallable) – The function to be called.*args (
Tensor|dict[str,Parameter]) – Arguments to be passed to the function.
- Return type:
Tensor- Returns:
The result of calling the input function with the provided arguments.
- default_pre_processing(*args)[source]¶
Default pre-processing function that concatenates input tensors.
- Parameters:
*args (
Tensor) – Input tensors to be concatenated.- Return type:
Tensor- Returns:
The concatenated tensor.
- class MatrixPreconditionerSolver(space, pde, **kwargs)[source]¶
Bases:
AbstractPreconditionerMatrix-based preconditioner solver.
- Parameters:
space (
AbstractApproxSpace) – The approximation space.pde (
EllipticPDE|TemporalPDE|KineticPDE|LinearOrder2PDE|RitzFormEllipticPDE|DivAGradUPDE) – The PDE to be solved.**kwargs –
Additional keyword arguments:
functional_post_processing: A function to be applied after the main processing.
functional_pre_processing: A function to be applied before the main processing.
- abstract compute_preconditioning_matrix(labels, *args, **kwargs)[source]¶
Abstract method for computing the preconditioning matrix.
- Parameters:
labels (
Tensor) – The labels tensor.*args (
Tensor) – Additional arguments.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
The preconditioning matrix.
- abstract compute_preconditioning_matrix_bc(labels, *args, **kwargs)[source]¶
Abstract method for computing 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.
- abstract compute_preconditioning_matrix_ic(labels, *args, **kwargs)[source]¶
Abstract method for computing 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.
- get_args_for_operator(data, **kwargs)[source]¶
Get arguments for the main operator based on the type of space.
- Parameters:
data (
tuple[LabelTensor,...] |dict[str,tuple[LabelTensor,...]]) – Input data, either as a tuple or a dictionary.**kwargs – Additional keyword arguments.
- Return type:
list[Tensor]- Returns:
A list of tensors to be used as arguments for the operator.
- Raises:
NotImplementedError – If the type_space is ‘phase_space’.
- get_preconditioning_matrix(data, **kwargs)[source]¶
Get the preconditioning matrix using the main operator.
- Parameters:
data (
tuple[LabelTensor,...] |dict[str,tuple[LabelTensor,...]]) – Input data, either as a tuple or a dictionary.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
The preconditioning matrix.
- get_args_for_operator_bc(data, **kwargs)[source]¶
Get arguments for the boundary condition operator based on the type of space.
- Parameters:
data (
tuple[LabelTensor,...] |dict[str,tuple[LabelTensor,...]]) – Input data, either as a tuple or a dictionary.**kwargs – Additional keyword arguments.
- Return type:
list[Tensor]- Returns:
A list of tensors to be used as arguments for the boundary condition operator.
- Raises:
NotImplementedError – If the type_space is ‘phase_space’.
- get_preconditioning_matrix_bc(data, **kwargs)[source]¶
Get the preconditioning matrix using the boundary condition operator.
- Parameters:
data (
tuple[LabelTensor,...] |dict[str,tuple[LabelTensor,...]]) – Input data, either as a tuple or a dictionary.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
The preconditioning matrix.
- get_args_for_operator_ic(data, **kwargs)[source]¶
Get arguments for the initial condition operator based on the type of space.
- Parameters:
data (
tuple[LabelTensor,...] |dict[str,tuple[LabelTensor,...]]) – Input data, either as a tuple or a dictionary.**kwargs – Additional keyword arguments.
- Return type:
list[Tensor]- Returns:
A list of tensors to be used as arguments for the initial condition operator.
- Raises:
ValueError – If the type_space is ‘space’.
NotImplementedError – If the type_space is ‘phase_space’.
- get_preconditioning_matrix_ic(data, **kwargs)[source]¶
Get the preconditioning matrix using the initial condition operator.
- Parameters:
data (
tuple[LabelTensor,...] |dict[str,tuple[LabelTensor,...]]) – Input data, either as a tuple or a dictionary.**kwargs – Additional keyword arguments.
- Return type:
Tensor- Returns:
The preconditioning matrix.
- vectorize_along_physical_variables(dict_of_funcs)[source]¶
Vectorize functions along physical variables based on the type of space.
- Parameters:
dict_of_funcs (
OrderedDict[int|tuple[int],VarArgAnyCallable]) – A dictionary of functions to be vectorized.- Return type:
OrderedDict[int|tuple[int],VarArgAnyCallable]- Returns:
A dictionary of vectorized functions.
- Raises:
NotImplementedError – If the type_space is ‘phase_space’.
- vectorize_along_physical_variables_bc(dict_of_funcs)[source]¶
Vectorize functions along physical variables for boundary conditions.
- Parameters:
dict_of_funcs (
OrderedDict[int|tuple[int],VarArgAnyCallable]) – A dictionary of functions to be vectorized.- Return type:
OrderedDict[int|tuple[int],VarArgAnyCallable]- Returns:
A dictionary of vectorized functions.
- Raises:
NotImplementedError – If the type_space is ‘phase_space’.
- vectorize_along_physical_variables_ic(dict_of_funcs)[source]¶
Vectorize functions along physical variables for initial conditions.
- Parameters:
dict_of_funcs (
OrderedDict[int|tuple[int],VarArgAnyCallable]) – A dictionary of functions to be vectorized.- Return type:
OrderedDict[int|tuple[int],VarArgAnyCallable]- Returns:
A dictionary of vectorized functions.
- Raises:
NotImplementedError – If the type_space is ‘phase_space’.
ValueError – If the type_space is ‘space’.
- get_formatted_current_theta()[source]¶
Get the current parameters of the approximation space.
- Return type:
dict[str,Parameter]- Returns:
A dictionary of the current parameters of the approximation space.
- eval_network(*args)[source]¶
Evaluate the network with pre-processing.
- 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 output of the network after applying pre-processing.
- eval_func(*args)[source]¶
Evaluate the network with pre-processing and post-processing.
- 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 output of the network after applying pre-processing and post-processing.