2 Copyright (C) 2008-2023 EDF R&D
4 This file is part of SALOME ADAO module.
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.
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.
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
20 See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 .. index:: single: AdjointTest
25 .. _section_ref_algorithm_AdjointTest:
27 Checking algorithm "*AdjointTest*"
28 ----------------------------------
30 .. ------------------------------------ ..
31 .. include:: snippets/Header2Algo01.rst
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 or observation.
37 For all formulas, with :math:`\mathbf{x}` the current verification point, we
38 take :math:`\mathbf{dx}_0=Normal(0,\mathbf{x})` and
39 :math:`\mathbf{dx}=\alpha_0*\mathbf{dx}_0` with :math:`\alpha_0` a scaling user
40 parameter, defaulting to 1. :math:`F` is the computational operator or code
41 (which is here defined by the observation operator command
42 "*ObservationOperator*").
44 One can observe the following residue, which is the difference of two scalar
47 .. math:: R(\alpha) = | < TangentF_x(\mathbf{dx}) , \mathbf{y} > - < \mathbf{dx} , AdjointF_x(\mathbf{y}) > |
49 in which the optional quantity :math:`\mathbf{y}` must be in the image of
50 :math:`F`. If it is not given, we take its default evaluation :math:`\mathbf{y}
53 This residue must remain constantly equal to zero at the accuracy of the
56 .. ------------------------------------ ..
57 .. include:: snippets/Header2Algo02.rst
59 .. include:: snippets/CheckingPoint.rst
61 .. include:: snippets/Observation.rst
63 .. include:: snippets/ObservationOperator.rst
65 .. ------------------------------------ ..
66 .. include:: snippets/Header2Algo03Chck.rst
68 .. include:: snippets/AmplitudeOfInitialDirection.rst
70 .. include:: snippets/EpsilonMinimumExponent.rst
72 .. include:: snippets/InitialDirection.rst
74 .. include:: snippets/NumberOfPrintedDigits.rst
76 .. include:: snippets/SetSeed.rst
78 StoreSupplementaryCalculations
79 .. index:: single: StoreSupplementaryCalculations
81 *List of names*. This list indicates the names of the supplementary
82 variables, that can be available during or at the end of the algorithm, if
83 they are initially required by the user. Their avalability involves,
84 potentially, costly calculations or memory consumptions. The default is then
85 a void list, none of these variables being calculated and stored by default
86 (excepted the unconditionnal variables). The possible names are in the
87 following list (the detailed description of each named variable is given in
88 the following part of this specific algorithmic documentation, in the
89 sub-section "*Information and variables available at the end of the
93 "SimulatedObservationAtCurrentState",
97 ``{"StoreSupplementaryCalculations":["CurrentState", "Residu"]}``
99 .. ------------------------------------ ..
100 .. include:: snippets/Header2Algo04.rst
102 .. include:: snippets/Residu.rst
104 .. ------------------------------------ ..
105 .. include:: snippets/Header2Algo05.rst
107 .. include:: snippets/CurrentState.rst
109 .. include:: snippets/Residu.rst
111 .. include:: snippets/SimulatedObservationAtCurrentState.rst
113 .. ------------------------------------ ..
114 .. _section_ref_algorithm_AdjointTest_examples:
116 .. include:: snippets/Header2Algo09.rst
118 .. include:: scripts/simple_AdjointTest.rst
120 .. literalinclude:: scripts/simple_AdjointTest.py
122 .. include:: snippets/Header2Algo10.rst
124 .. literalinclude:: scripts/simple_AdjointTest.res
127 .. ------------------------------------ ..
128 .. include:: snippets/Header2Algo06.rst
130 - :ref:`section_ref_algorithm_FunctionTest`
131 - :ref:`section_ref_algorithm_LinearityTest`
132 - :ref:`section_ref_algorithm_TangentTest`
133 - :ref:`section_ref_algorithm_GradientTest`
134 - :ref:`section_ref_algorithm_LocalSensitivityTest`