3
* @file MarginalTransformationFunction.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-06-26 13:50:17 +0200 (jeu, 26 jun 2008) $
24
* Id: $Id: MarginalTransformationFunction.cxx 862 2008-06-26 11:50:17Z dutka $
26
#include "MarginalTransformationFunction.hxx"
30
namespace Uncertainty {
36
CLASSNAMEINIT(MarginalTransformationFunction);
38
/* Parameter constructor */
39
MarginalTransformationFunction::MarginalTransformationFunction(const DistributionCollection & distributionCollection,
41
NumericalMathEvaluationImplementation(name),
42
distributionCollection_(distributionCollection)
44
Description description;
45
UnsignedLong size(distributionCollection.getSize());
46
for (UnsignedLong i = 0; i < size; ++i)
52
for (UnsignedLong i = 0; i < size; ++i)
58
setDescription(description);
61
/* Virtual constructor */
62
MarginalTransformationFunction * MarginalTransformationFunction::clone() const
64
return new MarginalTransformationFunction(*this);
68
MarginalTransformationFunction::NumericalPoint MarginalTransformationFunction::operator () (const NumericalPoint & in) const
69
throw (InvalidArgumentException, InternalException)
71
UnsignedLong dimension(getOutputNumericalPointDimension());
72
NumericalPoint result(dimension);
73
// Apply CDF over the components
74
for (UnsignedLong i = 0; i < dimension; ++i)
76
result[i] = distributionCollection_[i].computeCDF(NumericalPoint(1, in[i]));
81
/* Gradient according to the marginal parameters. */
82
MarginalTransformationFunction::Matrix MarginalTransformationFunction::parametersGradient(const NumericalPoint & in) const
84
NumericalPoint parameters(getParameters());
85
UnsignedLong parametersDimension(parameters.getDimension());
86
UnsignedLong inputDimension(getInputNumericalPointDimension());
87
Matrix result(parametersDimension, inputDimension);
88
UnsignedLong rowIndex(0);
89
for (UnsignedLong j = 0; j < inputDimension; ++j)
91
NumericalPoint marginalCDFGradient(distributionCollection_[j].computeCDFGradient(NumericalPoint(1, in[j])));
92
UnsignedLong marginalParametersDimension(marginalCDFGradient.getDimension());
93
for (UnsignedLong i = 0; i < marginalParametersDimension; ++i)
95
result(rowIndex, j) = marginalCDFGradient[i];
102
/* Accessor for input point dimension */
103
UnsignedLong MarginalTransformationFunction::getInputNumericalPointDimension() const
104
throw(InternalException)
106
return distributionCollection_.getSize();
109
/* Accessor for output point dimension */
110
UnsignedLong MarginalTransformationFunction::getOutputNumericalPointDimension() const
111
throw(InternalException)
113
return distributionCollection_.getSize();
116
/* String converter */
117
String MarginalTransformationFunction::str() const
120
oss << "class=" << MarginalTransformationFunction::GetClassName()
121
<< " description=" << getDescription()
122
<< " marginals=" << distributionCollection_;
126
} /* namespace Algorithm */
127
} /* namespace Uncertainty */
128
} /* namespace OpenTURNS */