Salome HOME
Documentation update with features and review corrections
[modules/adao.git] / doc / en / ref_algorithm_AdjointTest.rst
1 ..
2    Copyright (C) 2008-2024 EDF R&D
3
4    This file is part of SALOME ADAO module.
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19
20    See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22    Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23
24 .. index:: single: AdjointTest
25 .. _section_ref_algorithm_AdjointTest:
26
27 Checking algorithm "*AdjointTest*"
28 ----------------------------------
29
30 .. ------------------------------------ ..
31 .. include:: snippets/Header2Algo01.rst
32
33 This algorithm allows to check the quality of the adjoint of an operator
34 :math:`F`, by computing a residue whose theoretical properties are known. The
35 test is applicable to any operator, of evolution :math:`\mathcal{D}` or
36 observation :math:`\mathcal{H}`..
37
38 For all formulas, with :math:`\mathbf{x}` the current verification point, we
39 take :math:`\mathbf{dx}_0=Normal(0,\mathbf{x})` and
40 :math:`\mathbf{dx}=\alpha_0*\mathbf{dx}_0` with :math:`\alpha_0` a scaling user
41 parameter, defaulting to 1. :math:`F` is the computational operator or code
42 (which is here defined by the observation operator command
43 "*ObservationOperator*").
44
45 One can observe the following residue, which is the difference of two scalar
46 products:
47
48 .. math:: R(\alpha) = | < TangentF_x(\mathbf{dx}) , \mathbf{y} > - < \mathbf{dx} , AdjointF_x(\mathbf{y}) > |
49
50 in which the optional quantity :math:`\mathbf{y}` must be in the image of
51 :math:`F`. If it is not given, we take its default evaluation :math:`\mathbf{y}
52 = F(\mathbf{x})`.
53
54 This residue must remain constantly equal to zero at the accuracy of the
55 calculation.
56
57 .. ------------------------------------ ..
58 .. include:: snippets/Header2Algo12.rst
59
60 .. include:: snippets/FeaturePropDerivativeNeeded.rst
61
62 .. include:: snippets/FeaturePropParallelDerivativesOnly.rst
63
64 .. ------------------------------------ ..
65 .. include:: snippets/Header2Algo02.rst
66
67 .. include:: snippets/CheckingPoint.rst
68
69 .. include:: snippets/Observation.rst
70
71 .. include:: snippets/ObservationOperator.rst
72
73 .. ------------------------------------ ..
74 .. include:: snippets/Header2Algo03Chck.rst
75
76 .. include:: snippets/AmplitudeOfInitialDirection.rst
77
78 .. include:: snippets/EpsilonMinimumExponent.rst
79
80 .. include:: snippets/InitialDirection.rst
81
82 .. include:: snippets/NumberOfPrintedDigits.rst
83
84 .. include:: snippets/SetSeed.rst
85
86 StoreSupplementaryCalculations
87   .. index:: single: StoreSupplementaryCalculations
88
89   *List of names*. This list indicates the names of the supplementary
90   variables, that can be available during or at the end of the algorithm, if
91   they are initially required by the user. Their availability involves,
92   potentially, costly calculations or memory consumptions. The default is then
93   a void list, none of these variables being calculated and stored by default
94   (excepted the unconditional variables). The possible names are in the
95   following list (the detailed description of each named variable is given in
96   the following part of this specific algorithmic documentation, in the
97   sub-section "*Information and variables available at the end of the
98   algorithm*"): [
99   "CurrentState",
100   "Residu",
101   "SimulatedObservationAtCurrentState",
102   ].
103
104   Example :
105   ``{"StoreSupplementaryCalculations":["CurrentState", "Residu"]}``
106
107 .. ------------------------------------ ..
108 .. include:: snippets/Header2Algo04.rst
109
110 .. include:: snippets/Residu.rst
111
112 .. ------------------------------------ ..
113 .. include:: snippets/Header2Algo05.rst
114
115 .. include:: snippets/CurrentState.rst
116
117 .. include:: snippets/Residu.rst
118
119 .. include:: snippets/SimulatedObservationAtCurrentState.rst
120
121 .. ------------------------------------ ..
122 .. _section_ref_algorithm_AdjointTest_examples:
123
124 .. include:: snippets/Header2Algo09.rst
125
126 .. include:: scripts/simple_AdjointTest.rst
127
128 .. literalinclude:: scripts/simple_AdjointTest.py
129
130 .. include:: snippets/Header2Algo10.rst
131
132 .. literalinclude:: scripts/simple_AdjointTest.res
133     :language: none
134
135 .. ------------------------------------ ..
136 .. include:: snippets/Header2Algo06.rst
137
138 - :ref:`section_ref_algorithm_FunctionTest`
139 - :ref:`section_ref_algorithm_LinearityTest`
140 - :ref:`section_ref_algorithm_TangentTest`
141 - :ref:`section_ref_algorithm_GradientTest`
142 - :ref:`section_ref_algorithm_LocalSensitivityTest`