3
* @file QuasiMonteCarloResult.cxx
4
* @brief Implementation of SimulationResult
6
* (C) Copyright 2005-2010 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: schueller $
23
* @date: $LastChangedDate: 2008-05-23 13:46:12 +0200 (ven, 23 mai 2008) $
24
* Id: $Id: QuasiMonteCarloResult.cxx 821 2008-05-23 11:46:12Z schueller $
26
#include "QuasiMonteCarloResult.hxx"
37
CLASSNAMEINIT(QuasiMonteCarloResult);
39
typedef Base::Common::Log Log;
41
/* Default constructor */
42
QuasiMonteCarloResult::QuasiMonteCarloResult()
43
: SimulationResultImplementation()
48
/* Standard constructor */
49
QuasiMonteCarloResult::QuasiMonteCarloResult(const NumericalScalar probabilityEstimate,
50
const NumericalScalar varianceEstimate,
51
const UnsignedLong outerSampling,
52
const UnsignedLong blockSize) throw(InvalidArgumentException)
53
: SimulationResultImplementation(probabilityEstimate, varianceEstimate, outerSampling, blockSize)
55
// Check if the probability estimate is within the range [0, 1]
56
if ((probabilityEstimate < 0) || (probabilityEstimate > 1)) Log::Info("The probability estimate should be in the range [0, 1]");
57
// Check if the variance estimate is >= 0.0
58
if (varianceEstimate < 0.0) throw InvalidArgumentException(HERE) << "The variance estimate must be >= 0";
61
/* Virtual constructor */
62
QuasiMonteCarloResult * QuasiMonteCarloResult::clone() const
64
return new QuasiMonteCarloResult(*this);
67
/* Coefficient of variation estimate accessor */
68
NumericalScalar QuasiMonteCarloResult::getCoefficientOfVariation() const
73
/* String converter */
74
String QuasiMonteCarloResult::__repr__() const
78
oss << std::scientific
79
<< "probabilityEstimate=" << probabilityEstimate_
80
<< " varianceEstimate=" << varianceEstimate_
81
<< " outerSampling=" << outerSampling_
82
<< " blockSize=" << blockSize_;
87
/* Confidence length */
88
NumericalScalar QuasiMonteCarloResult::getConfidenceLength(const NumericalScalar level) const
89
throw(InvalidArgumentException)
91
throw NotYetImplementedException(HERE) << "cannot compute confidence interval for QMC sampling";
96
} /* namespace Algorithm */
97
} /* namespace Uncertainty */
98
} /* namespace OpenTURNS */