Solves the problem through Monte Carlo algorithm.
159 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
160 <<
": avoiding solution, as requested by user"
166 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
167 <<
": computing solution, as requested by user"
173 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
184 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
202 Q_V numEvaluationPointsVec(
m_qoiRv.
imageSet().vectorSpace().zeroVector());
203 numEvaluationPointsVec.cwSet(250.);
209 alternativeOptionsValues,
220 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
223 m_qoiChain->subUniformlySampledMdf(numEvaluationPointsVec,
234 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
245 m_qoiChain->subUniformlySampledCdf(numEvaluationPointsVec,
249 m_subSolutionCdf =
new SampledVectorCdf<Q_V,Q_M>(subCoreName_solutionCdf.c_str(),
261 m_qoiChain->unifiedUniformlySampledCdf(numEvaluationPointsVec,
263 *m_unifiedCdfValues);
273 P_M* pqCovarianceMatrix = NULL;
274 P_M* pqCorrelationMatrix = NULL;
277 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
279 <<
": instantiating cov and corr matrices"
285 pqCovarianceMatrix =
new P_M(
m_env,
286 m_paramRv.imageSet().vectorSpace().map(),
288 pqCorrelationMatrix =
new P_M(
m_env,
289 m_paramRv.imageSet().vectorSpace().map(),
293 std::min(m_paramRv.realizer().subPeriod(),
m_qoiRv.
realizer().subPeriod()),
295 *pqCorrelationMatrix);
301 if (pqCovarianceMatrix ) {
302 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
304 <<
": contents of covariance matrix are\n" << *pqCovarianceMatrix
307 if (pqCorrelationMatrix) {
308 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
310 <<
": contents of correlation matrix are\n" << *pqCorrelationMatrix
317 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
323 FilePtrSetStruct filePtrSet;
325 UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT,
329 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
332 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
340 #ifdef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
348 queso_error_msg(
"unified cdf writing, parallel vectors not supported yet");
355 *
m_env.
subDisplayFile() <<
"In StatisticalForwardProblem<P_V,P_M,Q_V,Q_M>::solveWithMonteCarlo()"
366 if (pqCovarianceMatrix )
delete pqCovarianceMatrix;
367 if (pqCorrelationMatrix)
delete pqCorrelationMatrix;
BaseVectorCdf< Q_V, Q_M > * m_subSolutionCdf
ArrayOfOneDTables< Q_V, Q_M > * m_unifiedCdfValues
ArrayOfOneDTables< Q_V, Q_M > * m_subMdfValues
const BaseVectorRV< P_V, P_M > & m_paramRv
void Barrier() const
Pause every process in *this communicator until all the processes reach this point.
const SfpOptionsValues * m_optionsObj
ArrayOfOneDGrids< Q_V, Q_M > * m_subMdfGrids
ArrayOfOneDTables< Q_V, Q_M > * m_subCdfValues
bool m_computeCorrelations
std::string m_dataOutputFileName
void setSubCdf(BaseVectorCdf< V, M > &subCdf)
Sets the CDF of the sub-sequence of this vector RV to subCdf.
void closeFile(FilePtrSetStruct &filePtrSet, const std::string &fileType) const
Closes the file.
void clear()
Reset the values and the size of the sequence of vectors.
void syncPrintDebugMsg(const char *msg, unsigned int msgVerbosity, unsigned int numUSecs) const
Synchronizes all the processes and print debug message.
int subRank() const
Returns the rank of the MPI process in the sub-communicator subComm()
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
bool m_computeCovariances
void setMdf(BaseVectorMdf< V, M > &mdf)
Sets the MDF of this vector RV to Mdf.
std::set< unsigned int > m_dataOutputAllowedSet
virtual const VectorSpace< V, M > & vectorSpace() const =0
Vector space to which this set belongs to. See template specialization.
const BaseVectorMdf< V, M > & mdf() const
Finds the Marginal Density Function of this vector RV; access to private attribute m_mdf...
ArrayOfOneDGrids< Q_V, Q_M > * m_unifiedCdfGrids
BaseVectorCdf< Q_V, Q_M > * m_unifiedSolutionCdf
GenericVectorRV< Q_V, Q_M > & m_qoiRv
BaseVectorMdf< Q_V, Q_M > * m_subSolutionMdf
MonteCarloSG< P_V, P_M, Q_V, Q_M > * m_mcSeqGenerator
BaseJointPdf< Q_V, Q_M > * m_solutionPdf
const BaseVectorCdf< V, M > & subCdf() const
Finds the Cumulative Distribution Function of this vector RV, considering only the sub-sequence of da...
BaseVectorRealizer< Q_V, Q_M > * m_solutionRealizer
void setRealizer(BaseVectorRealizer< V, M > &realizer)
Sets the realizer of this vector RV to realizer.
BaseVectorSequence< Q_V, Q_M > * m_paramChain
ArrayOfOneDGrids< Q_V, Q_M > * m_subCdfGrids
const BaseVectorRealizer< V, M > & realizer() const
Finds a realization (sample) of the PDF of this vector RV; access to private attribute m_realizer...
const MpiComm & fullComm() const
Access function for the communicator that was passed to QUESO's environment.
const BaseEnvironment & m_env
unsigned int numSubEnvironments() const
Access function to the number of sub-environments.
BaseVectorSequence< Q_V, Q_M > * m_qoiChain
const BaseVectorFunction< P_V, P_M, Q_V, Q_M > & m_qoiFunction
const BaseVectorCdf< V, M > & unifiedCdf() const
Finds the Cumulative Distribution Function of this vector RV, considering the unified sequence of dat...
int inter0Rank() const
Returns the process inter0 rank.
void ComputeCovCorrMatricesBetweenVectorSequences(const BaseVectorSequence< P_V, P_M > &subPSeq, const BaseVectorSequence< Q_V, Q_M > &subQSeq, unsigned int subNumSamples, P_M &pqCovMatrix, P_M &pqCorrMatrix)
void setUnifiedCdf(BaseVectorCdf< V, M > &unifiedCdf)
Sets the CDF of the unified sequence of this vector RV to unifiedCdf.
bool openOutputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, bool writeOver, FilePtrSetStruct &filePtrSet) const
Opens an output file for each sub-environment that was chosen to send data to the file...
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).