3
* @file InverseMarginalTransformationEvaluation.cxx
4
* @brief Class for the Nataf transformation evaluation for elliptical
6
* (C) Copyright 2005-2007 EDF-EADS-Phimeca
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License.
13
* This library is distributed in the hope that it will be useful
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
* @author: $LastChangedBy: dutka $
23
* @date: $LastChangedDate: 2008-10-31 11:52:04 +0100 (ven 31 oct 2008) $
24
* Id: $Id: InverseMarginalTransformationEvaluation.cxx 995 2008-10-31 10:52:04Z dutka $
26
#include "InverseMarginalTransformationEvaluation.hxx"
30
namespace Uncertainty {
36
CLASSNAMEINIT(InverseMarginalTransformationEvaluation);
38
/* Parameter constructor */
39
InverseMarginalTransformationEvaluation::InverseMarginalTransformationEvaluation(const DistributionCollection & distributionCollection):
40
NumericalMathEvaluationImplementation(),
41
distributionCollection_(distributionCollection)
43
Description description;
44
UnsignedLong size(distributionCollection.getSize());
45
for (UnsignedLong i = 0; i < size; ++i)
51
for (UnsignedLong i = 0; i < size; ++i)
57
setDescription(description);
60
/* Virtual constructor */
61
InverseMarginalTransformationEvaluation * InverseMarginalTransformationEvaluation::clone() const
63
return new InverseMarginalTransformationEvaluation(*this);
67
InverseMarginalTransformationEvaluation::NumericalPoint InverseMarginalTransformationEvaluation::operator () (const NumericalPoint & in) const
68
throw (InvalidArgumentException, InternalException)
70
UnsignedLong dimension(getOutputNumericalPointDimension());
71
NumericalPoint result(dimension);
72
// Apply quantile over the components
73
for (UnsignedLong i = 0; i < dimension; ++i)
75
result[i] = distributionCollection_[i].computeQuantile(in[i])[0];
81
* Gradient according to the marginal parameters.
85
* dF/dp = dF/dx(Q(y, p), p) . dQ/dp(y, p) + dF/dp(Q(y, p), p)
86
* = f(Q(y, p), p) . dQ/dp(y, p) + dF/dp(Q(y, p), p)
88
* => dQ/dp(y, p) = - dF/dp(Q(y, p), p) / f(Q(y, p), p)
90
InverseMarginalTransformationEvaluation::Matrix InverseMarginalTransformationEvaluation::parametersGradient(const NumericalPoint & in) const
92
const NumericalPoint parameters(getParameters());
93
const UnsignedLong parametersDimension(parameters.getDimension());
94
const UnsignedLong inputDimension(getInputNumericalPointDimension());
95
Matrix result(parametersDimension, inputDimension);
96
UnsignedLong rowIndex(0);
97
for (UnsignedLong j = 0; j < inputDimension; ++j)
99
const NumericalPoint x(distributionCollection_[j].computeQuantile(in[j]));
100
const NumericalPoint marginalCDFGradient(distributionCollection_[j].computeCDFGradient(x));
101
const NumericalScalar pdf(distributionCollection_[j].computePDF(x));
102
const NumericalPoint marginalQuantileGradient((-1.0 / pdf) * marginalCDFGradient);
103
const UnsignedLong marginalParametersDimension(marginalCDFGradient.getDimension());
104
for (UnsignedLong i = 0; i < marginalParametersDimension; ++i)
106
result(rowIndex, j) = marginalQuantileGradient[i];
113
/* Accessor for input point dimension */
114
UnsignedLong InverseMarginalTransformationEvaluation::getInputNumericalPointDimension() const
115
throw(InternalException)
117
return distributionCollection_.getSize();
120
/* Accessor for output point dimension */
121
UnsignedLong InverseMarginalTransformationEvaluation::getOutputNumericalPointDimension() const
122
throw(InternalException)
124
return distributionCollection_.getSize();
127
/* String converter */
128
String InverseMarginalTransformationEvaluation::str() const
131
oss << "class=" << InverseMarginalTransformationEvaluation::GetClassName();
135
} /* namespace Algorithm */
136
} /* namespace Uncertainty */
137
} /* namespace OpenTURNS */