2 Copyright (C) 2008-2024 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: GradientTest
25 .. _section_ref_algorithm_GradientTest:
27 Checking algorithm "*GradientTest*"
28 -----------------------------------
30 .. ------------------------------------ ..
31 .. include:: snippets/Header2Algo01.rst
33 This algorithm allows to check the quality of an adjoint operator, by
34 calculating a residue with known theoretical properties. Different residue
35 formula are available. The test is applicable to any operator, of evolution
36 :math:`\mathcal{D}` or observation :math:`\mathcal{H}`.
38 In any cases, one take :math:`\mathbf{dx}_0=Normal(0,\mathbf{x})` and
39 :math:`\mathbf{dx}=\alpha*\mathbf{dx}_0` with :math:`\alpha_0` a user scaling
40 of the initial perturbation, with default to 1. :math:`F` is the calculation
41 code (given here by the user by using the observation operator command
42 "*ObservationOperator*").
47 One observe the residue coming from the Taylor development of the :math:`F`
48 function, normalized by the value at the nominal point:
50 .. math:: R(\alpha) = \frac{|| F(\mathbf{x}+\alpha*\mathbf{dx}) - F(\mathbf{x}) - \alpha * \nabla_xF(\mathbf{dx}) ||}{|| F(\mathbf{x}) ||}
52 If the residue is decreasing and the decrease change in :math:`\alpha^2` with
53 respect to :math:`\alpha`, it signifies that the gradient is well calculated
54 until the stopping precision of the quadratic decrease, and that :math:`F` is
57 If the residue is decreasing and the decrease change in :math:`\alpha` with
58 respect to :math:`\alpha`, until a certain level after which the residue remains
59 small and constant, it signifies that the :math:`F` is linear and that the
60 residue is decreasing due to the error coming from :math:`\nabla_xF` term
63 "TaylorOnNorm" residue
64 **********************
66 One observe the residue coming from the Taylor development of the :math:`F`
67 function, with respect to the :math:`\alpha` parameter to the square:
69 .. math:: R(\alpha) = \frac{|| F(\mathbf{x}+\alpha*\mathbf{dx}) - F(\mathbf{x}) - \alpha * \nabla_xF(\mathbf{dx}) ||}{\alpha^2}
71 This is a residue essentially similar to the classical Taylor criterion
72 previously described, but its behavior can differ depending on the numerical
73 properties of the calculation.
75 If the residue is constant until a certain level after which the residue will
76 growth, it signifies that the gradient is well calculated until this stopping
77 precision, and that :math:`F` is not linear.
79 If the residue is systematically growing from a very small value with respect to
80 :math:`||F(\mathbf{x})||`, it signifies that :math:`F` is (quasi-)linear and
81 that the gradient calculation is correct until the precision for which the
82 residue reaches the numerical order of :math:`||F(\mathbf{x})||`.
87 One observe the residue based on the gradient approximation:
89 .. math:: R(\alpha) = \frac{|| F(\mathbf{x}+\alpha*\mathbf{dx}) - F(\mathbf{x}) ||}{\alpha}
91 which has to remain stable until the calculation precision is reached.
93 .. ------------------------------------ ..
94 .. include:: snippets/Header2Algo12.rst
96 .. include:: snippets/FeaturePropDerivativeNeeded.rst
98 .. include:: snippets/FeaturePropParallelDerivativesOnly.rst
100 .. ------------------------------------ ..
101 .. include:: snippets/Header2Algo02.rst
103 .. include:: snippets/CheckingPoint.rst
105 .. include:: snippets/ObservationOperator.rst
107 .. ------------------------------------ ..
108 .. include:: snippets/Header2Algo03Chck.rst
110 .. include:: snippets/AmplitudeOfInitialDirection.rst
112 .. include:: snippets/AmplitudeOfTangentPerturbation.rst
114 .. include:: snippets/EpsilonMinimumExponent.rst
116 .. include:: snippets/InitialDirection.rst
118 .. include:: snippets/NumberOfPrintedDigits.rst
120 .. include:: snippets/ResiduFormula_GradientTest.rst
122 .. include:: snippets/SetSeed.rst
124 StoreSupplementaryCalculations
125 .. index:: single: StoreSupplementaryCalculations
127 *List of names*. This list indicates the names of the supplementary
128 variables, that can be available during or at the end of the algorithm, if
129 they are initially required by the user. Their availability involves,
130 potentially, costly calculations or memory consumptions. The default is then
131 a void list, none of these variables being calculated and stored by default
132 (excepted the unconditional variables). The possible names are in the
133 following list (the detailed description of each named variable is given in
134 the following part of this specific algorithmic documentation, in the
135 sub-section "*Information and variables available at the end of the
139 "SimulatedObservationAtCurrentState",
143 ``{"StoreSupplementaryCalculations":["CurrentState", "Residu"]}``
145 .. ------------------------------------ ..
146 .. include:: snippets/Header2Algo04.rst
148 .. include:: snippets/Residu.rst
150 .. ------------------------------------ ..
151 .. include:: snippets/Header2Algo05.rst
153 .. include:: snippets/CurrentState.rst
155 .. include:: snippets/Residu.rst
157 .. include:: snippets/SimulatedObservationAtCurrentState.rst
159 .. ------------------------------------ ..
160 .. _section_ref_algorithm_GradientTest_examples:
162 .. include:: snippets/Header2Algo06.rst
164 - :ref:`section_ref_algorithm_FunctionTest`
165 - :ref:`section_ref_algorithm_LinearityTest`
166 - :ref:`section_ref_algorithm_TangentTest`
167 - :ref:`section_ref_algorithm_AdjointTest`
168 - :ref:`section_ref_algorithm_LocalSensitivityTest`