Skip to main content

math:compute residual and error

Version: 0.0.0

Description

Computes the Lp-norm of a field or a field container. When a second entry is provided, the residual (the difference between the first and second entry) is calculated along with the error as the Lp-norm of the difference. When a second input is not provided, the calculation is only completed for the first entry. The type of calculation performed is based on the specifications provided for pin 1, pin 2 defines the type of error norm (L1 vs L2), and pin 3 which entity to use as a reference

Inputs

InputNameExpected type(s)Description
Pin 0
Required
field_or_fields_container1field, fields_containerfield or fields container - compulsory
Pin 1normalization_typeint32type of normalization applied to the residuals and norm calculation (optional, defaut: absolute):
0 for absolute,
1 for relative to the first entry,
2 for normalized by the max of each field of the first entry or residuals depending on the reference field option,
3 for normalized by the max over all fields of the first entry or residuals depending on the reference field option
Pin 2norm_calculation_typeint32type for norm calculation (optional, default: L2) - It is normalized depending on Pin2 selection
1 for L1, ie sum(abs(xi)),
2 for L2, ie sqrt(sum((xi^2))
Pin 3field_referenceint32Field reference for the normalization step, default: 0 for entry 1, 1 for residuals - optional
Pin 4field_or_fields_container2field, fields_containerfield or fields container of same dimensionality as entry 1 - optional

Outputs

OutputNameExpected type(s)Description
Pin 0residualsfield, fields_container0: normalized residuals (aka field 1 - field 2) as a field or field container, normalized depending on the normalization type
Pin 1errorfield, fields_container1: error as a field or a field container depending on the entry's type.
Pin 2residuals_normalization_factorfield, fields_container2: factor used for residual normalization
Pin 3error_normalization_factorfield, fields_container3: factor used for error norm normalization

Configurations

NameExpected type(s)Default valueDescription
mutexboolfalseIf this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads.
permissivebooltrueIf this option is set to true, warning checks (like unit or data sizes) won't be done.

Scripting

Category: math

Plugin: core

Scripting name: compute_residual_and_error

Full name: math.compute_residual_and_error

Internal name: error_norm_calc

License: None

Changelog

  • Version 0.0.0: Initial release.