# 14.12. Checking algorithm “*TangentTest*”¶

## 14.12.1. Description¶

This algorithm allows to check the quality of the tangent operator, by calculating a residue whose theoretical properties are known. The test is applicable to any operator, of evolution or observation.

For all formulas, with the current verification point, we
take and
with a scaling user
parameter, defaulting to 1. is the computational operator or code
(which is here defined by the observation operator command
“*ObservationOperator*”).

One can observe the following residue, which is the comparison of increments using the tangent linear operator:

which has to remain stable in until the calculation precision is reached.

When is less or equal to a stable value when is varying, the tangent is valid, until the calculation precision is reached.

If is really small, the calculation code is almost linear or quasi-linear (which can be verified by the Checking algorithm “LinearityTest”), and the tangent is valid until the calculation precision is reached.

## 14.12.2. Optional and required commands¶

The general required commands, available in the editing user graphical or textual interface, are the following:

- CheckingPoint
*Vector*. The variable indicates the vector used as the state around which to perform the required check, noted and similar to the background . It is defined as a “*Vector*” or “*VectorSerie*” type object. Its availability in output is conditioned by the boolean “*Stored*” associated with input.

- ObservationOperator
*Operator*. The variable indicates the observation operator, usually noted as , which transforms the input parameters to results to be compared to observations . Its value is defined as a “*Function*” type object or a “*Matrix*” type one. In the case of “*Function*” type, different functional forms can be used, as described in the section Requirements for functions describing an operator. If there is some control included in the observation, the operator has to be applied to a pair .

The general optional commands, available in the editing user graphical or
textual interface, are indicated in List of commands and keywords for an ADAO checking case.
Moreover, the parameters of the command “*AlgorithmParameters*” allow to choose
the specific options, described hereafter, of the algorithm. See
Description of options of an algorithm by “AlgorithmParameters” for the good use of this
command.

The options are the following:

- AmplitudeOfInitialDirection
*Real value*. This key indicates the scaling of the initial perturbation build as a vector used for the directional derivative around the nominal checking point. The default is 1, that means no scaling.Example:

`{"AmplitudeOfInitialDirection":0.5}`

- AmplitudeOfTangentPerturbation
*Real value*. This key indicates the relative numerical magnitude of the perturbation used to estimate the tangent value of the operator at the evaluation point, i.e. its directional derivative. The conservative default is 1.e-2 i.e. 1%, and it is strongly recommended to adapt it to the needs of real problems, by decreasing its value by several orders of magnitude.Example :

`{"AmplitudeOfTangentPerturbation":1.e-2}`

- EpsilonMinimumExponent
*Integer value*. This key indicates the minimal exponent value of the power of 10 coefficient to be used to decrease the increment multiplier. The default is -8, and it has to be negative between 0 and -20. For example, its default value leads to calculate the residue of the scalar product formula with a fixed increment multiplied from 1.e0 to 1.e-8.Example:

`{"EpsilonMinimumExponent":-12}`

- InitialDirection
*Vector*. This key indicates the vector direction used for the directional derivative around the nominal checking point. It has to be a vector of the same vector size than the checking point. If not specified, this direction defaults to a random perturbation around zero of the same vector size than the checking point.Example:

`{"InitialDirection":[0.1,0.1,100.,3}`

for a state space of dimension 4

- NumberOfPrintedDigits
*Integer value*. This key indicates the number of digits of precision for floating point printed output. The default is 5, with a minimum of 0.Example:

`{"NumberOfPrintedDigits":5}`

- SetSeed
*Integer value*. This key allow to give an integer in order to fix the seed of the random generator used in the algorithm. By default, the seed is left uninitialized, and so use the default initialization from the computer, which then change at each study. To ensure the reproducibility of results involving random samples, it is strongly advised to initialize the seed. A simple convenient value is for example 123456789. It is recommended to put an integer with more than 6 or 7 digits to properly initialize the random generator.Example:

`{"SetSeed":123456789}`

- StoreSupplementaryCalculations
*List of names*. This list indicates the names of the supplementary variables, that can be available during or at the end of the algorithm, if they are initially required by the user. Their availability involves, potentially, costly calculations or memory consumptions. The default is then a void list, none of these variables being calculated and stored by default (excepted the unconditional variables). The possible names are in the following list (the detailed description of each named variable is given in the following part of this specific algorithmic documentation, in the sub-section “*Information and variables available at the end of the algorithm*”): [ “CurrentState”, “Residu”, “SimulatedObservationAtCurrentState”, ].Example :

`{"StoreSupplementaryCalculations":["CurrentState", "Residu"]}`

## 14.12.3. Information and variables available at the end of the algorithm¶

At the output, after executing the algorithm, there are information and
variables originating from the calculation. The description of
Variables and information available at the output show the way to obtain them by the method
named `get`

, of the variable “*ADD*” of the post-processing in graphical
interface, or of the case in textual interface. The input variables, available
to the user at the output in order to facilitate the writing of post-processing
procedures, are described in the Inventory of potentially available information at the output.

**Permanent outputs (non conditional)**

The unconditional outputs of the algorithm are the following:

- Residu
*List of values*. Each element is the value of the particular residue checked during the running of the algorithm, in the order of the tests.Example:

`r = ADD.get("Residu")[:]`

**Set of on-demand outputs (conditional or not)**

The whole set of algorithm outputs (conditional or not), sorted by alphabetical order, is the following:

- CurrentState
*List of vectors*. Each element is a usual state vector used during the iterative algorithm procedure.Example:

`xs = ADD.get("CurrentState")[:]`

- Residu
*List of values*. Each element is the value of the particular residue checked during the running of the algorithm, in the order of the tests.Example:

`r = ADD.get("Residu")[:]`

- SimulatedObservationAtCurrentState
*List of vectors*. Each element is an observed vector simulated by the observation operator from the current state, that is, in the observation space.Example:

`hxs = ADD.get("SimulatedObservationAtCurrentState")[-1]`

## 14.12.4. See also¶

References to other sections: