queso-0.53.0
Classes | Typedefs | Functions | Variables
QUESO Namespace Reference

Classes

class  ArrayOfSequences
 Class for handling array samples (arrays of scalar sequences). More...
 
class  BoxSubset
 Class representing a subset of a vector space shaped like a hypercube. More...
 
class  ConcatenationSubset
 A templated class representing the concatenation of two vector subsets. More...
 
class  ConstantScalarFunction
 A class for handling scalar functions which image is a constant (real number). More...
 
class  ConstantVectorFunction
 A class for handling vector functions which image is constant. More...
 
class  DiscreteSubset
 A templated class representing the discrete vector subsets. More...
 
class  GenericScalarFunction
 A class for handling generic scalar functions. More...
 
class  GenericVectorFunction
 A class for handling generic vector functions. More...
 
class  IntersectionSubset
 A templated class representing the intersection of two vector sets. More...
 
class  BaseScalarFunction
 A templated (base) class for handling scalar functions. More...
 
class  ScalarFunctionSynchronizer
 A templated class for synchronizing the calls of scalar functions (BaseScalarFunction and derived classes). More...
 
class  ScalarSequence
 Class for handling scalar samples. More...
 
class  SequenceOfVectors
 Class for handling vector samples (sequence of vectors). More...
 
class  BaseVectorFunction
 A templated (base) class for handling vector functions. More...
 
class  VectorFunctionSynchronizer
 A templated class for synchronizing the calls of vector-valued functions. More...
 
class  BaseVectorSequence
 Base class for handling vector and array samples (sequence of vectors or arrays). More...
 
class  VectorSpace
 A class representing a vector space. More...
 
class  VectorSet
 A templated class for handling sets. More...
 
class  VectorSubset
 A templated class for handling subsets. More...
 
class  BaseInputOptionsParser
 
class  BasicPdfsBase
 TODO: Base class for basic PDFs (via either GSL or Boost). More...
 
class  BasicPdfsBoost
 TODO: Base class for basic PDFs using Boost library. More...
 
class  BasicPdfsGsl
 TODO: Base class for basic PDFs using Gsl library. More...
 
class  BoostInputOptionsParser
 
class  DistArray
 A class for partitioning vectors and matrices. More...
 
struct  FilePtrSetStruct
 Struct for handling data input and output from files. More...
 
class  BaseEnvironment
 This (virtual) class sets up the environment underlying the use of the QUESO library by an executable. More...
 
class  EmptyEnvironment
 This class sets up the environment underlying the use of the QUESO library by an executable. More...
 
class  FullEnvironment
 This class sets up the full environment underlying the use of the QUESO library by an executable. More...
 
class  EnvOptionsValues
 This class provides a suite options one can pass to a QUESO environment. More...
 
class  EnvironmentOptions
 This class reads options one can pass to a QUESO environment through an input file. More...
 
class  LogicError
 
class  NotImplemented
 
class  FileError
 
class  FunctionBase
 Abstract base class for function objects. More...
 
class  FunctionOperatorBuilder
 
class  GslBlockMatrix
 Class for representing block matrices using GSL library. More...
 
class  GslMatrix
 Class for matrix operations using GSL library. More...
 
class  GslOptimizer
 A base class for handling optimisation of scalar functions. More...
 
class  GslVector
 Class for vector operations using GSL library. More...
 
class  InfiniteDimensionalGaussian
 Class defining infinite dimensional Gaussian measures. More...
 
class  InfiniteDimensionalLikelihoodBase
 Abstract class representing the likelihood. Users must subclass this. More...
 
class  InfiniteDimensionalMCMCSamplerOptions
 This class defines the options that specify the behaviour of the MCMC sampler. More...
 
class  InfiniteDimensionalMeasureBase
 Abstract base class for infinite dimensional measures. More...
 
class  Map
 A class for partitioning vectors and matrices. More...
 
class  Matrix
 Class for matrix operations (virtual). More...
 
class  MpiComm
 The QUESO MPI Communicator Class. More...
 
class  OperatorBase
 Abstract base class for operator objects. Operators are assumed to be symmetric and positive-definite. More...
 
class  BaseOptimizer
 A base class for handling optimisation of scalar functions. More...
 
class  OptimizerMonitor
 Object to monitor convergence of optimizers. More...
 
class  RngBase
 Class for random number generation (base class for either GSL or Boost RNG). More...
 
class  RngBoost
 
class  RngGsl
 
class  Vector
 Class for vector operations (virtual). More...
 
class  ExperimentModel
 
class  EmOptionsValues
 
class  ExperimentModelOptions
 
class  ExperimentStorage
 
class  GcmExperimentInfo
 
class  GcmJointInfo
 
class  GcmJointTildeInfo
 
class  GcmSimulationInfo
 
class  GcmSimulationTildeInfo
 
class  GcmTotalInfo
 
class  GcmZInfo
 
class  GcmZTildeInfo
 
class  GPMSAEmulator
 
class  GPMSAFactory
 
class  GpmsaComputerModel
 
class  GcmOptionsValues
 
class  GpmsaComputerModelOptions
 
class  GPMSAOptions
 This class defines the options that specify the behaviour of the Gaussian process emulator. More...
 
class  SimulationModel
 
class  SmOptionsValues
 
class  SimulationModelOptions
 
class  SimulationStorage
 
class  Base1D1DFunction
 Class for one-dimensional functions. More...
 
class  Generic1D1DFunction
 Class for generic one-dimensional functions. More...
 
class  Constant1D1DFunction
 Class for constant one-dimensional functions. More...
 
class  Linear1D1DFunction
 Class for linear one-dimensional functions. More...
 
class  PiecewiseLinear1D1DFunction
 Class for piecewise-linear one-dimensional functions. More...
 
class  Quadratic1D1DFunction
 Class for one-dimensional quadratic functions. More...
 
class  Sampled1D1DFunction
 Class for one-dimensional sampled functions. More...
 
class  ScalarTimesFunc1D1DFunction
 Class for multiplication of a one-dimensional function by a scalar. More...
 
class  FuncTimesFunc1D1DFunction
 Class for multiplication of a one-dimensional function by another. More...
 
class  FuncPlusFunc1D1DFunction
 Class for addition of a one-dimensional function with another. More...
 
class  LagrangePolynomial1D1DFunction
 Class for one-dimensional Lagrange polynomials. More...
 
class  LagrangeBasis1D1DFunction
 Class for Lagrange polynomial basis. More...
 
class  Base1DQuadrature
 Base class for one-dimensional quadrature rules (numerical integration of functions). More...
 
class  Generic1DQuadrature
 Class for one-dimensional generic quadrature rules (numerical integration of functions). More...
 
class  UniformLegendre1DQuadrature
 Class for Legendre-Gauss quadrature rule for one-dimensional functions. More...
 
class  GaussianHermite1DQuadrature
 Class for Hermite-Gauss quadrature rule for one-dimensional functions. More...
 
class  WignerInverseChebyshev1st1DQuadrature
 Class for first type Chebyshev-Gauss quadrature rule for one-dimensional functions. More...
 
class  WignerChebyshev2nd1DQuadrature
 Class for second type Chebyshev-Gauss quadrature rule for one-dimensional functions. More...
 
class  TwoDArray
 Class for handling arrays of generic data. More...
 
class  ArrayOfOneDGrids
 Class to accommodate arrays of one-dimensional grid. More...
 
class  ArrayOfOneDTables
 Class to accommodate arrays of one-dimensional tables. More...
 
class  AsciiTable
 Class for reading ASCII values from a table in a file. More...
 
class  Fft
 Class for a Fast Fourier Transform (FFT) algorithm. More...
 
class  BaseOneDGrid
 Base class for accommodating one-dimensional grids. More...
 
class  StdOneDGrid
 Class for accommodating standard one-dimensional grids. More...
 
class  StreamUtilities
 
class  UniformOneDGrid
 Class for accommodating uniform one-dimensional grids. More...
 
class  BayesianJointPdf
 A class for handling Bayesian joint PDFs. More...
 
class  BetaJointPdf
 A class for handling Beta joint PDFs. More...
 
class  BetaVectorRealizer
 A class for handling sampling from a Beta probability density distribution. More...
 
class  BetaVectorRV
 A class representing a vector RV constructed via Beta distribution. More...
 
class  ConcatenatedJointPdf
 A class for handling concatenated PDFs. More...
 
class  ConcatenatedVectorRealizer
 A class for handling sampling from concatenated probability density distributions. More...
 
class  ConcatenatedVectorRV
 A class representing concatenated vector RVs. More...
 
class  ExponentialMatrixCovarianceFunction
 A class for exponential covariance matrices. More...
 
class  ExponentialScalarCovarianceFunction
 A class for exponential covariances. More...
 
class  FiniteDistribution
 A templated class for a finite distribution. More...
 
class  GammaJointPdf
 A class for handling Gamma joint PDFs. More...
 
class  GammaVectorRealizer
 A class for handling sampling from a Gamma probability density distribution. More...
 
class  GammaVectorRV
 A class representing a vector RV constructed via Gamma distribution. More...
 
class  GaussianJointPdf
 A class for handling Gaussian joint PDFs. More...
 
class  BaseGaussianLikelihood
 Base class for canned Gaussian likelihoods. More...
 
class  GaussianLikelihoodBlockDiagonalCovariance
 A class representing a Gaussian likelihood with block-diagonal covariance matrix. More...
 
class  GaussianLikelihoodBlockDiagonalCovarianceRandomCoefficients
 A class representing a Gaussian likelihood with block-diagonal covariance matrix. More...
 
class  GaussianLikelihoodDiagonalCovariance
 A class that represents a Gaussian likelihood with diagonal covariance matrix. More...
 
class  GaussianLikelihoodFullCovariance
 A class that represents a Gaussian likelihood with full covariance. More...
 
class  GaussianLikelihoodFullCovarianceRandomCoefficient
 A class that represents a Gaussian likelihood with full covariance and random coefficient. More...
 
class  GaussianLikelihoodScalarCovariance
 A class that represents a Gaussian likelihood with scalar covariance. More...
 
class  GaussianVectorCdf
 TODO: A class for handling Gaussian CDFs. More...
 
class  GaussianVectorMdf
 TODO: A class for handling Gaussian MDFs. More...
 
class  GaussianVectorRealizer
 A class for handling sampling from Gaussian probability density distributions. More...
 
class  GaussianVectorRV
 A class representing a Gaussian vector RV. More...
 
class  GenericJointPdf
 A class for handling generic joint PDFs. More...
 
class  GenericMatrixCovarianceFunction
 A class for generic covariance matrices. More...
 
class  GenericScalarCovarianceFunction
 A class for generic covariances. More...
 
class  GenericVectorCdf
 A class for handling generic vector CDFs. More...
 
class  GenericVectorMdf
 A class for handling generic MDFs of vector functions. More...
 
class  GenericVectorRealizer
 A class for handling sampling from generic probability density distributions. More...
 
class  GenericVectorRV
 A templated class for handling generic vector RVs. More...
 
class  HessianCovMatricesTKGroup
 This class allows the representation of a transition kernel with Hessians. More...
 
class  InverseGammaJointPdf
 A class for handling Inverse Gamma joint PDFs. More...
 
class  InverseGammaVectorRealizer
 A class for handling sampling from an Inverse Gamma probability density distribution. More...
 
class  InverseGammaVectorRV
 A class representing a vector RV constructed via Inverse Gamma distribution. More...
 
class  InvLogitGaussianJointPdf
 A class for handling hybrid (transformed) Gaussians with bounds. More...
 
class  InvLogitGaussianVectorRealizer
 A class for handling sampling from (transformed) Gaussian probability density distributions with bounds. More...
 
class  InvLogitGaussianVectorRV
 A class representing a (transformed) Gaussian vector RV with bounds. More...
 
class  JeffreysJointPdf
 A class for handling jeffreys joint PDFs. More...
 
class  JeffreysVectorRealizer
 A class for handling sampling from a jeffreys probability density distribution. More...
 
class  JeffreysVectorRV
 A class representing a jeffreys vector RV. More...
 
class  BaseJointPdf
 A templated (base) class for handling joint PDFs. More...
 
class  LogNormalJointPdf
 A class for handling Log-Normal joint PDFs. More...
 
class  LogNormalVectorRealizer
 A class for handling sampling from a Log-Normal probability density distribution. More...
 
class  LogNormalVectorRV
 A class representing a LogNormal vector RV. More...
 
class  MarkovChainPositionData
 A templated class that represents a Markov Chain. More...
 
class  BaseMatrixCovarianceFunction
 A templated (base) class to accommodate covariance matrix of (random) vector functions. More...
 
struct  MHRawChainInfoStruct
 A struct that represents a Metropolis-Hastings sample. More...
 
class  MetropolisHastingsSG
 A templated class that represents a Metropolis-Hastings generator of samples. More...
 
class  MhOptionsValues
 This class provides options for the Metropolis-Hastings generator of samples if no input file is available. More...
 
class  MetropolisHastingsSGOptions
 This class reads the options for the Metropolis-Hastings generator of samples from an input file. More...
 
struct  ExchangeInfoStruct
 
struct  BalancedLinkedChainControlStruct
 
struct  BalancedLinkedChainsPerNodeStruct
 
struct  UnbalancedLinkedChainControlStruct
 
struct  UnbalancedLinkedChainsPerNodeStruct
 
class  MLSampling
 A templated class that represents a Multilevel generator of samples. More...
 
class  MLSamplingLevelOptions
 This class provides options for each level of the Multilevel sequence generator if no input file is available. More...
 
class  MLSamplingOptions
 This class provides options for the Multilevel sequence generator if no input file is available. More...
 
class  ModelValidation
 A templated class for model validation of the example validationPyramid. More...
 
class  MonteCarloSG
 A templated class that implements a Monte Carlo generator of samples. More...
 
class  McOptionsValues
 This class provides options for the Monte Carlo sequence generator if no input file is available. More...
 
class  MonteCarloSGOptions
 This class reads the options for the Monte Carlo sequence generator from an input file. More...
 
class  PoweredJointPdf
 A class for handling a powered joint PDFs. More...
 
class  SampledScalarCdf
 A class for handling sampled CDFs. More...
 
class  SampledVectorCdf
 A class for handling sampled vector CDFs. More...
 
class  SampledVectorMdf
 A class for handling sampled vector MDFs. More...
 
class  BaseScalarCdf
 A templated (base) class for handling CDFs. More...
 
class  BaseScalarCovarianceFunction
 A templated (base) class to accommodate scalar covariance functions (of random variables). More...
 
class  ScalarGaussianRandomField
 A class for handling scalar Gaussian random fields (GRF). More...
 
class  ScaledCovMatrixTKGroup
 This class allows the representation of a transition kernel with a scaled covariance matrix. More...
 
class  SequentialVectorRealizer
 A class for handling sequential draws (sampling) from probability density distributions. More...
 
class  StatisticalForwardProblem
 This templated class represents a Statistical Forward Problem. More...
 
class  SfpOptionsValues
 This class provides options for a Statistical Forward Problem if no input file is available. More...
 
class  StatisticalForwardProblemOptions
 This class reads option values for a Statistical Forward Problem from an input file. More...
 
class  StatisticalInverseProblem
 This templated class represents a Statistical Inverse Problem. More...
 
class  SipOptionsValues
 This class provides options for a Statistical Inverse Problem if no input file is available. More...
 
class  StatisticalInverseProblemOptions
 This class reads option values for a Statistical Inverse Problem from an input file. More...
 
class  StdScalarCdf
 A class for handling standard CDFs. More...
 
class  BaseTKGroup
 This base class allows the representation of a transition kernel. More...
 
class  TransformedScaledCovMatrixTKGroup
 This class represents a transition kernel with a scaled covariance matrix on hybrid bounded/unbounded state spaces. More...
 
class  UniformJointPdf
 A class for handling uniform joint PDFs. More...
 
class  UniformVectorRealizer
 A class for handling sampling from a Uniform probability density distribution. More...
 
class  UniformVectorRV
 A class representing a uniform vector RV. More...
 
class  ValidationCycle
 A templated class for validation cycle of the examples validationCycle and validationCycle2. More...
 
class  BaseVectorCdf
 A templated (base) class for handling CDFs of vector functions. More...
 
class  VectorGaussianRandomField
 A class for handling vector Gaussian random fields (GRF). More...
 
class  BaseVectorMdf
 A templated (base) class for handling MDFs of vector functions. More...
 
class  BaseVectorRealizer
 A templated (base) class for handling sampling from vector RVs. More...
 
class  BaseVectorRV
 A templated base class for handling vector RV. More...
 
class  WignerJointPdf
 A class for handling Wigner joint PDFs. More...
 
class  WignerVectorRealizer
 A class for handling sampling from a Wigner probability density distribution. More...
 
class  WignerVectorRV
 A class representing a vector RV constructed via Wigner distribution. More...
 
class  InterpolationSurrogateData
 
class  InterpolationSurrogateBase
 Base class for interpolation-based surrogates. More...
 
class  InterpolationSurrogateBuilder
 Build interpolation-based surrogate. More...
 
class  InterpolationSurrogateDataSet
 Container class for multiple, consistent InterpolationSurrogateData objects. More...
 
class  InterpolationSurrogateHelper
 
class  InterpolationSurrogateIOASCII
 
class  InterpolationSurrogateIOBase
 
class  LinearLagrangeInterpolationSurrogate
 Linear Lagrange interpolation surrogate. More...
 
class  SurrogateBase
 Base class for surrogates of models. More...
 
class  SurrogateBuilderBase
 Base class for builders of surrogates. More...
 

Typedefs

typedef MPI_Comm RawType_MPI_Comm
 
typedef MPI_Group RawType_MPI_Group
 
typedef MPI_Datatype RawType_MPI_Datatype
 
typedef MPI_Op RawType_MPI_Op
 
typedef MPI_Status RawType_MPI_Status
 

Functions

template<class V , class M >
VectorSet< V, M > * InstantiateIntersection (const VectorSet< V, M > &domain1, const VectorSet< V, M > &domain2)
 This method calculates the intersection of domain1 and domain2. More...
 
template<class T >
void ComputeSubGaussian2dKde (const ScalarSequence< T > &scalarSeq1, const ScalarSequence< T > &scalarSeq2, unsigned int initialPos, double scaleValue1, double scaleValue2, const std::vector< T > &evaluationPositions1, const std::vector< T > &evaluationPositions2, std::vector< double > &densityValues)
 
template<class T >
void ComputeUnifiedGaussian2dKde (bool useOnlyInter0Comm, const ScalarSequence< T > &scalarSeq1, const ScalarSequence< T > &scalarSeq2, unsigned int initialPos, double unifiedScaleValue1, double unifiedScaleValue2, const std::vector< T > &unifiedEvaluationPositions1, const std::vector< T > &unifiedEvaluationPositions2, std::vector< double > &unifiedDensityValues)
 
template<class T >
void ComputeCovCorrBetweenScalarSequences (const ScalarSequence< T > &subPSeq, const ScalarSequence< T > &subQSeq, unsigned int subNumSamples, T &covValue, T &corrValue)
 
template<class P_V , class P_M , class Q_V , class Q_M >
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)
 
int MyWorldfullRank ()
 Returns the rank of the calling process in the communicator. More...
 
void queso_terminate_handler ()
 Function for unhandled exceptions in Queso. More...
 
void QUESO_version_print (std::ostream &os)
 
int QUESO_get_numeric_version ()
 
std::ostream & operator<< (std::ostream &os, const BaseEnvironment &obj)
 
std::ostream & operator<< (std::ostream &os, const EnvironmentOptions &obj)
 Print values of the options chosen. More...
 
std::ostream & operator<< (std::ostream &os, const GslBlockMatrix &obj)
 
GslMatrix operator* (double a, const GslMatrix &mat)
 
GslVector operator* (const GslMatrix &mat, const GslVector &vec)
 
GslMatrix operator* (const GslMatrix &m1, const GslMatrix &m2)
 
GslMatrix operator+ (const GslMatrix &m1, const GslMatrix &m2)
 
GslMatrix operator- (const GslMatrix &m1, const GslMatrix &m2)
 
GslMatrix matrixProduct (const GslVector &v1, const GslVector &v2)
 
GslMatrix leftDiagScaling (const GslVector &vec, const GslMatrix &mat)
 
GslMatrix rightDiagScaling (const GslMatrix &mat, const GslVector &vec)
 
std::ostream & operator<< (std::ostream &os, const GslMatrix &obj)
 
GslVector operator/ (double a, const GslVector &x)
 
GslVector operator/ (const GslVector &x, const GslVector &y)
 
GslVector operator* (double a, const GslVector &x)
 
GslVector operator* (const GslVector &x, const GslVector &y)
 
double scalarProduct (const GslVector &x, const GslVector &y)
 
GslVector operator+ (const GslVector &x, const GslVector &y)
 
GslVector operator- (const GslVector &x, const GslVector &y)
 
bool operator== (const GslVector &lhs, const GslVector &rhs)
 
std::ostream & operator<< (std::ostream &os, const GslVector &obj)
 
template<>
void BoostInputOptionsParser::getOption< std::vector< double, std::allocator< double > > > (std::string &name, std::vector< double, std::allocator< double > > &value)
 
std::ostream & operator<< (std::ostream &os, const BoostInputOptionsParser &parser)
 
template void BoostInputOptionsParser::registerOption< std::string > (std::string, std::string, std::string)
 
template void BoostInputOptionsParser::getOption< std::string > (std::string &, std::string &)
 
template void BoostInputOptionsParser::getOption< std::vector< unsigned int, std::allocator< unsigned int > > > (std::string &, std::vector< unsigned int, std::allocator< unsigned int > > &)
 
std::ostream & operator<< (std::ostream &os, const EnvOptionsValues &obj)
 
double c_evaluate (const gsl_vector *x, void *context)
 
void c_evaluate_derivative (const gsl_vector *x, void *context, gsl_vector *derivative)
 
void c_evaluate_with_derivative (const gsl_vector *x, void *context, double *f, gsl_vector *derivative)
 
std::ostream & operator<< (std::ostream &os, const InfiniteDimensionalMCMCSamplerOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const ExperimentModelOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const GpmsaComputerModelOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const SimulationModelOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const GPMSAOptions &obj)
 
template<class T >
double SubF1F2Gaussian2dKdeIntegral (const ScalarSequence< T > &scalarSeq1, const ScalarSequence< T > &scalarSeq2, unsigned int initialPos, double scaleValue1, double scaleValue2, const Base1D1DFunction &func1, const Base1D1DFunction &func2, unsigned int quadratureOrder)
 Calculates the integral of a 2D Gaussian KDE. More...
 
template<class V , class M >
void CovCond (double condNumber, const V &direction, M &covMatrix, M &precMatrix)
 
void MiscReadDoublesFromString (const std::string &inputString, std::vector< double > &outputDoubles)
 
void MiscReadWordsFromString (const std::string &inputString, std::vector< std::string > &outputWords)
 
int MiscReadStringAndDoubleFromFile (std::ifstream &ifs, std::string &termString, double *termValue)
 
int MiscReadCharsAndDoubleFromFile (std::ifstream &ifs, std::string &termString, double *termValue, bool &endOfLineAchieved)
 
double MiscGammar (double a, double b, const RngBase *rngObject)
 
double MiscGetEllapsedSeconds (struct timeval *timeval0)
 
double MiscHammingWindow (unsigned int N, unsigned int j)
 
double MiscGaussianDensity (double x, double mu, double sigma)
 
unsigned int MiscUintDebugMessage (unsigned int value, const char *message)
 
int MiscIntDebugMessage (int value, const char *message)
 
double MiscDoubleDebugMessage (double value, const char *message)
 
int CheckFilePath (const char *path)
 
int GRVY_CheckDir (const char *dirname)
 
template<class T >
bool MiscCheckForSameValueInAllNodes (T &inputValue, double acceptableTreshold, const MpiComm &comm, const char *whereString)
 
template<class V >
void MiscComputePositionsBetweenMinMax (V minValues, V maxValues, std::vector< V * > &positions)
 
template<class V1 , class V2 >
void MiscCheckTheParallelEnvironment (const V1 &vec1, const V2 &vec2)
 
template<class V , class M >
std::ostream & operator<< (std::ostream &os, const ArrayOfOneDTables< V, M > &obj)
 
template<class V , class M >
std::ostream & operator<< (std::ostream &os, const AsciiTable< V, M > &obj)
 
template<class V , class M >
void ComputeConditionalGaussianVectorRV (const V &muVec1, const V &muVec2, const M &sigmaMat11, const M &sigmaMat12, const M &sigmaMat21, const M &sigmaMat22, const V &sampleVec2, V &muVec1_cond_on_2, M &sigmaMat11_cond_on_2)
 
std::ostream & operator<< (std::ostream &os, const MetropolisHastingsSGOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const MonteCarloSGOptions &obj)
 Prints the object obj, overloading an operator. More...
 
template<class T >
double horizontalDistance (const BaseScalarCdf< T > &cdf1, const BaseScalarCdf< T > &cdf2, double epsilon)
 It calculated the maximum horizontal distance between two CDFs. More...
 
std::ostream & operator<< (std::ostream &os, const StatisticalForwardProblemOptions &obj)
 Prints the object obj, overloading an operator. More...
 
std::ostream & operator<< (std::ostream &os, const StatisticalInverseProblemOptions &obj)
 Prints the object obj, overloading an operator. More...
 
template<class V , class M >
void horizontalDistances (const BaseVectorCdf< V, M > &cdf1, const BaseVectorCdf< V, M > &cdf2, const V &epsilonVec, V &distances)
 It calculated the maximum horizontal distances between two vector CDFs. More...
 
template<class P_V , class P_M , class Q_V , class Q_M >
void ComputeCovCorrMatricesBetweenVectorRvs (const BaseVectorRV< P_V, P_M > &paramRv, const BaseVectorRV< Q_V, Q_M > &qoiRv, unsigned int localNumSamples, P_M &pqCovMatrix, P_M &pqCorrMatrix)
 
std::ostream & operator<< (std::ostream &os, const MhOptionsValues &obj)
 
template<class P_V , class P_M >
std::ostream & operator<< (std::ostream &os, const MLSampling< P_V, P_M > &obj)
 
std::ostream & operator<< (std::ostream &os, const MLSamplingLevelOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const MLSamplingOptions &obj)
 
std::ostream & operator<< (std::ostream &os, const McOptionsValues &obj)
 
std::ostream & operator<< (std::ostream &os, const SfpOptionsValues &obj)
 
std::ostream & operator<< (std::ostream &os, const SipOptionsValues &obj)
 

Variables

const int UQ_UNAVAILABLE_RANK = -1
 
const int UQ_OK_RC = 0
 
const int UQ_INCOMPLETE_IMPLEMENTATION_RC = -1
 
const int UQ_INVALID_PARAMETER_SPEC_RC = -2
 
const int UQ_INVALID_OBSERVABLE_SPEC_RC = -3
 
const int UQ_INVALID_QOI_SPEC_RC = -4
 
const int UQ_INVALID_INTERNAL_RESULT_RC = -5
 
const int UQ_INVALID_INTERNAL_STATE_RC = -6
 
const int UQ_FAILED_TO_OPEN_FILE_RC = -7
 
const int UQ_MATRIX_IS_NOT_POS_DEFINITE_RC = -8
 
const int UQ_FAILED_READING_FILE_RC = -9
 
const int UQ_INVALID_SPACE_COMPONENT_ID_RC = -10
 
const int UQ_MATRIX_SVD_FAILED_RC = -11
 
std::terminate_handler old_terminate_handler
 

Typedef Documentation

typedef MPI_Comm QUESO::RawType_MPI_Comm

Definition at line 38 of file MpiComm.h.

typedef MPI_Datatype QUESO::RawType_MPI_Datatype

Definition at line 40 of file MpiComm.h.

typedef MPI_Group QUESO::RawType_MPI_Group

Definition at line 39 of file MpiComm.h.

typedef MPI_Op QUESO::RawType_MPI_Op

Definition at line 41 of file MpiComm.h.

typedef MPI_Status QUESO::RawType_MPI_Status

Definition at line 42 of file MpiComm.h.

Function Documentation

template void QUESO::BoostInputOptionsParser::getOption< std::string > ( std::string &  ,
std::string &   
)
template<>
void QUESO::BoostInputOptionsParser::getOption< std::vector< double, std::allocator< double > > > ( std::string &  name,
std::vector< double, std::allocator< double > > &  value 
)

Definition at line 129 of file BoostInputOptionsParser.C.

References MiscReadDoublesFromString().

130 {
131  if (m_scannedInputFile) {
132  // Need to reset value?
133 
134  // Get the option as a string
135  // DM: Why do it this way? Doesn't boost support vectors as input options?
136  std::string optionValue;
137  this->getOption<std::string>(name, optionValue);
138  MiscReadDoublesFromString(optionValue, value);
139  }
140 }
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
Definition: Miscellaneous.C:40
template void QUESO::BoostInputOptionsParser::getOption< std::vector< unsigned int, std::allocator< unsigned int > > > ( std::string &  ,
std::vector< unsigned int, std::allocator< unsigned int > > &   
)
template void QUESO::BoostInputOptionsParser::registerOption< std::string > ( std::string  ,
std::string  ,
std::string   
)
double QUESO::c_evaluate ( const gsl_vector *  x,
void context 
)

Definition at line 41 of file GslOptimizer.C.

References QUESO::GslOptimizer::objectiveFunction().

Referenced by c_evaluate_with_derivative(), QUESO::GslOptimizer::minimize_no_gradient(), and QUESO::GslOptimizer::minimize_with_gradient().

41  {
42 
43  GslOptimizer * optimizer = static_cast<GslOptimizer * >(context);
44 
45  GslVector state(
46  optimizer->objectiveFunction().domainSet().vectorSpace().zeroVector());
47 
48  // DM: Doing this copy sucks, but whatever. It'll do for now.
49  for (unsigned int i = 0; i < state.sizeLocal(); i++) {
50  state[i] = gsl_vector_get(x, i);
51  }
52 
53  // Bail early if GSL tries to evaluate outside of the domain
54  if (!optimizer->objectiveFunction().domainSet().contains(state)) {
55  return GSL_NAN;
56  }
57 
58  // Should cache derivative here so we don't a) segfault in the user's code
59  // and b) so we don't recompute stuff
60  double result = -optimizer->objectiveFunction().lnValue(state, NULL, NULL,
61  NULL, NULL);
62 
63  return result;
64  }
void QUESO::c_evaluate_derivative ( const gsl_vector *  x,
void context,
gsl_vector *  derivative 
)

Definition at line 67 of file GslOptimizer.C.

References QUESO::BaseOptimizer::getFiniteDifferenceStepSize(), and QUESO::GslOptimizer::objectiveFunction().

Referenced by c_evaluate_with_derivative(), and QUESO::GslOptimizer::minimize_with_gradient().

68  {
69  GslOptimizer * optimizer = static_cast<GslOptimizer * >(context);
70 
71  GslVector state(
72  optimizer->objectiveFunction().domainSet().vectorSpace().zeroVector());
73  GslVector deriv(
74  optimizer->objectiveFunction().domainSet().vectorSpace().zeroVector());
75 
76  // DM: Doing this copy sucks, but whatever. It'll do for now.
77  for (unsigned int i = 0; i < state.sizeLocal(); i++) {
78  state[i] = gsl_vector_get(x, i);
79 
80  // We fill with GSL_NAN and use it as a flag to check later that the user
81  // actually fills the derivative vector with stuff
82  deriv[i] = GSL_NAN;
83  }
84 
85  if (!optimizer->objectiveFunction().domainSet().contains(state)) {
86  // Fill derivative with error codes if the point is outside of the
87  // domain
88  for (unsigned int i = 0; i < deriv.sizeLocal(); i++) {
89  gsl_vector_set(derivative, i, GSL_NAN);
90  }
91  }
92  else {
93  // We should cache the return value here so we don't recompute stuff
94  double fx = -optimizer->objectiveFunction().lnValue(state, NULL, &deriv,
95  NULL, NULL);
96 
97  // Decide whether or not we need to do a finite difference based on
98  // whether the user actually filled deriv with values that are not
99  // GSL_NAN
100  //
101  // We're currently doing this check every time this function gets called.
102  // We could probably pull this logic out of here and put it somewhere
103  // where it only happens once
104  bool userComputedDerivative = true;
105  for (unsigned int i = 0; i < deriv.sizeLocal(); i++) {
106  // If the user missed out a derivative in any direction, fall back to
107  // a finite difference
108  if (gsl_isnan(deriv[i])) {
109  userComputedDerivative = false;
110  break;
111  }
112  }
113 
114  if (userComputedDerivative) {
115  for (unsigned int i = 0; i < deriv.sizeLocal(); i++) {
116  gsl_vector_set(derivative, i, -deriv[i]); // We need the minus sign
117  }
118  }
119  else {
120  // Finite difference step-size
121  double h = optimizer->getFiniteDifferenceStepSize();
122 
123  // User did not provide a derivative, so do a finite difference
124  for (unsigned int i = 0; i < deriv.sizeLocal(); i++) {
125  double tempState = state[i];
126  state[i] += h;
127 
128  // User didn't provide a derivative, so we don't bother passing in
129  // the derivative vector again
130  double fxph = -optimizer->objectiveFunction().lnValue(state, NULL,
131  NULL, NULL, NULL);
132 
133  // Reset the state back to what it was before
134  state[i] = tempState;
135 
136  // Make sure we didn't do anything dumb and tell gsl if we did
137  if (!gsl_isnan(fx) && !gsl_isnan(fxph)) {
138  gsl_vector_set(derivative, i, (fxph - fx) / h);
139  }
140  else {
141  gsl_vector_set(derivative, i, GSL_NAN);
142  }
143  }
144  }
145  }
146  }
void QUESO::c_evaluate_with_derivative ( const gsl_vector *  x,
void context,
double *  f,
gsl_vector *  derivative 
)

Definition at line 149 of file GslOptimizer.C.

References c_evaluate(), and c_evaluate_derivative().

Referenced by QUESO::GslOptimizer::minimize_with_gradient().

150  {
151  // We don't need to call both of these
152  *f = c_evaluate(x, context);
153  c_evaluate_derivative(x, context, derivative);
154  }
void c_evaluate_derivative(const gsl_vector *x, void *context, gsl_vector *derivative)
Definition: GslOptimizer.C:67
double c_evaluate(const gsl_vector *x, void *context)
Definition: GslOptimizer.C:41
int QUESO::CheckFilePath ( const char *  pathname)

int CheckFilePath(const char *path) {

// verify parent directories in path exist (and create if not).

ifdef HAVE_GRVY return(grvy_check_file_path(path)); else

return 0; endif }

Definition at line 362 of file Miscellaneous.C.

References GRVY_CheckDir().

Referenced by QUESO::FullEnvironment::FullEnvironment(), QUESO::BaseEnvironment::openInputFile(), QUESO::BaseEnvironment::openOutputFile(), QUESO::BaseEnvironment::openUnifiedInputFile(), and QUESO::BaseEnvironment::openUnifiedOutputFile().

363  {
364 
365  // verify parent directories in path exist (and create if not).
366 
367 #ifdef HAVE_GRVY
368  return(grvy_check_file_path(pathname));
369 #else
370 
371  const int MAX_DEPTH = 50;
372 
373  char *pathlocal;
374  char *parents;
375  char *dirstring;
376  char *token;
377  int depth = 0;
378 
379  // Save a copy of pathname and look for the parent directories.
380 
381  pathlocal = strdup(pathname);
382  dirstring = strdup(pathname);
383  parents = dirname(pathlocal);
384 
385  if(strcmp(parents,".") == 0)
386  {
387  free(pathlocal);
388  free(dirstring);
389  return 0;
390  }
391 
392  // Deal with the possibility of an absolute path being provided
393 
394  bool abs_path = false;
395 
396  std::string leading_char("");
397  std::string path_to_check;
398 
399  if(strncmp(parents,"/",1) == 0)
400  {
401  leading_char = "/";
402  abs_path = true;
403  }
404 
405  // Verify existence of top-level directory
406 
407  if( (token = strtok(parents,"/")) != NULL )
408  {
409  path_to_check += leading_char + token;
410 
411  if ( GRVY_CheckDir(path_to_check.c_str()) )
412  {
413  free(pathlocal);
414  free(dirstring);
415  return -1;
416  }
417 
418  // Now, search for any remaining parent directories.
419 
420  if(abs_path)
421  sprintf(dirstring,"/%s",token);
422  else
423  sprintf(dirstring,"%s",token);
424 
425  while ( (token = strtok(0,"/")) && (depth < MAX_DEPTH) )
426  {
427  dirstring = strcat(dirstring,"/");
428 
429  if(GRVY_CheckDir(strcat(dirstring,token)))
430  {
431  free(pathlocal);
432  free(dirstring);
433  return -1;
434  }
435  depth++;
436  };
437 
438  if(depth >= MAX_DEPTH )
439  {
440  std::cerr << __func__ << ": error - Max directory depth exceeded, limit = " << MAX_DEPTH << std::endl;
441  free(pathlocal);
442  free(dirstring);
443  return -1;
444  }
445  }
446 
447  // Clean Up
448  free(pathlocal);
449  free(dirstring);
450 
451  return 0;
452 #endif
453  }
int GRVY_CheckDir(const char *dirname)
template<class V , class M >
void QUESO::ComputeConditionalGaussianVectorRV ( const V &  muVec1,
const V &  muVec2,
const M &  sigmaMat11,
const M &  sigmaMat12,
const M &  sigmaMat21,
const M &  sigmaMat22,
const V &  sampleVec2,
V &  muVec1_cond_on_2,
M &  sigmaMat11_cond_on_2 
)

Definition at line 207 of file GaussianVectorRV.C.

References queso_require_equal_to_msg, queso_require_less_msg, queso_require_msg, and QUESO::BaseEnvironment::subDisplayFile().

Referenced by QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::predictVUsAtGridPoint(), and QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::predictWsAtGridPoint().

217 {
218  const BaseEnvironment& env = muVec1.env();
219  unsigned int dim1 = muVec1.sizeLocal();
220  unsigned int dim2 = muVec2.sizeLocal();
221 
222  queso_require_msg(!((sigmaMat11.numRowsLocal() != dim1) || (sigmaMat11.numCols() != dim1)), "invalid sigmaMat11");
223 
224  queso_require_msg(!((sigmaMat12.numRowsLocal() != dim1) || (sigmaMat12.numCols() != dim2)), "invalid sigmaMat12");
225 
226  queso_require_msg(!((sigmaMat21.numRowsLocal() != dim2) || (sigmaMat21.numCols() != dim1)), "invalid sigmaMat21");
227 
228  queso_require_msg(!((sigmaMat22.numRowsLocal() != dim2) || (sigmaMat22.numCols() != dim2)), "invalid sigmaMat22");
229 
230  // Check transpose operation
231  M mat_tt(sigmaMat12);
232  mat_tt.cwSet(0.);
233  mat_tt.fillWithTranspose(0,0,sigmaMat21,true,true);
234  double auxNorm = (mat_tt - sigmaMat12).normFrob();
235  if (auxNorm >= 1.e-12) {
236  if (env.subDisplayFile()) {
237  *env.subDisplayFile() << "In ComputeConditionalGaussianVectorRV()"
238  << ": WARNING, ||sigmaMat21^T - sigmaMat12||_2 = " << auxNorm
239  << std::endl;
240  }
241  }
242  queso_require_less_msg(auxNorm, 1.e-12, "sigmaMat12 and sigmaMat21 are not transpose of each other");
243 
244  queso_require_equal_to_msg(sampleVec2.sizeLocal(), dim2, "invalid sampleVec2");
245 
246  queso_require_equal_to_msg(muVec1_cond_on_2.sizeLocal(), dim1, "invalid muVec1_cond_on_2");
247 
248  queso_require_msg(!((sigmaMat11_cond_on_2.numRowsLocal() != dim1) || (sigmaMat11_cond_on_2.numCols() != dim1)), "invalid sigmaMat11_cond_on_2");
249 
250  muVec1_cond_on_2 = muVec1 + sigmaMat12 * sigmaMat22.invertMultiply(sampleVec2 - muVec2);
251  sigmaMat11_cond_on_2 = sigmaMat11 - sigmaMat12 * sigmaMat22.invertMultiply(sigmaMat21);
252 
253  return;
254 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define queso_require_less_msg(expr1, expr2, msg)
Definition: asserts.h:87
template<class T >
void QUESO::ComputeCovCorrBetweenScalarSequences ( const ScalarSequence< T > &  subPSeq,
const ScalarSequence< T > &  subQSeq,
unsigned int  subNumSamples,
T &  covValue,
T &  corrValue 
)

Definition at line 4006 of file ScalarSequence.C.

References QUESO::MpiComm::Allreduce(), QUESO::ScalarSequence< T >::env(), QUESO::BaseEnvironment::inter0Comm(), QUESO::BaseEnvironment::inter0Rank(), k, queso_require_msg, RawValue_MPI_DOUBLE, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::ScalarSequence< T >::subSequenceSize(), QUESO::ScalarSequence< T >::unifiedMeanExtra(), and QUESO::ScalarSequence< T >::unifiedSampleVarianceExtra().

Referenced by ComputeSubGaussian2dKde().

4012 {
4013  // Check input data consistency
4014  const BaseEnvironment& env = subPSeq.env();
4015 
4016  queso_require_msg(!((subNumSamples > subPSeq.subSequenceSize()) || (subNumSamples > subQSeq.subSequenceSize())), "subNumSamples is too large");
4017 
4018  // For both P and Q vector sequences: fill them
4019  T tmpP = 0.;
4020  T tmpQ = 0.;
4021 
4022  // For both P and Q vector sequences: compute the unified mean
4023  T unifiedMeanP = subPSeq.unifiedMeanExtra(true,0,subNumSamples);
4024  T unifiedMeanQ = subQSeq.unifiedMeanExtra(true,0,subNumSamples);
4025 
4026  // Compute "sub" covariance matrix
4027  covValue = 0.;
4028  for (unsigned k = 0; k < subNumSamples; ++k) {
4029  // For both P and Q vector sequences: get the difference (wrt the unified mean) in them
4030  tmpP = subPSeq[k] - unifiedMeanP;
4031  tmpQ = subQSeq[k] - unifiedMeanQ;
4032  covValue += tmpP*tmpQ;
4033  }
4034 
4035  // For both P and Q vector sequences: compute the unified variance
4036  T unifiedSampleVarianceP = subPSeq.unifiedSampleVarianceExtra(true,
4037  0,
4038  subNumSamples,
4039  unifiedMeanP);
4040 
4041  T unifiedSampleVarianceQ = subQSeq.unifiedSampleVarianceExtra(true,
4042  0,
4043  subNumSamples,
4044  unifiedMeanQ);
4045 
4046  // Compute unified covariance
4047  if (env.inter0Rank() >= 0) {
4048  unsigned int unifiedNumSamples = 0;
4049  env.inter0Comm().Allreduce((void *) &subNumSamples, (void *) &unifiedNumSamples, (int) 1, RawValue_MPI_UNSIGNED, RawValue_MPI_SUM,
4050  "ComputeCovCorrBetweenScalarSequences()",
4051  "failed MPI.Allreduce() for subNumSamples");
4052 
4053  double aux = 0.;
4054  env.inter0Comm().Allreduce((void *) &covValue, (void *) &aux, (int) 1, RawValue_MPI_DOUBLE, RawValue_MPI_SUM,
4055  "ComputeCovCorrBetweenScalarSequences()",
4056  "failed MPI.Allreduce() for a matrix position");
4057  covValue = aux/((double) (unifiedNumSamples-1)); // Yes, '-1' in order to compensate for the 'N-1' denominator factor in the calculations of sample variances above (whose square roots will be used below)
4058 
4059  corrValue = covValue/std::sqrt(unifiedSampleVarianceP)/std::sqrt(unifiedSampleVarianceQ);
4060 
4061  if ((corrValue < -1.) || (corrValue > 1.)) { // prudencio 2010-07-23
4062  std::cerr << "In ComputeCovCorrBetweenScalarSequences()"
4063  << ": computed correlation is out of range, corrValue = " << corrValue
4064  << std::endl;
4065  }
4066 
4067  // env.worldRank(),
4068  // "ComputeCovCorrBetweenScalarSequences()",
4069  // "computed correlation is out of range");
4070  }
4071  else {
4072  // Node not in the 'inter0' communicator: do nothing extra
4073  }
4074 
4075  return;
4076 }
#define RawValue_MPI_SUM
Definition: MpiComm.h:52
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
#define RawValue_MPI_DOUBLE
Definition: MpiComm.h:48
#define RawValue_MPI_UNSIGNED
Definition: MpiComm.h:49
int k
Definition: ann_sample.cpp:53
template<class P_V , class P_M , class Q_V , class Q_M >
void QUESO::ComputeCovCorrMatricesBetweenVectorRvs ( const BaseVectorRV< P_V, P_M > &  paramRv,
const BaseVectorRV< Q_V, Q_M > &  qoiRv,
unsigned int  localNumSamples,
P_M &  pqCovMatrix,
P_M &  pqCorrMatrix 
)

Definition at line 198 of file VectorRV.C.

References ComputeCovCorrMatricesBetweenVectorSequences(), QUESO::BaseVectorRV< V, M >::env(), QUESO::BaseVectorRV< V, M >::imageSet(), k, QUESO::VectorSpace< V, M >::numOfProcsForStorage(), queso_require_msg, QUESO::BaseVectorRealizer< V, M >::realization(), QUESO::BaseVectorRV< V, M >::realizer(), QUESO::VectorSet< V, M >::vectorSpace(), and QUESO::VectorSpace< V, M >::zeroVector().

204 {
205  // Check input data consistency
206  const BaseEnvironment& env = paramRv.env();
207 
208  bool useOnlyInter0Comm = (paramRv.imageSet().vectorSpace().numOfProcsForStorage() == 1) &&
209  (qoiRv.imageSet().vectorSpace().numOfProcsForStorage() == 1);
210 
211  queso_require_msg(useOnlyInter0Comm, "parallel vectors not supported yet");
212 
213  unsigned int numRows = paramRv.imageSet().vectorSpace().dim();
214  unsigned int numCols = qoiRv.imageSet().vectorSpace().dim();
215 
216  queso_require_msg(!((numRows != pqCovMatrix.numRows()) || (numCols != pqCovMatrix.numCols())), "inconsistent dimensions for covariance matrix");
217 
218  queso_require_msg(!((numRows != pqCorrMatrix.numRows()) || (numCols != pqCorrMatrix.numCols())), "inconsistent dimensions for correlation matrix");
219 
220  queso_require_msg(!((localNumSamples > paramRv.realizer().period()) || (localNumSamples > qoiRv.realizer().period())), "localNumSamples is too large");
221 
222  // For both P and Q vector sequences: fill them
223  P_V tmpP(paramRv.imageSet().vectorSpace().zeroVector());
224  Q_V tmpQ(qoiRv.imageSet().vectorSpace().zeroVector());
225 
226  SequenceOfVectors<P_V,P_M> localWorkingPSeq(paramRv.imageSet().vectorSpace(),
227  localNumSamples,
228  "covTmpP");
229  SequenceOfVectors<Q_V,Q_M> localWorkingQSeq(qoiRv.imageSet().vectorSpace(),
230  localNumSamples,
231  "covTmpQ");
232  for (unsigned int k = 0; k < localNumSamples; ++k) {
233  paramRv.realizer().realization(tmpP);
234  localWorkingPSeq.setPositionValues(k,tmpP);
235 
236  qoiRv.realizer().realization(tmpQ);
237  localWorkingQSeq.setPositionValues(k,tmpQ);
238  }
239 
241  localWorkingQSeq,
242  localNumSamples,
243  pqCovMatrix,
244  pqCorrMatrix);
245 
246  return;
247 }
const BaseVectorRealizer< V, M > & realizer() const
Finds a realization (sample) of the PDF of this vector RV; access to private attribute m_realizer...
Definition: VectorRV.C:95
const BaseEnvironment & env() const
QUESO environment; access to private attribute m_env.
Definition: VectorRV.C:72
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)
const V & zeroVector() const
Returns a vector filled with zeros.
Definition: VectorSpace.C:189
virtual void realization(V &nextValues) const =0
Performs a realization (sample) from a probability density function. See template specialization...
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
const VectorSet< V, M > & imageSet() const
Image set of the vector RV; access to private attribute m_imageSet.
Definition: VectorRV.C:79
unsigned int numOfProcsForStorage() const
Returns total number of processes.
Definition: VectorSpace.C:164
virtual const VectorSpace< V, M > & vectorSpace() const =0
Vector space to which this set belongs to. See template specialization.
int k
Definition: ann_sample.cpp:53
template<class P_V , class P_M , class Q_V , class Q_M >
void QUESO::ComputeCovCorrMatricesBetweenVectorSequences ( const BaseVectorSequence< P_V, P_M > &  subPSeq,
const BaseVectorSequence< Q_V, Q_M > &  subQSeq,
unsigned int  subNumSamples,
P_M &  pqCovMatrix,
P_M &  pqCorrMatrix 
)

Definition at line 2773 of file VectorSequence.C.

References QUESO::MpiComm::Allreduce(), QUESO::MpiComm::Barrier(), QUESO::VectorSpace< V, M >::dimGlobal(), QUESO::VectorSpace< V, M >::dimLocal(), QUESO::BaseVectorSequence< V, M >::getPositionValues(), QUESO::BaseEnvironment::inter0Comm(), QUESO::BaseEnvironment::inter0Rank(), k, QUESO::VectorSpace< V, M >::numOfProcsForStorage(), queso_require_greater_equal_msg, queso_require_less_equal_msg, queso_require_msg, RawValue_MPI_DOUBLE, RawValue_MPI_SUM, RawValue_MPI_UNSIGNED, QUESO::BaseVectorSequence< V, M >::subSequenceSize(), QUESO::BaseVectorSequence< V, M >::unifiedMeanExtra(), QUESO::BaseVectorSequence< V, M >::unifiedSampleVarianceExtra(), QUESO::BaseVectorSequence< V, M >::vectorSpace(), QUESO::BaseEnvironment::worldRank(), and QUESO::VectorSpace< V, M >::zeroVector().

Referenced by ComputeCovCorrMatricesBetweenVectorRvs(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::predictVUsAtGridPoint(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::predictWsAtGridPoint(), and QUESO::StatisticalForwardProblem< P_V, P_M, Q_V, Q_M >::solveWithMonteCarlo().

2779 {
2780  // Check input data consistency
2781  const BaseEnvironment& env = subPSeq.vectorSpace().zeroVector().env();
2782 
2783  bool useOnlyInter0Comm = (subPSeq.vectorSpace().numOfProcsForStorage() == 1) &&
2784  (subQSeq.vectorSpace().numOfProcsForStorage() == 1);
2785 
2786  queso_require_msg(useOnlyInter0Comm, "parallel vectors not supported yet");
2787 
2788  unsigned int numRowsLocal = subPSeq.vectorSpace().dimLocal();
2789  unsigned int numCols = subQSeq.vectorSpace().dimGlobal();
2790 
2791  queso_require_msg(!((numRowsLocal != pqCovMatrix.numRowsLocal()) || (numCols != pqCovMatrix.numCols())), "inconsistent dimensions for covariance matrix");
2792 
2793  queso_require_msg(!((numRowsLocal != pqCorrMatrix.numRowsLocal()) || (numCols != pqCorrMatrix.numCols())), "inconsistent dimensions for correlation matrix");
2794 
2795  queso_require_msg(!((subNumSamples > subPSeq.subSequenceSize()) || (subNumSamples > subQSeq.subSequenceSize())), "subNumSamples is too large");
2796 
2797  // For both P and Q vector sequences: fill them
2798  P_V tmpP(subPSeq.vectorSpace().zeroVector());
2799  Q_V tmpQ(subQSeq.vectorSpace().zeroVector());
2800 
2801  // For both P and Q vector sequences: compute the unified mean
2802  P_V unifiedMeanP(subPSeq.vectorSpace().zeroVector());
2803  subPSeq.unifiedMeanExtra(0,subNumSamples,unifiedMeanP);
2804 
2805  Q_V unifiedMeanQ(subQSeq.vectorSpace().zeroVector());
2806  subQSeq.unifiedMeanExtra(0,subNumSamples,unifiedMeanQ);
2807 
2808  // Compute "sub" covariance matrix
2809  for (unsigned i = 0; i < numRowsLocal; ++i) {
2810  for (unsigned j = 0; j < numCols; ++j) {
2811  pqCovMatrix(i,j) = 0.;
2812  }
2813  }
2814  for (unsigned k = 0; k < subNumSamples; ++k) {
2815  // For both P and Q vector sequences: get the difference (wrt the unified mean) in them
2816  subPSeq.getPositionValues(k,tmpP);
2817  tmpP -= unifiedMeanP;
2818 
2819  subQSeq.getPositionValues(k,tmpQ);
2820  tmpQ -= unifiedMeanQ;
2821 
2822  for (unsigned i = 0; i < numRowsLocal; ++i) {
2823  for (unsigned j = 0; j < numCols; ++j) {
2824  pqCovMatrix(i,j) += tmpP[i]*tmpQ[j];
2825  }
2826  }
2827  }
2828 
2829  // For both P and Q vector sequences: compute the unified variance
2830  P_V unifiedSampleVarianceP(subPSeq.vectorSpace().zeroVector());
2831  subPSeq.unifiedSampleVarianceExtra(0,
2832  subNumSamples,
2833  unifiedMeanP,
2834  unifiedSampleVarianceP);
2835 
2836  Q_V unifiedSampleVarianceQ(subQSeq.vectorSpace().zeroVector());
2837  subQSeq.unifiedSampleVarianceExtra(0,
2838  subNumSamples,
2839  unifiedMeanQ,
2840  unifiedSampleVarianceQ);
2841 
2842  // Compute unified covariance matrix
2843  if (useOnlyInter0Comm) {
2844  if (env.inter0Rank() >= 0) {
2845  unsigned int unifiedNumSamples = 0;
2846  env.inter0Comm().Allreduce((void *) &subNumSamples, (void *) &unifiedNumSamples, (int) 1, RawValue_MPI_UNSIGNED, RawValue_MPI_SUM,
2847  "ComputeCovCorrMatricesBetweenVectorSequences()",
2848  "failed MPI.Allreduce() for subNumSamples");
2849 
2850  for (unsigned i = 0; i < numRowsLocal; ++i) {
2851  for (unsigned j = 0; j < numCols; ++j) {
2852  double aux = 0.;
2853  env.inter0Comm().Allreduce((void *) &pqCovMatrix(i,j), (void *) &aux, (int) 1, RawValue_MPI_DOUBLE, RawValue_MPI_SUM,
2854  "ComputeCovCorrMatricesBetweenVectorSequences()",
2855  "failed MPI.Allreduce() for a matrix position");
2856  pqCovMatrix(i,j) = aux/((double) (unifiedNumSamples-1)); // Yes, '-1' in order to compensate for the 'N-1' denominator factor in the calculations of sample variances above (whose square roots will be used below)
2857  }
2858  }
2859 
2860  for (unsigned i = 0; i < numRowsLocal; ++i) {
2861  for (unsigned j = 0; j < numCols; ++j) {
2862  pqCorrMatrix(i,j) = pqCovMatrix(i,j)/std::sqrt(unifiedSampleVarianceP[i])/std::sqrt(unifiedSampleVarianceQ[j]);
2863  if (((pqCorrMatrix(i,j) + 1.) < -1.e-8) ||
2864  ((pqCorrMatrix(i,j) - 1.) > 1.e-8)) {
2865  if (env.inter0Rank() == 0) {
2866  std::cerr << "In ComputeCovCorrMatricesBetweenVectorSequences()"
2867  << ": worldRank = " << env.worldRank()
2868  << ", i = " << i
2869  << ", j = " << j
2870  << ", pqCorrMatrix(i,j)+1 = " << pqCorrMatrix(i,j)+1.
2871  << ", pqCorrMatrix(i,j)-1 = " << pqCorrMatrix(i,j)-1.
2872  << std::endl;
2873  }
2874  env.inter0Comm().Barrier();
2875  }
2877  (pqCorrMatrix(i,j), -1. - 1.e-8,
2878  "computed correlation is out of range");
2880  (pqCorrMatrix(i,j), 1. + 1.e-8,
2881  "computed correlation is out of range");
2882  }
2883  }
2884  }
2885  else {
2886  // Node not in the 'inter0' communicator: do nothing extra
2887  }
2888  }
2889  else {
2890  queso_require_msg(useOnlyInter0Comm, "parallel vectors not supported yet (2)");
2891  }
2892 
2893  return;
2894 }
unsigned int dimLocal() const
Definition: VectorSpace.C:170
#define RawValue_MPI_SUM
Definition: MpiComm.h:52
#define queso_require_less_equal_msg(expr1, expr2, msg)
Definition: asserts.h:89
virtual void unifiedMeanExtra(unsigned int initialPos, unsigned int numPos, V &unifiedMeanVec) const =0
Finds the mean value of the unified sequence of numPos positions starting at position initialPos...
const V & zeroVector() const
Returns a vector filled with zeros.
Definition: VectorSpace.C:189
unsigned int dimGlobal() const
Definition: VectorSpace.C:176
virtual void unifiedSampleVarianceExtra(unsigned int initialPos, unsigned int numPos, const V &unifiedMeanVec, V &unifiedSamVec) const =0
Finds the sample variance of the unified sequence, considering numPos positions starting at position ...
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
const VectorSpace< V, M > & vectorSpace() const
Vector space; access to protected attribute VectorSpace&lt;V,M&gt;&amp; m_vectorSpace.
virtual void getPositionValues(unsigned int posId, V &vec) const =0
Gets the values of the sequence at position posId and stores them at vec. See template specialization...
#define queso_require_greater_equal_msg(expr1, expr2, msg)
Definition: asserts.h:90
virtual unsigned int subSequenceSize() const =0
Size of the sub-sequence of vectors. See template specialization.
unsigned int numOfProcsForStorage() const
Returns total number of processes.
Definition: VectorSpace.C:164
#define RawValue_MPI_DOUBLE
Definition: MpiComm.h:48
#define RawValue_MPI_UNSIGNED
Definition: MpiComm.h:49
int k
Definition: ann_sample.cpp:53
template<class T >
void QUESO::ComputeSubGaussian2dKde ( const ScalarSequence< T > &  scalarSeq1,
const ScalarSequence< T > &  scalarSeq2,
unsigned int  initialPos,
double  scaleValue1,
double  scaleValue2,
const std::vector< T > &  evaluationPositions1,
const std::vector< T > &  evaluationPositions2,
std::vector< double > &  densityValues 
)

Definition at line 3897 of file ScalarSequence.C.

References ComputeCovCorrBetweenScalarSequences(), k, queso_require_equal_to_msg, queso_require_msg, and QUESO::ScalarSequence< T >::subSequenceSize().

Referenced by ComputeUnifiedGaussian2dKde().

3905 {
3906  queso_require_equal_to_msg(initialPos, 0, "not implemented yet for initialPos != 0");
3907 
3908  double covValue = 0.;
3909  double corrValue = 0.;
3911  scalarSeq2,
3912  scalarSeq1.subSequenceSize(),
3913  covValue,
3914  corrValue);
3915 
3916  bool bRC = ((initialPos < scalarSeq1.subSequenceSize()) &&
3917  (scalarSeq1.subSequenceSize() == scalarSeq2.subSequenceSize()) &&
3918  (0 < evaluationPositions1.size() ) &&
3919  (evaluationPositions1.size() == evaluationPositions2.size() ) &&
3920  (evaluationPositions1.size() == densityValues.size() ));
3921  queso_require_msg(bRC, "invalid input data");
3922 
3923  unsigned int dataSize = scalarSeq1.subSequenceSize() - initialPos;
3924  unsigned int numEvals = evaluationPositions1.size();
3925 
3926  double scale1Inv = 1./scaleValue1;
3927  double scale2Inv = 1./scaleValue2;
3928  //corrValue = 0.;
3929  double r = 1. - corrValue*corrValue;
3930  if (r <= 0.) { // prudencio 2010-07-23
3931  std::cerr << "In ComputeSubGaussian2dKde()"
3932  << ": WARNING, r = " << r
3933  << std::endl;
3934  }
3935 
3936  // scalarSeq1.env().worldRank(),
3937  // "ComputeSubGaussian2dKde()",
3938  // "negative r");
3939  for (unsigned int j = 0; j < numEvals; ++j) {
3940  double x1 = evaluationPositions1[j];
3941  double x2 = evaluationPositions2[j];
3942  double value = 0.;
3943  for (unsigned int k = 0; k < dataSize; ++k) {
3944  double d1k = scale1Inv*(x1 - scalarSeq1[initialPos+k]);
3945  double d2k = scale2Inv*(x2 - scalarSeq2[initialPos+k]);
3946  value += exp(-.5*( d1k*d1k + 2*corrValue*d1k*d2k + d2k*d2k )/r);
3947  }
3948  densityValues[j] = scale1Inv * scale2Inv * (value/(double) dataSize) / 2. / M_PI / sqrt(r);
3949  }
3950 
3951  return;
3952 }
void ComputeCovCorrBetweenScalarSequences(const ScalarSequence< T > &subPSeq, const ScalarSequence< T > &subQSeq, unsigned int subNumSamples, T &covValue, T &corrValue)
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
int k
Definition: ann_sample.cpp:53
template<class T >
void QUESO::ComputeUnifiedGaussian2dKde ( bool  useOnlyInter0Comm,
const ScalarSequence< T > &  scalarSeq1,
const ScalarSequence< T > &  scalarSeq2,
unsigned int  initialPos,
double  unifiedScaleValue1,
double  unifiedScaleValue2,
const std::vector< T > &  unifiedEvaluationPositions1,
const std::vector< T > &  unifiedEvaluationPositions2,
std::vector< double > &  unifiedDensityValues 
)

Definition at line 3956 of file ScalarSequence.C.

References ComputeSubGaussian2dKde(), QUESO::ScalarSequence< T >::env(), QUESO::BaseEnvironment::inter0Rank(), QUESO::BaseEnvironment::numSubEnvironments(), and queso_error_msg.

3965 {
3966  if (scalarSeq1.env().numSubEnvironments() == 1) {
3967  return ComputeSubGaussian2dKde(scalarSeq1,
3968  scalarSeq2,
3969  initialPos,
3970  unifiedScaleValue1,
3971  unifiedScaleValue2,
3972  unifiedEvaluationPositions1,
3973  unifiedEvaluationPositions2,
3974  unifiedDensityValues);
3975  }
3976 
3977  // As of 14/Nov/2009, this routine needs to be checked if it requires sub sequences to have equal size. Good.
3978 
3979  if (useOnlyInter0Comm) {
3980  if (scalarSeq1.env().inter0Rank() >= 0) {
3981  queso_error_msg("inter0 case not supported yet");
3982  }
3983  else {
3984  // Node not in the 'inter0' communicator
3985  ComputeSubGaussian2dKde(scalarSeq1,
3986  scalarSeq2,
3987  initialPos,
3988  unifiedScaleValue1,
3989  unifiedScaleValue2,
3990  unifiedEvaluationPositions1,
3991  unifiedEvaluationPositions2,
3992  unifiedDensityValues);
3993  }
3994  }
3995  else {
3996  queso_error_msg("parallel vectors not supported yet");
3997  }
3998 
3999  //scalarSeq1.env().fullComm().Barrier();
4000 
4001  return;
4002 }
void ComputeSubGaussian2dKde(const ScalarSequence< T > &scalarSeq1, const ScalarSequence< T > &scalarSeq2, unsigned int initialPos, double scaleValue1, double scaleValue2, const std::vector< T > &evaluationPositions1, const std::vector< T > &evaluationPositions2, std::vector< double > &densityValues)
#define queso_error_msg(msg)
Definition: asserts.h:47
template<class V , class M >
void QUESO::CovCond ( double  condNumber,
const V &  direction,
M &  covMatrix,
M &  precMatrix 
)

Definition at line 30 of file CovCond.C.

References leftDiagScaling(), and matrixProduct().

32 {
33  //std::cout << "Entering CovCond()"
34  // << std::endl;
35 
36  V v1(direction);
37  //std::cout << "In CovCond(), v1 contents are:"
38  // << std::endl
39  // << v1
40  // << std::endl;
41 
42  V v2(direction,condNumber,1.0); // MATLAB linspace
43  v2.cwInvert();
44  v2.sort();
45  //std::cout << "In CovCond(), v2 contents are:"
46  // << std::endl
47  // << v2
48  // << std::endl;
49 
50  double v1Norm2 = v1.norm2();
51  if (v1[0] >=0) v1[0] += v1Norm2;
52  else v1[0] -= v1Norm2;
53  double v1Norm2Sq = v1.norm2Sq();
54 
55  M Z(direction,1.0);
56  Z -= (2./v1Norm2Sq) * matrixProduct(v1,v1);
57  //std::cout << "In CovCond(), Z contents are:"
58  // << std::endl
59  // << Z
60  // << std::endl;
61 
62  M Zt(Z.transpose());
63  covMatrix = Z * leftDiagScaling(v2, Zt);
64  precMatrix = Z * leftDiagScaling(1./v2,Zt);
65 
66  //std::cout << "Leaving CovCond()"
67  // << std::endl;
68 }
GslMatrix leftDiagScaling(const GslVector &vec, const GslMatrix &mat)
Definition: GslMatrix.C:2042
GslMatrix matrixProduct(const GslVector &v1, const GslVector &v2)
Definition: GslMatrix.C:2026
int QUESO::GRVY_CheckDir ( const char *  dirname)

Definition at line 456 of file Miscellaneous.C.

Referenced by CheckFilePath().

457 {
458  struct stat st;
459 
460  if(stat(dirname,&st) != 0)
461  {
462  if( mkdir(dirname,0700) != 0 )
463  {
464  std::cerr << __func__ << ": error - unable to create directory " << dirname << std::endl;
465  return -1;
466  }
467  }
468  else if (!S_ISDIR(st.st_mode))
469  {
470  std::cerr << __func__ << ": error - entry exists, but is not a directory " << dirname << std::endl;
471  return -1;
472  }
473 
474  return 0;
475 }
template<class T >
double QUESO::horizontalDistance ( const BaseScalarCdf< T > &  cdf1,
const BaseScalarCdf< T > &  cdf2,
double  epsilon 
)

It calculated the maximum horizontal distance between two CDFs.

Definition at line 96 of file ScalarCdf.C.

References QUESO::BaseEnvironment::displayVerbosity(), QUESO::BaseScalarCdf< T >::env(), QUESO::BaseScalarCdf< T >::inverse(), QUESO::BaseScalarCdf< T >::prefix(), QUESO::BaseEnvironment::subDisplayFile(), and QUESO::BaseScalarCdf< T >::value().

Referenced by horizontalDistances().

99 {
100  double maxDistance = 0.;
101  double xForMaxDistance = 0.;
102 
103  double x1 = cdf1.inverse(epsilon*.5);
104  double x2 = cdf1.inverse(1.-epsilon*.5);
105  if (cdf1.env().subDisplayFile()) {
106  *cdf1.env().subDisplayFile() << "In horizontalDistance()"
107  << ", cdf1.prefix() = " << cdf1.prefix()
108  << ", cdf2.prefix() = " << cdf2.prefix()
109  << ", epsilon = " << epsilon
110  << ": x1 = " << x1
111  << ", x2 = " << x2
112  << std::endl;
113  }
114 
115  //if (cdf1.env().subDisplayFile()) {
116  // *cdf1.env().subDisplayFile() << "In horizontalDistance: x1 = " << x1
117  // << ", x2 = " << x2
118  // << std::endl;
119  //}
120 
121  double numEvaluationPoints = 1001.;
122  for (double i = 0.; i < numEvaluationPoints; ++i) {
123  double ratio = i/(numEvaluationPoints-1.); // IMPORTANT: Yes, '-1.'
124  double x = (1.-ratio)*x1 + ratio*x2;
125  double y = cdf2.inverse(cdf1.value(x));
126  double d = fabs(x-y);
127  if ((cdf1.env().subDisplayFile()) && (cdf1.env().displayVerbosity() >= 3)) {
128  *cdf1.env().subDisplayFile() << "In horizontalDistance"
129  << ": i = " << i
130  << ", x = " << x
131  << ", cdf1.value(x) = " << cdf1.value(x)
132  << ", y = " << y
133  << ", d = " << d
134  << ", currentMaxDistance = " << maxDistance
135  << std::endl;
136  }
137  if (maxDistance < d) {
138  maxDistance = d;
139  xForMaxDistance = x;
140  if ((cdf1.env().subDisplayFile()) && (cdf1.env().displayVerbosity() >= 3)) {
141  *cdf1.env().subDisplayFile() << "In horizontalDistance"
142  << ": i = " << i
143  << ", NOW maxDistance = " << maxDistance
144  << ", xForMaxDistance = " << xForMaxDistance
145  << std::endl;
146  }
147  }
148  }
149 
150  if (cdf1.env().subDisplayFile()) {
151  *cdf1.env().subDisplayFile() << "In horizontalDistance()"
152  << ", cdf1.prefix() = " << cdf1.prefix()
153  << ", cdf2.prefix() = " << cdf2.prefix()
154  << ", epsilon = " << epsilon
155  << ": maxDistance = " << maxDistance
156  << ", xForMaxDistance = " << xForMaxDistance
157  << std::endl;
158  }
159 
160  return maxDistance;
161 }
double epsilon
Definition: ann_test.cpp:484
template<class V , class M >
void QUESO::horizontalDistances ( const BaseVectorCdf< V, M > &  cdf1,
const BaseVectorCdf< V, M > &  cdf2,
const V &  epsilonVec,
V &  distances 
)

It calculated the maximum horizontal distances between two vector CDFs.

Definition at line 89 of file VectorCdf.C.

References QUESO::BaseVectorCdf< V, M >::cdf(), horizontalDistance(), and QUESO::BaseVectorCdf< V, M >::pdfSupport().

93 {
94  for (unsigned int i = 0; i < cdf1.pdfSupport().vectorSpace().dimLocal(); ++i) {
95  distances[i] = horizontalDistance(cdf1.cdf(i),
96  cdf2.cdf(i),
97  epsilonVec[i]);
98  }
99 
100  return;
101 }
double horizontalDistance(const BaseScalarCdf< T > &cdf1, const BaseScalarCdf< T > &cdf2, double epsilon)
It calculated the maximum horizontal distance between two CDFs.
Definition: ScalarCdf.C:96
template<class V , class M >
VectorSet< V, M > * QUESO::InstantiateIntersection ( const VectorSet< V, M > &  domain1,
const VectorSet< V, M > &  domain2 
)

This method calculates the intersection of domain1 and domain2.

It is used, for instance, to calculate the domain of the Posterior PDF, which is the intersection of the domain of the Prior PDF and of the likelihood function.

Definition at line 37 of file InstantiateIntersection.C.

References QUESO::VectorSpace< V, M >::dimGlobal(), QUESO::VectorSpace< V, M >::env(), QUESO::BoxSubset< V, M >::maxValues(), QUESO::BoxSubset< V, M >::minValues(), QUESO::VectorSet< V, M >::prefix(), queso_error_msg, QUESO::VectorSubset< V, M >::vectorSpace(), and QUESO::VectorSet< V, M >::vectorSpace().

Referenced by QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::calibrateWithBayesMetropolisHastings(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::calibrateWithBayesMLSampling(), QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMetropolisHastings(), and QUESO::StatisticalInverseProblem< P_V, P_M >::solveWithBayesMLSampling().

38 {
39  VectorSet<V,M>* result = NULL;
40 
41  unsigned int dim1 = domain1.vectorSpace().dimGlobal();
42  unsigned int dim2 = domain2.vectorSpace().dimGlobal();
43 
44  if (result == NULL) {
45  const VectorSpace<V,M>* tmp1 = dynamic_cast<const VectorSpace<V,M>* >(&domain1);
46  const VectorSpace<V,M>* tmp2 = dynamic_cast<const VectorSpace<V,M>* >(&domain2);
47 
48  if ((tmp1 != NULL) && (tmp2 != NULL)) {
49  if (dim1 < dim2) {
50  result = new VectorSpace<V,M>(tmp1->env(),
51  tmp1->prefix().c_str(),
52  tmp1->dimGlobal(),
53  NULL);//tmp1->componentsNames());
54  }
55  else if (dim1 == dim2) {
56  result = new VectorSpace<V,M>(tmp1->env(),
57  tmp1->prefix().c_str(),
58  tmp1->dimGlobal(),
59  NULL);//tmp1->componentsNames());
60  }
61  else {
62  result = new VectorSpace<V,M>(tmp2->env(),
63  tmp2->prefix().c_str(),
64  tmp2->dimGlobal(),
65  NULL);//tmp2->componentsNames());
66  }
67  }
68  }
69 
70  if (result == NULL) {
71  const VectorSubset<V,M>* tmp1 = dynamic_cast<const VectorSubset<V,M>* >(&domain1);
72  const VectorSubset<V,M>* tmp2 = dynamic_cast<const VectorSubset<V,M>* >(&domain2);
73 
74  if ((tmp1 != NULL) && (tmp2 != NULL)) {
75  if (dim1 == dim2) {
76  const BoxSubset<V,M>* box1 = dynamic_cast<const BoxSubset<V,M>* >(&domain1);
77  const BoxSubset<V,M>* box2 = dynamic_cast<const BoxSubset<V,M>* >(&domain2);
78 
79  if ((box1 != NULL) && (box2 != NULL)) {
80  V minV(box1->minValues());
81  V maxV(box1->maxValues());
82  for (unsigned int i = 0; i < dim1; ++i) {
83  minV[i] = std::max(box1->minValues()[i],
84  box2->minValues()[i]);
85  }
86  for (unsigned int i = 0; i < dim1; ++i) {
87  maxV[i] = std::min(box1->maxValues()[i],
88  box2->maxValues()[i]);
89  }
90  result = new BoxSubset<V,M>(box1->prefix().c_str(),
91  box1->vectorSpace(),
92  minV,
93  maxV);
94  }
95  else {
96  result = new IntersectionSubset<V,M>(tmp1->prefix().c_str(),
97  tmp1->vectorSpace(),
98  0., // FIX ME
99  domain1,
100  domain2);
101  }
102  }
103  else {
104  queso_error_msg("situation 001");
105  }
106  }
107  }
108 
109  if (result == NULL) {
110  const VectorSubset<V,M>* tmp1 = dynamic_cast<const VectorSubset<V,M>* >(&domain1);
111  const VectorSpace <V,M>* tmp2 = dynamic_cast<const VectorSpace <V,M>* >(&domain2);
112 
113  if ((tmp1 != NULL) && (tmp2 != NULL)) {
114  if (dim1 == dim2) {
115  const BoxSubset<V,M>* box1 = dynamic_cast<const BoxSubset<V,M>* >(&domain1);
116  if (box1 != NULL) {
117  result = new BoxSubset<V,M>(box1->prefix().c_str(),
118  box1->vectorSpace(),
119  box1->minValues(),
120  box1->maxValues());
121  }
122  else {
123  queso_error_msg("situation 002");
124  }
125  }
126  else {
127  queso_error_msg("situation 003");
128  }
129  }
130  }
131 
132  if (result == NULL) {
133  const VectorSpace <V,M>* tmp1 = dynamic_cast<const VectorSpace <V,M>* >(&domain1);
134  const VectorSubset<V,M>* tmp2 = dynamic_cast<const VectorSubset<V,M>* >(&domain2);
135 
136  if ((tmp1 != NULL) && (tmp2 != NULL)) {
137  if (dim1 == dim2) {
138  const BoxSubset<V,M>* box2 = dynamic_cast<const BoxSubset<V,M>* >(&domain2);
139  if (box2 != NULL) {
140  result = new BoxSubset<V,M>(box2->prefix().c_str(),
141  box2->vectorSpace(),
142  box2->minValues(),
143  box2->maxValues());
144  }
145  else {
146  queso_error_msg("situation 004");
147  }
148  }
149  else {
150  queso_error_msg("situation 005");
151  }
152  }
153  }
154 
155  if (result == NULL) {
156  queso_error_msg("situation 006");
157  }
158 
159  return result;
160 }
#define queso_error_msg(msg)
Definition: asserts.h:47
GslMatrix QUESO::leftDiagScaling ( const GslVector &  vec,
const GslMatrix &  mat 
)

Definition at line 2042 of file GslMatrix.C.

References QUESO::GslMatrix::numCols(), QUESO::GslMatrix::numRowsLocal(), queso_require_equal_to_msg, and QUESO::GslVector::sizeLocal().

Referenced by CovCond().

2043 {
2044  unsigned int vSize = vec.sizeLocal();
2045  unsigned int mRows = mat.numRowsLocal();
2046  unsigned int mCols = mat.numCols();
2047 
2048  queso_require_equal_to_msg(vSize, mRows, "size of vector is different from the number of rows in matrix");
2049 
2050  queso_require_equal_to_msg(mCols, mRows, "routine currently works for square matrices only");
2051 
2052  GslMatrix answer(mat);
2053  for (unsigned int i = 0; i < mRows; ++i) {
2054  double vecValue = vec[i];
2055  for (unsigned int j = 0; j < mCols; ++j) {
2056  answer(i,j) *= vecValue;
2057  }
2058  }
2059 
2060  return answer;
2061 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
GslMatrix QUESO::matrixProduct ( const GslVector &  v1,
const GslVector &  v2 
)

Definition at line 2026 of file GslMatrix.C.

References QUESO::Vector::env(), QUESO::Vector::map(), and QUESO::GslVector::sizeLocal().

Referenced by CovCond(), QUESO::SequenceOfVectors< V, M >::estimateConvBrooksGelman(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step04_inter0(), and QUESO::MetropolisHastingsSG< P_V, P_M >::updateAdaptedCovMatrix().

2027 {
2028  unsigned int nRows = v1.sizeLocal();
2029  unsigned int nCols = v2.sizeLocal();
2030  GslMatrix answer(v1.env(),v1.map(),nCols);
2031 
2032  for (unsigned int i = 0; i < nRows; ++i) {
2033  double value1 = v1[i];
2034  for (unsigned int j = 0; j < nCols; ++j) {
2035  answer(i,j) = value1*v2[j];
2036  }
2037  }
2038 
2039  return answer;
2040 }
template<class T >
bool QUESO::MiscCheckForSameValueInAllNodes ( T &  inputValue,
double  acceptableTreshold,
const MpiComm &  comm,
const char *  whereString 
)

Definition at line 479 of file Miscellaneous.C.

References QUESO::MpiComm::Allreduce(), QUESO::MpiComm::Barrier(), QUESO::MpiComm::Bcast(), QUESO::MpiComm::MyPID(), QUESO::MpiComm::NumProc(), queso_require_less_equal_msg, RawValue_MPI_DOUBLE, RawValue_MPI_SUM, and RawValue_MPI_UNSIGNED.

Referenced by QUESO::MLSampling< P_V, P_M >::generateSequence_Step03_inter0(), and QUESO::MLSampling< P_V, P_M >::generateSequence_Step09_all().

483 {
484  // Filter out those nodes that should not participate
485  if (comm.MyPID() < 0) return true;
486 
487  double localValue = (double) inputValue;
488  double sumValue = 0.;
489  comm.Allreduce((void *) &localValue, (void *) &sumValue, (int) 1, RawValue_MPI_DOUBLE, RawValue_MPI_SUM,
490  whereString,
491  "failed MPI on 'sumValue' inside MiscCheckForSameValueInAllNodes()");
492 
493  double totalNumNodes = (double) comm.NumProc();
494  double testValue = fabs(1. - localValue/(sumValue/totalNumNodes));
495  unsigned int boolSum = 0;
496 #if 1
497  unsigned int boolResult = 0;
498  if (testValue > acceptableTreshold) boolResult = 1;
499  comm.Allreduce((void *) &boolResult, (void *) &boolSum, (int) 1, RawValue_MPI_UNSIGNED, RawValue_MPI_SUM,
500  whereString,
501  "failed MPI on 'boolSum' inside MiscCheckForSameValueInAllNodes()");
502 
503  if (boolSum > 0) {
504  comm.Barrier();
505  for (int i = 0; i < comm.NumProc(); ++i) {
506  if (i == comm.MyPID()) {
507  std::cerr << "WARNING, "
508  << whereString
509  << ", inside MiscCheckForSameValueInAllNodes()"
510  << ", rank (in this communicator) = " << i
511  << ": boolSum = " << boolSum
512  << ", localValue = " << localValue
513  << ", sumValue = " << sumValue
514  << ", totalNumNodes = " << totalNumNodes
515  << ", avgValue = " << (sumValue/totalNumNodes)
516  << ", relativeTest = " << testValue
517  << std::endl;
518  }
519  comm.Barrier();
520  }
521  comm.Barrier();
522 
523  comm.Bcast((void *) &localValue, (int) 1, RawValue_MPI_DOUBLE, 0,
524  whereString,
525  "failed MPI on 'boolSum' inside MiscCheckForSameValueInAllNodes()");
526  inputValue = localValue; // IMPORTANT
527  }
528 #else
529  queso_require_less_equal_msg(testValue, acceptableTreshold, "not all nodes have the same value inside MiscCheckForSameValueInAllNodes()");
530 #endif
531 
532  return (boolSum == 0);
533 }
#define RawValue_MPI_SUM
Definition: MpiComm.h:52
#define queso_require_less_equal_msg(expr1, expr2, msg)
Definition: asserts.h:89
#define RawValue_MPI_DOUBLE
Definition: MpiComm.h:48
#define RawValue_MPI_UNSIGNED
Definition: MpiComm.h:49
template<class V1 , class V2 >
void QUESO::MiscCheckTheParallelEnvironment ( const V1 &  vec1,
const V2 &  vec2 
)

Definition at line 564 of file Miscellaneous.C.

References QUESO::BaseEnvironment::fullComm(), QUESO::MpiComm::NumProc(), QUESO::BaseEnvironment::numSubEnvironments(), queso_error_msg, queso_require_equal_to_msg, QUESO::BaseEnvironment::subComm(), and QUESO::BaseEnvironment::subRank().

565 {
566  const BaseEnvironment& env = vec1.env();
567 
568  if (env.numSubEnvironments() == (unsigned int) env.fullComm().NumProc()) {
569  queso_require_equal_to_msg(env.subRank(), 0, "there should exist only one processor per sub environment");
570  queso_require_equal_to_msg(vec1.numOfProcsForStorage(), 1,
571  "only 1 processor (per sub environment) should be necessary for the storage of a parameter vector");
572  queso_require_equal_to_msg(vec2.numOfProcsForStorage(), 1,
573  "only 1 processor (per sub environment) should be necessary for the storage of a parameter vector");
574  }
575  else if (env.numSubEnvironments() < (unsigned int) env.fullComm().NumProc()) {
576  queso_require_equal_to_msg(env.fullComm().NumProc()%env.numSubEnvironments(), 0, "total number of processors should be a multiple of the number of sub environments");
577  unsigned int numProcsPerSubEnvironment = env.fullComm().NumProc()/env.numSubEnvironments();
578  queso_require_equal_to_msg(env.subComm().NumProc(), (int) numProcsPerSubEnvironment, "inconsistent number of processors per sub environment");
579  if ((vec1.numOfProcsForStorage() == 1) &&
580  (vec2.numOfProcsForStorage() == 1)) {
581  // Ok
582  }
583  else if ((vec1.numOfProcsForStorage() == numProcsPerSubEnvironment) &&
584  (vec2.numOfProcsForStorage() == numProcsPerSubEnvironment)) {
585  queso_error_msg("parallel vectors are not supported yet");
586  }
587  else {
588  queso_error_msg("number of processors required for a vector storage should be equal to either 1 or to the number of processors in the sub environment");
589  }
590  }
591  else {
592  queso_error_msg("number of processors per sub environment is less than 1!");
593  }
594 
595  return;
596 }
#define queso_error_msg(msg)
Definition: asserts.h:47
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
template<class V >
void QUESO::MiscComputePositionsBetweenMinMax ( minValues,
maxValues,
std::vector< V * > &  positions 
)

Definition at line 537 of file Miscellaneous.C.

540 {
541  double factor = 0.5;
542  switch (positions.size()) {
543  case 0:
544  // Do nothing
545  break;
546 
547  case 1:
548  positions[0] = new V((1. - factor) * minValues + factor * maxValues);
549  break;
550 
551  default:
552  for (unsigned int i = 0; i < positions.size(); ++i) {
553  factor = ((double) i)/(((double) positions.size()) - 1.);
554  positions[i] = new V((1. - factor) * minValues + factor * maxValues);
555  }
556  break;
557  }
558 
559  return;
560 }
double QUESO::MiscDoubleDebugMessage ( double  value,
const char *  message 
)

Definition at line 334 of file Miscellaneous.C.

337 {
338  if (message) {
339  std::cout << "Passing in MiscDoubleDebugMessage(), value = " << value << ", message = " << message << std::endl;
340  }
341  return value;
342 }
double QUESO::MiscGammar ( double  a,
double  b,
const RngBase *  rngObject 
)

Definition at line 248 of file Miscellaneous.C.

References QUESO::RngBase::gaussianSample(), and QUESO::RngBase::uniformSample().

252 {
253  double result = 0.;
254  if (a < 1.) {
255  result = MiscGammar(1.+a,b,rngObject)*std::pow( rngObject->uniformSample(),1./a );
256  }
257  else {
258  double d = a-1./3.;
259  double c = 1./std::sqrt(9.*d);
260  double x = 0.;
261  double w = 0.;
262  while (1) {
263  while (1) {
264  x = rngObject->gaussianSample(1.);
265  w = 1.+c*x;
266  if (w > 0.) break;
267  }
268  w = std::pow(w,3.);
269  double u = rngObject->uniformSample();
270  double compValue = 1.-0.0331*std::pow(x,4.);
271  if (u < compValue) break;
272  compValue = 0.5*std::pow(x,2.)+d*(1.-w+log(w));
273  if (log(u) < compValue) break;
274  }
275  result = b*d*w;
276  }
277 
278  return result;
279 }
double MiscGammar(double a, double b, const RngBase *rngObject)
double QUESO::MiscGaussianDensity ( double  x,
double  mu,
double  sigma 
)

Definition at line 306 of file Miscellaneous.C.

Referenced by QUESO::ArrayOfSequences< V, M >::gaussianKDE(), QUESO::ScalarSequence< T >::subGaussian1dKde(), and QUESO::ScalarSequence< T >::unifiedGaussian1dKde().

307 {
308  double sigma2 = sigma*sigma;
309  double diff = x-mu;
310 
311  return (1./std::sqrt(2*M_PI*sigma2))*std::exp(-.5*diff*diff/sigma2);
312 }
double QUESO::MiscGetEllapsedSeconds ( struct timeval *  timeval0)

Definition at line 282 of file Miscellaneous.C.

Referenced by QUESO::MonteCarloSG< P_V, P_M, Q_V, Q_M >::actualGenerateSequence(), QUESO::MetropolisHastingsSG< P_V, P_M >::adapt(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::calibrateWithBayesMetropolisHastings(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::calibrateWithBayesMLSampling(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::calibrateWithLanlMcmc(), QUESO::MLSampling< P_V, P_M >::generateBalLinkedChains_all(), QUESO::MetropolisHastingsSG< P_V, P_M >::generateFullChain(), QUESO::MLSampling< P_V, P_M >::generateSequence(), QUESO::MLSampling< P_V, P_M >::generateSequence_Level0_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step01_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step02_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step03_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step04_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step05_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step06_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step07_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step08_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step09_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step10_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step11_inter0(), QUESO::MLSampling< P_V, P_M >::generateUnbLinkedChains_all(), QUESO::MLSampling< P_V, P_M >::justBalance_proc0(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::likelihoodRoutine(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::predictVUsAtGridPoint(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::predictWsAtGridPoint(), QUESO::SequenceOfVectors< V, M >::unifiedReadContents(), QUESO::ScalarSequence< T >::unifiedReadContents(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), and QUESO::ScalarSequence< T >::unifiedWriteContents().

283 {
284  double result = 0.;
285 
286  struct timeval timevalNow;
287  /*int iRC;*/
288  /*iRC = */gettimeofday(&timevalNow, NULL);
289 
290  result = (double) (timevalNow.tv_sec - timeval0->tv_sec );
291  result *= 1.e+6;
292  result += (double) (timevalNow.tv_usec - timeval0->tv_usec);
293  result *= 1.e-6;
294 
295  return result;
296 }
double QUESO::MiscHammingWindow ( unsigned int  N,
unsigned int  j 
)

Definition at line 298 of file Miscellaneous.C.

299 {
300  double angle = 2.*M_PI*((double) j)/((double) N);
301  double result = 0.53836 - 0.46164*cos(angle);
302 
303  return result;
304 }
int QUESO::MiscIntDebugMessage ( int  value,
const char *  message 
)

Definition at line 324 of file Miscellaneous.C.

327 {
328  if (message) {
329  std::cout << "Passing in MiscIntDebugMessage(), value = " << value << ", message = " << message << std::endl;
330  }
331  return value;
332 }
int QUESO::MiscReadCharsAndDoubleFromFile ( std::ifstream &  ifs,
std::string &  termString,
double *  termValue,
bool &  endOfLineAchieved 
)

Definition at line 191 of file Miscellaneous.C.

References UQ_FAILED_READING_FILE_RC, and UQ_OK_RC.

Referenced by QUESO::AsciiTable< V, M >::readColumnsFromFile().

196 {
197  int iRC = UQ_OK_RC;
198  endOfLineAchieved = false;
199 
200  char c = ' ';
201  while (c == ' ') {
202  ifs.get(c);
203  if ((ifs.rdstate() & std::ifstream::failbit)) {
205  break;
206  }
207  };
208 
209  char term[512];
210  unsigned int pos = 0;
211 
212  if (!iRC) {
213  while ((pos < 512) && (c != '\n') && (c != '\0') && (c != ' ')) {
214  term[pos++] = c;
215  if ((ifs.rdstate() & std::ifstream::failbit)) {
217  break;
218  }
219  ifs.get(c);
220  };
221  }
222 
223  if (!iRC) {
224  if (c == '\n') endOfLineAchieved = true;
225  term[pos] = '\0';
226  termString = term;
227  //std::cout << "Read chars = " << termString << std::endl;
228  if (termValue) {
229  if (termString == std::string("inf")) {
230  *termValue = INFINITY;
231  }
232  else if (termString == std::string("-inf")) {
233  *termValue = -INFINITY;
234  }
235  else if (termString == std::string("nan")) {
236  *termValue = nan("");
237  }
238  else {
239  *termValue = strtod(termString.c_str(),NULL);
240  }
241  }
242  }
243 
244  return iRC;
245 }
const int UQ_FAILED_READING_FILE_RC
Definition: Defines.h:85
const int UQ_OK_RC
Definition: Defines.h:76
void QUESO::MiscReadDoublesFromString ( const std::string &  inputString,
std::vector< double > &  outputDoubles 
)

Definition at line 40 of file Miscellaneous.C.

References queso_require_not_equal_to_msg.

Referenced by BoostInputOptionsParser::getOption< std::vector< double, std::allocator< double > > >(), QUESO::ExperimentModelOptions::getMyOptionValues(), QUESO::SimulationModelOptions::getMyOptionValues(), QUESO::GpmsaComputerModelOptions::getMyOptionValues(), QUESO::StatisticalForwardProblemOptions::getMyOptionValues(), QUESO::StatisticalInverseProblemOptions::getMyOptionValues(), QUESO::MonteCarloSGOptions::getMyOptionValues(), QUESO::EnvironmentOptions::getMyOptionValues(), QUESO::MetropolisHastingsSGOptions::getMyOptionValues(), and QUESO::BoostInputOptionsParser::getOption().

43 {
44  //std::cout << "In MiscReadDoublesFromString()"
45  // << ": inputString = " << inputString
46  // << std::endl;
47  outputDoubles.clear();
48  bool aDoubleIsBeingRead = false;
49  std::string::size_type positionOfFirstChar = 0;
50  std::string::size_type numberOfChars = 0;
51  for (std::string::size_type i = 0; i < inputString.size(); ++i) {
52  queso_require_not_equal_to_msg(inputString[i], '\0', "character '\0' should not be found!");
53  if (inputString[i] == ' ') {
54  if (aDoubleIsBeingRead == true) {
55  // We just finished reading the current string/double. Convert string to double now.
56  char tmpVar[numberOfChars+1];
57  for (std::string::size_type j = 0; j < numberOfChars; ++j) {
58  tmpVar[j] = inputString[positionOfFirstChar+j];
59  }
60  tmpVar[numberOfChars] = '\0';
61  outputDoubles.push_back(strtod(tmpVar,NULL));
62 
63  // Continue loop
64  aDoubleIsBeingRead = false;
65  positionOfFirstChar = 0;
66  numberOfChars = 0;
67  }
68  }
69  else {
70  if (aDoubleIsBeingRead == false) {
71  aDoubleIsBeingRead = true;
72  positionOfFirstChar = i;
73  }
74  numberOfChars++;
75  }
76  } // for
77  if (aDoubleIsBeingRead == true) {
78  // We just finished reading the current string/double. Convert string to double now.
79  char tmpVar[numberOfChars+1];
80  for (std::string::size_type j = 0; j < numberOfChars; ++j) {
81  tmpVar[j] = inputString[positionOfFirstChar+j];
82  }
83  tmpVar[numberOfChars] = '\0';
84  outputDoubles.push_back(strtod(tmpVar,NULL));
85  }
86  std::vector<double>(outputDoubles).swap(outputDoubles);
87 
88  return;
89 }
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
int QUESO::MiscReadStringAndDoubleFromFile ( std::ifstream &  ifs,
std::string &  termString,
double *  termValue 
)

Definition at line 160 of file Miscellaneous.C.

References UQ_FAILED_READING_FILE_RC, and UQ_OK_RC.

Referenced by QUESO::AsciiTable< V, M >::readColumnsFromFile().

164 {
165  int iRC = UQ_OK_RC;
166 
167  ifs >> termString;
168  if ((ifs.rdstate() & std::ifstream::failbit)) {
170  }
171  else if (termValue) {
172  if (termString == std::string("inf")) {
173  *termValue = INFINITY;
174  }
175  else if (termString == std::string("-inf")) {
176  *termValue = -INFINITY;
177  }
178  else if (termString == std::string("nan")) {
179  *termValue = nan("");
180  }
181  else {
182  *termValue = strtod(termString.c_str(),NULL);
183  }
184  }
185  //if (!iRC) std::cout << "Read termString = " << termString << std::endl;
186 
187  return iRC;
188 }
const int UQ_FAILED_READING_FILE_RC
Definition: Defines.h:85
const int UQ_OK_RC
Definition: Defines.h:76
void QUESO::MiscReadWordsFromString ( const std::string &  inputString,
std::vector< std::string > &  outputWords 
)

Definition at line 92 of file Miscellaneous.C.

References queso_require_not_equal_to_msg.

95 {
96  //std::cout << "In MiscReadWordsFromString()"
97  // << ": inputString = " << inputString
98  // << std::endl;
99  outputWords.clear();
100  bool aWordIsBeingRead = false;
101  std::string::size_type positionOfFirstChar = 0;
102  std::string::size_type numberOfChars = 0;
103  for (std::string::size_type i = 0; i < inputString.size(); ++i) {
104  queso_require_not_equal_to_msg(inputString[i], '\0', "character '\0' should not be found!");
105  if (inputString[i] == ' ') {
106  if (aWordIsBeingRead == true) {
107  // We just finished reading the current string/word.
108  char tmpVar[numberOfChars+1];
109  for (std::string::size_type j = 0; j < numberOfChars; ++j) {
110  tmpVar[j] = inputString[positionOfFirstChar+j];
111  }
112  tmpVar[numberOfChars] = '\0';
113  outputWords.push_back(tmpVar);
114 
115  // Continue loop
116  aWordIsBeingRead = false;
117  positionOfFirstChar = 0;
118  numberOfChars = 0;
119  }
120  }
121  else {
122  if (aWordIsBeingRead == false) {
123  aWordIsBeingRead = true;
124  positionOfFirstChar = i;
125  }
126  numberOfChars++;
127  }
128  } // for
129  if (aWordIsBeingRead == true) {
130  // We just finished reading the current string/word.
131  char tmpVar[numberOfChars+1];
132  for (std::string::size_type j = 0; j < numberOfChars; ++j) {
133  tmpVar[j] = inputString[positionOfFirstChar+j];
134  }
135  tmpVar[numberOfChars] = '\0';
136  outputWords.push_back(tmpVar);
137  }
138  std::vector<std::string>(outputWords).swap(outputWords);
139 
140  return;
141 }
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
unsigned int QUESO::MiscUintDebugMessage ( unsigned int  value,
const char *  message 
)

Definition at line 314 of file Miscellaneous.C.

317 {
318  if (message) {
319  std::cout << "Passing in MiscUintDebugMessage(), value = " << value << ", message = " << message << std::endl;
320  }
321  return value;
322 }
int QUESO::MyWorldfullRank ( )

Returns the rank of the calling process in the communicator.

Definition at line 30 of file Defines.C.

30  {
31  int result = 0;
32  int iRC;
33  iRC = MPI_Comm_rank(MPI_COMM_WORLD,&result);
34  if (iRC) {}; // just to remove compiler warning
35  return result;
36 }
GslVector QUESO::operator* ( double  a,
const GslVector &  x 
)

Definition at line 1134 of file GslVector.C.

1135 {
1136  GslVector answer(x);
1137  answer *= a;
1138 
1139  return answer;
1140 }
GslVector QUESO::operator* ( const GslVector &  x,
const GslVector &  y 
)

Definition at line 1142 of file GslVector.C.

1143 {
1144  GslVector answer(x);
1145  answer *= y;
1146 
1147  return answer;
1148 }
GslMatrix QUESO::operator* ( double  a,
const GslMatrix &  mat 
)

Definition at line 1972 of file GslMatrix.C.

1973 {
1974  GslMatrix answer(mat);
1975  answer *= a;
1976  return answer;
1977 }
GslVector QUESO::operator* ( const GslMatrix &  mat,
const GslVector &  vec 
)

Definition at line 1979 of file GslMatrix.C.

References QUESO::GslMatrix::multiply().

1980 {
1981  return mat.multiply(vec);
1982 }
GslMatrix QUESO::operator* ( const GslMatrix &  m1,
const GslMatrix &  m2 
)

Definition at line 1984 of file GslMatrix.C.

References QUESO::Matrix::env(), k, QUESO::Matrix::map(), QUESO::GslMatrix::numCols(), QUESO::GslMatrix::numRowsLocal(), and queso_require_equal_to_msg.

1985 {
1986  unsigned int m1Rows = m1.numRowsLocal();
1987  unsigned int m1Cols = m1.numCols();
1988  unsigned int m2Rows = m2.numRowsLocal();
1989  unsigned int m2Cols = m2.numCols();
1990 
1991  queso_require_equal_to_msg(m1Cols, m2Rows, "different sizes m1Cols and m2Rows");
1992 
1993  GslMatrix mat(m1.env(),m1.map(),m2Cols);
1994 
1995  //std::cout << "In GslMatrix(mat * mat): m1Cols = " << m1Cols << std::endl;
1996 
1997  unsigned int commonSize = m1Cols;
1998  for (unsigned int row1 = 0; row1 < m1Rows; ++row1) {
1999  for (unsigned int col2 = 0; col2 < m2Cols; ++col2) {
2000  double result = 0.;
2001  for (unsigned int k = 0; k < commonSize; ++k) {
2002  result += m1(row1,k)*m2(k,col2);
2003  }
2004  mat(row1,col2) = result;
2005  }
2006  //std::cout << "In GslMatrix(mat * mat): ended row " << row1 << std::endl;
2007  }
2008 
2009  return mat;
2010 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
int k
Definition: ann_sample.cpp:53
GslVector QUESO::operator+ ( const GslVector &  x,
const GslVector &  y 
)

Definition at line 1164 of file GslVector.C.

1165 {
1166  GslVector answer(x);
1167  answer += y;
1168 
1169  return answer;
1170 }
GslMatrix QUESO::operator+ ( const GslMatrix &  m1,
const GslMatrix &  m2 
)

Definition at line 2012 of file GslMatrix.C.

2013 {
2014  GslMatrix answer(m1);
2015  answer += m2;
2016  return answer;
2017 }
GslVector QUESO::operator- ( const GslVector &  x,
const GslVector &  y 
)

Definition at line 1172 of file GslVector.C.

1173 {
1174  GslVector answer(x);
1175  answer -= y;
1176 
1177  return answer;
1178 }
GslMatrix QUESO::operator- ( const GslMatrix &  m1,
const GslMatrix &  m2 
)

Definition at line 2019 of file GslMatrix.C.

2020 {
2021  GslMatrix answer(m1);
2022  answer -= m2;
2023  return answer;
2024 }
GslVector QUESO::operator/ ( double  a,
const GslVector &  x 
)

Definition at line 1117 of file GslVector.C.

References QUESO::GslVector::cwInvert().

1118 {
1119  GslVector answer(x);
1120  answer.cwInvert();
1121  answer *= a;
1122 
1123  return answer;
1124 }
GslVector QUESO::operator/ ( const GslVector &  x,
const GslVector &  y 
)

Definition at line 1126 of file GslVector.C.

1127 {
1128  GslVector answer(x);
1129  answer /= y;
1130 
1131  return answer;
1132 }
std::ostream& QUESO::operator<< ( std::ostream &  os,
const InfiniteDimensionalMCMCSamplerOptions &  obj 
)

Definition at line 97 of file InfiniteDimensionalMCMCSamplerOptions.C.

References QUESO::InfiniteDimensionalMCMCSamplerOptions::m_parser, and QUESO::InfiniteDimensionalMCMCSamplerOptions::print().

99 {
100  os << (*(obj.m_parser)) << std::endl;
101  obj.print(os);
102  return os;
103 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const GslBlockMatrix &  obj 
)

Definition at line 156 of file GslBlockMatrix.C.

References QUESO::GslBlockMatrix::print().

157 {
158  obj.print(os);
159 
160  return os;
161 }
template<class V , class M >
std::ostream& QUESO::operator<< ( std::ostream &  os,
const ArrayOfOneDTables< V, M > &  obj 
)

Definition at line 112 of file ArrayOfOneDTables.C.

References QUESO::ArrayOfOneDTables< V, M >::print().

113 {
114  obj.print(os);
115  return os;
116 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const ExperimentModelOptions &  obj 
)

Definition at line 373 of file ExperimentModelOptions.C.

References QUESO::ExperimentModelOptions::print(), and queso_deprecated.

374 {
376 
377  obj.print(os);
378 
379  return os;
380 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream& QUESO::operator<< ( std::ostream &  os,
const SipOptionsValues &  obj 
)

Definition at line 134 of file StatisticalInverseProblemOptions.C.

References QUESO::SipOptionsValues::m_computeSolution, QUESO::SipOptionsValues::m_dataOutputAllowedSet, QUESO::SipOptionsValues::m_dataOutputFileName, QUESO::SipOptionsValues::m_option_computeSolution, QUESO::SipOptionsValues::m_option_dataOutputAllowedSet, and QUESO::SipOptionsValues::m_option_dataOutputFileName.

135 {
136  os << "\n" << obj.m_option_computeSolution << " = " << obj.m_computeSolution
137  << "\n" << obj.m_option_dataOutputFileName << " = " << obj.m_dataOutputFileName;
138  os << "\n" << obj.m_option_dataOutputAllowedSet << " = ";
139  for (std::set<unsigned int>::iterator setIt = obj.m_dataOutputAllowedSet.begin(); setIt != obj.m_dataOutputAllowedSet.end(); ++setIt) {
140  os << *setIt << " ";
141  }
142 #ifdef UQ_SIP_READS_SOLVER_OPTION
143  << "\n" << obj.m_option_solver << " = " << obj.m_solverString
144 #endif
145  os << std::endl;
146  return os;
147 }
std::ostream& QUESO::operator<< ( std::ostream &  os,
const GPMSAOptions &  obj 
)

Definition at line 138 of file GPMSAOptions.C.

References QUESO::GPMSAOptions::m_parser, and QUESO::GPMSAOptions::print().

139 {
140  os << (*(obj.m_parser)) << std::endl;
141  obj.print(os);
142  return os;
143 }
std::ostream& QUESO::operator<< ( std::ostream &  os,
const BoostInputOptionsParser &  parser 
)

Definition at line 143 of file BoostInputOptionsParser.C.

References QUESO::BoostInputOptionsParser::m_optionsDescription.

144 {
145  os << *(parser.m_optionsDescription);
146  return os;
147 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const SimulationModelOptions &  obj 
)

Definition at line 507 of file SimulationModelOptions.C.

References QUESO::SimulationModelOptions::print(), and queso_deprecated.

508 {
510 
511  obj.print(os);
512 
513  return os;
514 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream& QUESO::operator<< ( std::ostream &  os,
const MLSamplingOptions &  obj 
)

Definition at line 145 of file MLSamplingOptions.C.

References QUESO::MLSamplingOptions::m_parser, and QUESO::MLSamplingOptions::print().

146 {
147  os << (*(obj.m_parser)) << std::endl;
148 
149  obj.print(os);
150  return os;
151 }
std::ostream& QUESO::operator<< ( std::ostream &  os,
const SfpOptionsValues &  obj 
)

Definition at line 150 of file StatisticalForwardProblemOptions.C.

References QUESO::SfpOptionsValues::m_computeCorrelations, QUESO::SfpOptionsValues::m_computeCovariances, QUESO::SfpOptionsValues::m_computeSolution, QUESO::SfpOptionsValues::m_dataOutputAllowedSet, QUESO::SfpOptionsValues::m_dataOutputFileName, QUESO::SfpOptionsValues::m_option_computeCorrelations, QUESO::SfpOptionsValues::m_option_computeCovariances, QUESO::SfpOptionsValues::m_option_computeSolution, QUESO::SfpOptionsValues::m_option_dataOutputAllowedSet, QUESO::SfpOptionsValues::m_option_dataOutputFileName, and QUESO::SfpOptionsValues::m_parser.

151 {
152  os << (*(obj.m_parser)) << std::endl;
153 
154  os << obj.m_option_computeSolution << " = " << obj.m_computeSolution
155  << "\n" << obj.m_option_computeCovariances << " = " << obj.m_computeCovariances
156  << "\n" << obj.m_option_computeCorrelations << " = " << obj.m_computeCorrelations
157  << "\n" << obj.m_option_dataOutputFileName << " = " << obj.m_dataOutputFileName;
158  os << "\n" << obj.m_option_dataOutputAllowedSet << " = ";
159  for (std::set<unsigned int>::iterator setIt = obj.m_dataOutputAllowedSet.begin(); setIt != obj.m_dataOutputAllowedSet.end(); ++setIt) {
160  os << *setIt << " ";
161  }
162 #ifdef UQ_SFP_READS_SOLVER_OPTION
163  << "\n" << obj.m_option_solver << " = " << obj.m_solverString
164 #endif
165  os << std::endl;
166  return os;
167 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const GpmsaComputerModelOptions &  obj 
)

Definition at line 661 of file GpmsaComputerModelOptions.C.

References QUESO::GpmsaComputerModelOptions::print(), and queso_deprecated.

662 {
664 
665  obj.print(os);
666 
667  return os;
668 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream & QUESO::operator<< ( std::ostream &  os,
const StatisticalInverseProblemOptions &  obj 
)

Prints the object obj, overloading an operator.

Definition at line 320 of file StatisticalInverseProblemOptions.C.

References QUESO::StatisticalInverseProblemOptions::print(), and queso_deprecated.

321 {
323  obj.print(os);
324 
325  return os;
326 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream & QUESO::operator<< ( std::ostream &  os,
const StatisticalForwardProblemOptions &  obj 
)

Prints the object obj, overloading an operator.

Definition at line 355 of file StatisticalForwardProblemOptions.C.

References QUESO::StatisticalForwardProblemOptions::print(), and queso_deprecated.

356 {
358 
359  obj.print(os);
360 
361  return os;
362 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream& QUESO::operator<< ( std::ostream &  os,
const EnvOptionsValues &  obj 
)

Definition at line 201 of file EnvironmentOptions.C.

References QUESO::EnvOptionsValues::m_checkingLevel, QUESO::EnvOptionsValues::m_displayVerbosity, QUESO::EnvOptionsValues::m_identifyingString, QUESO::EnvOptionsValues::m_numSubEnvironments, QUESO::EnvOptionsValues::m_option_checkingLevel, QUESO::EnvOptionsValues::m_option_displayVerbosity, QUESO::EnvOptionsValues::m_option_identifyingString, QUESO::EnvOptionsValues::m_option_numSubEnvironments, QUESO::EnvOptionsValues::m_option_platformName, QUESO::EnvOptionsValues::m_option_rngType, QUESO::EnvOptionsValues::m_option_seed, QUESO::EnvOptionsValues::m_option_subDisplayAllowAll, QUESO::EnvOptionsValues::m_option_subDisplayAllowedSet, QUESO::EnvOptionsValues::m_option_subDisplayFileName, QUESO::EnvOptionsValues::m_option_syncVerbosity, QUESO::EnvOptionsValues::m_parser, QUESO::EnvOptionsValues::m_platformName, QUESO::EnvOptionsValues::m_rngType, QUESO::EnvOptionsValues::m_seed, QUESO::EnvOptionsValues::m_subDisplayAllowAll, QUESO::EnvOptionsValues::m_subDisplayAllowedSet, QUESO::EnvOptionsValues::m_subDisplayFileName, and QUESO::EnvOptionsValues::m_syncVerbosity.

202 {
203  // Print the parser
204  os << (*(obj.m_parser)) << std::endl;
205 
206  // Print the option names and current values
207  os << obj.m_option_numSubEnvironments << " = " << obj.m_numSubEnvironments
208  << "\n" << obj.m_option_subDisplayFileName << " = " << obj.m_subDisplayFileName
209  << "\n" << obj.m_option_subDisplayAllowAll << " = " << obj.m_subDisplayAllowAll
210  //<< "\n" << obj.m_option_subDisplayAllowInter0 << " = " << obj.m_subDisplayAllowInter0
211  << "\n" << obj.m_option_subDisplayAllowedSet << " = ";
212  for (std::set<unsigned int>::iterator setIt = obj.m_subDisplayAllowedSet.begin(); setIt != obj.m_subDisplayAllowedSet.end(); ++setIt) {
213  os << *setIt << " ";
214  }
215  os << "\n" << obj.m_option_displayVerbosity << " = " << obj.m_displayVerbosity
216  << "\n" << obj.m_option_syncVerbosity << " = " << obj.m_syncVerbosity
217  << "\n" << obj.m_option_checkingLevel << " = " << obj.m_checkingLevel
218  << "\n" << obj.m_option_rngType << " = " << obj.m_rngType
219  << "\n" << obj.m_option_seed << " = " << obj.m_seed
220  << "\n" << obj.m_option_platformName << " = " << obj.m_platformName
221  << "\n" << obj.m_option_identifyingString << " = " << obj.m_identifyingString
222  //<< "\n" << obj.m_option_numDebugParams << " = " << obj.m_numDebugParams
223  << std::endl;
224  return os;
225 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const GslVector &  obj 
)

Definition at line 1110 of file GslVector.C.

References QUESO::GslVector::print().

1111 {
1112  obj.print(os);
1113 
1114  return os;
1115 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const MonteCarloSGOptions &  obj 
)

Prints the object obj, overloading an operator.

Definition at line 635 of file MonteCarloSGOptions.C.

References QUESO::MonteCarloSGOptions::print(), and queso_deprecated.

636 {
638 
639  obj.print(os);
640 
641  return os;
642 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream& QUESO::operator<< ( std::ostream &  os,
const McOptionsValues &  obj 
)

Definition at line 268 of file MonteCarloSGOptions.C.

References QUESO::McOptionsValues::m_dataOutputAllowedSet, QUESO::McOptionsValues::m_dataOutputFileName, QUESO::McOptionsValues::m_option_dataOutputAllowedSet, QUESO::McOptionsValues::m_option_dataOutputFileName, QUESO::McOptionsValues::m_option_pseq_dataOutputAllowedSet, QUESO::McOptionsValues::m_option_pseq_dataOutputFileName, QUESO::McOptionsValues::m_option_pseq_dataOutputFileType, QUESO::McOptionsValues::m_option_pseq_dataOutputPeriod, QUESO::McOptionsValues::m_option_qseq_dataInputFileName, QUESO::McOptionsValues::m_option_qseq_dataInputFileType, QUESO::McOptionsValues::m_option_qseq_dataOutputAllowedSet, QUESO::McOptionsValues::m_option_qseq_dataOutputFileName, QUESO::McOptionsValues::m_option_qseq_dataOutputFileType, QUESO::McOptionsValues::m_option_qseq_dataOutputPeriod, QUESO::McOptionsValues::m_option_qseq_displayPeriod, QUESO::McOptionsValues::m_option_qseq_measureRunTimes, QUESO::McOptionsValues::m_option_qseq_size, QUESO::McOptionsValues::m_parser, QUESO::McOptionsValues::m_pseqDataOutputAllowedSet, QUESO::McOptionsValues::m_pseqDataOutputFileName, QUESO::McOptionsValues::m_pseqDataOutputFileType, QUESO::McOptionsValues::m_pseqDataOutputPeriod, QUESO::McOptionsValues::m_qseqDataInputFileName, QUESO::McOptionsValues::m_qseqDataInputFileType, QUESO::McOptionsValues::m_qseqDataOutputAllowedSet, QUESO::McOptionsValues::m_qseqDataOutputFileName, QUESO::McOptionsValues::m_qseqDataOutputFileType, QUESO::McOptionsValues::m_qseqDataOutputPeriod, QUESO::McOptionsValues::m_qseqDisplayPeriod, QUESO::McOptionsValues::m_qseqMeasureRunTimes, and QUESO::McOptionsValues::m_qseqSize.

269 {
270  os << (*(obj.m_parser)) << std::endl;
271 
272  os << obj.m_option_dataOutputFileName << " = " << obj.m_dataOutputFileName
273  << "\n" << obj.m_option_dataOutputAllowedSet << " = ";
274  for (std::set<unsigned int>::iterator setIt = obj.m_dataOutputAllowedSet.begin(); setIt != obj.m_dataOutputAllowedSet.end(); ++setIt) {
275  os << *setIt << " ";
276  }
277  os << "\n" << obj.m_option_pseq_dataOutputPeriod << " = " << obj.m_pseqDataOutputPeriod
278  << "\n" << obj.m_option_pseq_dataOutputFileName << " = " << obj.m_pseqDataOutputFileName
279  << "\n" << obj.m_option_pseq_dataOutputFileType << " = " << obj.m_pseqDataOutputFileType
280  << "\n" << obj.m_option_pseq_dataOutputAllowedSet << " = ";
281  for (std::set<unsigned int>::iterator setIt = obj.m_pseqDataOutputAllowedSet.begin(); setIt != obj.m_pseqDataOutputAllowedSet.end(); ++setIt) {
282  os << *setIt << " ";
283  }
284  os
285 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
286  << "\n" << obj.m_option_pseq_computeStats << " = " << obj.m_pseqComputeStats
287 #endif
288  << "\n" << obj.m_option_qseq_dataInputFileName << " = " << obj.m_qseqDataInputFileName
289  << "\n" << obj.m_option_qseq_dataInputFileType << " = " << obj.m_qseqDataInputFileType
290  << "\n" << obj.m_option_qseq_size << " = " << obj.m_qseqSize
291  << "\n" << obj.m_option_qseq_displayPeriod << " = " << obj.m_qseqDisplayPeriod
292  << "\n" << obj.m_option_qseq_measureRunTimes << " = " << obj.m_qseqMeasureRunTimes
293  << "\n" << obj.m_option_qseq_dataOutputPeriod << " = " << obj.m_qseqDataOutputPeriod
294  << "\n" << obj.m_option_qseq_dataOutputFileName << " = " << obj.m_qseqDataOutputFileName
295  << "\n" << obj.m_option_qseq_dataOutputFileType << " = " << obj.m_qseqDataOutputFileType
296  << "\n" << obj.m_option_qseq_dataOutputAllowedSet << " = ";
297  for (std::set<unsigned int>::iterator setIt = obj.m_qseqDataOutputAllowedSet.begin(); setIt != obj.m_qseqDataOutputAllowedSet.end(); ++setIt) {
298  os << *setIt << " ";
299  }
300 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
301  os << "\n" << obj.m_option_qseq_computeStats << " = " << obj.m_qseqComputeStats;
302 #endif
303 
304  return os;
305 }
template<class V , class M >
std::ostream& QUESO::operator<< ( std::ostream &  os,
const AsciiTable< V, M > &  obj 
)

Definition at line 301 of file AsciiTable.C.

302 {
303  obj.print(os);
304 
305  return os;
306 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const EnvironmentOptions &  obj 
)

Print values of the options chosen.

Definition at line 487 of file EnvironmentOptions.C.

References QUESO::EnvironmentOptions::print(), and queso_deprecated.

488 {
490 
491  obj.print(os);
492 
493  return os;
494 }
#define queso_deprecated()
Definition: Defines.h:120
std::ostream& QUESO::operator<< ( std::ostream &  os,
const BaseEnvironment &  obj 
)
std::ostream & QUESO::operator<< ( std::ostream &  os,
const GslMatrix &  obj 
)

Definition at line 1965 of file GslMatrix.C.

References QUESO::GslMatrix::print().

1966 {
1967  obj.print(os);
1968 
1969  return os;
1970 }
std::ostream& QUESO::operator<< ( std::ostream &  os,
const MhOptionsValues &  obj 
)

Definition at line 552 of file MetropolisHastingsSGOptions.C.

References QUESO::MhOptionsValues::m_amAdaptedMatricesDataOutputAllowAll, QUESO::MhOptionsValues::m_amAdaptedMatricesDataOutputAllowedSet, QUESO::MhOptionsValues::m_amAdaptedMatricesDataOutputFileName, QUESO::MhOptionsValues::m_amAdaptedMatricesDataOutputFileType, QUESO::MhOptionsValues::m_amAdaptedMatricesDataOutputPeriod, QUESO::MhOptionsValues::m_amAdaptInterval, QUESO::MhOptionsValues::m_amEpsilon, QUESO::MhOptionsValues::m_amEta, QUESO::MhOptionsValues::m_amInitialNonAdaptInterval, QUESO::MhOptionsValues::m_amKeepInitialMatrix, QUESO::MhOptionsValues::m_BrooksGelmanLag, QUESO::MhOptionsValues::m_dataOutputAllowAll, QUESO::MhOptionsValues::m_dataOutputAllowedSet, QUESO::MhOptionsValues::m_dataOutputFileName, QUESO::MhOptionsValues::m_displayCandidates, QUESO::MhOptionsValues::m_doLogitTransform, QUESO::MhOptionsValues::m_drDuringAmNonAdaptiveInt, QUESO::MhOptionsValues::m_drMaxNumExtraStages, QUESO::MhOptionsValues::m_drScalesForExtraStages, QUESO::MhOptionsValues::m_enableBrooksGelmanConvMonitor, QUESO::MhOptionsValues::m_filteredChainDataOutputAllowAll, QUESO::MhOptionsValues::m_filteredChainDataOutputAllowedSet, QUESO::MhOptionsValues::m_filteredChainDataOutputFileName, QUESO::MhOptionsValues::m_filteredChainDataOutputFileType, QUESO::MhOptionsValues::m_filteredChainDiscardedPortion, QUESO::MhOptionsValues::m_filteredChainGenerate, QUESO::MhOptionsValues::m_filteredChainLag, QUESO::MhOptionsValues::m_initialPositionDataInputFileName, QUESO::MhOptionsValues::m_initialPositionDataInputFileType, QUESO::MhOptionsValues::m_initialProposalCovMatrixDataInputFileName, QUESO::MhOptionsValues::m_initialProposalCovMatrixDataInputFileType, QUESO::MhOptionsValues::m_option_am_adaptedMatrices_dataOutputAllowAll, QUESO::MhOptionsValues::m_option_am_adaptedMatrices_dataOutputAllowedSet, QUESO::MhOptionsValues::m_option_am_adaptedMatrices_dataOutputFileName, QUESO::MhOptionsValues::m_option_am_adaptedMatrices_dataOutputFileType, QUESO::MhOptionsValues::m_option_am_adaptedMatrices_dataOutputPeriod, QUESO::MhOptionsValues::m_option_am_adaptInterval, QUESO::MhOptionsValues::m_option_am_epsilon, QUESO::MhOptionsValues::m_option_am_eta, QUESO::MhOptionsValues::m_option_am_initialNonAdaptInterval, QUESO::MhOptionsValues::m_option_am_keepInitialMatrix, QUESO::MhOptionsValues::m_option_BrooksGelmanLag, QUESO::MhOptionsValues::m_option_dataOutputAllowAll, QUESO::MhOptionsValues::m_option_dataOutputAllowedSet, QUESO::MhOptionsValues::m_option_dataOutputFileName, QUESO::MhOptionsValues::m_option_displayCandidates, QUESO::MhOptionsValues::m_option_doLogitTransform, QUESO::MhOptionsValues::m_option_dr_duringAmNonAdaptiveInt, QUESO::MhOptionsValues::m_option_dr_listOfScalesForExtraStages, QUESO::MhOptionsValues::m_option_dr_maxNumExtraStages, QUESO::MhOptionsValues::m_option_enableBrooksGelmanConvMonitor, QUESO::MhOptionsValues::m_option_filteredChain_dataOutputAllowAll, QUESO::MhOptionsValues::m_option_filteredChain_dataOutputAllowedSet, QUESO::MhOptionsValues::m_option_filteredChain_dataOutputFileName, QUESO::MhOptionsValues::m_option_filteredChain_dataOutputFileType, QUESO::MhOptionsValues::m_option_filteredChain_discardedPortion, QUESO::MhOptionsValues::m_option_filteredChain_generate, QUESO::MhOptionsValues::m_option_filteredChain_lag, QUESO::MhOptionsValues::m_option_initialPosition_dataInputFileName, QUESO::MhOptionsValues::m_option_initialPosition_dataInputFileType, QUESO::MhOptionsValues::m_option_initialProposalCovMatrix_dataInputFileName, QUESO::MhOptionsValues::m_option_initialProposalCovMatrix_dataInputFileType, QUESO::MhOptionsValues::m_option_listOfDisabledParameters, QUESO::MhOptionsValues::m_option_outputLogLikelihood, QUESO::MhOptionsValues::m_option_outputLogTarget, QUESO::MhOptionsValues::m_option_putOutOfBoundsInChain, QUESO::MhOptionsValues::m_option_rawChain_dataInputFileName, QUESO::MhOptionsValues::m_option_rawChain_dataInputFileType, QUESO::MhOptionsValues::m_option_rawChain_dataOutputAllowAll, QUESO::MhOptionsValues::m_option_rawChain_dataOutputAllowedSet, QUESO::MhOptionsValues::m_option_rawChain_dataOutputFileName, QUESO::MhOptionsValues::m_option_rawChain_dataOutputFileType, QUESO::MhOptionsValues::m_option_rawChain_dataOutputPeriod, QUESO::MhOptionsValues::m_option_rawChain_displayPeriod, QUESO::MhOptionsValues::m_option_rawChain_generateExtra, QUESO::MhOptionsValues::m_option_rawChain_measureRunTimes, QUESO::MhOptionsValues::m_option_rawChain_size, QUESO::MhOptionsValues::m_option_tk_useLocalHessian, QUESO::MhOptionsValues::m_option_tk_useNewtonComponent, QUESO::MhOptionsValues::m_option_totallyMute, QUESO::MhOptionsValues::m_outputLogLikelihood, QUESO::MhOptionsValues::m_outputLogTarget, QUESO::MhOptionsValues::m_parameterDisabledSet, QUESO::MhOptionsValues::m_parser, QUESO::MhOptionsValues::m_putOutOfBoundsInChain, QUESO::MhOptionsValues::m_rawChainDataInputFileName, QUESO::MhOptionsValues::m_rawChainDataInputFileType, QUESO::MhOptionsValues::m_rawChainDataOutputAllowAll, QUESO::MhOptionsValues::m_rawChainDataOutputAllowedSet, QUESO::MhOptionsValues::m_rawChainDataOutputFileName, QUESO::MhOptionsValues::m_rawChainDataOutputFileType, QUESO::MhOptionsValues::m_rawChainDataOutputPeriod, QUESO::MhOptionsValues::m_rawChainDisplayPeriod, QUESO::MhOptionsValues::m_rawChainGenerateExtra, QUESO::MhOptionsValues::m_rawChainMeasureRunTimes, QUESO::MhOptionsValues::m_rawChainSize, QUESO::MhOptionsValues::m_tkUseLocalHessian, QUESO::MhOptionsValues::m_tkUseNewtonComponent, and QUESO::MhOptionsValues::m_totallyMute.

553 {
554  os << (*(obj.m_parser)) << std::endl;
555 
556  os << obj.m_option_dataOutputFileName << " = " << obj.m_dataOutputFileName
557  << "\n" << obj.m_option_dataOutputAllowAll << " = " << obj.m_dataOutputAllowAll
558  << "\n" << obj.m_option_dataOutputAllowedSet << " = ";
559  for (std::set<unsigned int>::iterator setIt = obj.m_dataOutputAllowedSet.begin(); setIt != obj.m_dataOutputAllowedSet.end(); ++setIt) {
560  os << *setIt << " ";
561  }
562  os << "\n" << obj.m_option_totallyMute << " = " << obj.m_totallyMute
563  << "\n" << obj.m_option_initialPosition_dataInputFileName << " = " << obj.m_initialPositionDataInputFileName
564  << "\n" << obj.m_option_initialPosition_dataInputFileType << " = " << obj.m_initialPositionDataInputFileType
565  << "\n" << obj.m_option_initialProposalCovMatrix_dataInputFileName << " = " << obj.m_initialProposalCovMatrixDataInputFileName
566  << "\n" << obj.m_option_initialProposalCovMatrix_dataInputFileType << " = " << obj.m_initialProposalCovMatrixDataInputFileType
567  << "\n" << obj.m_option_listOfDisabledParameters << " = ";
568  for (std::set<unsigned int>::iterator setIt = obj.m_parameterDisabledSet.begin(); setIt != obj.m_parameterDisabledSet.end(); ++setIt) {
569  os << *setIt << " ";
570  }
571  os << "\n" << obj.m_option_rawChain_dataInputFileName << " = " << obj.m_rawChainDataInputFileName
572  << "\n" << obj.m_option_rawChain_dataInputFileType << " = " << obj.m_rawChainDataInputFileType
573  << "\n" << obj.m_option_rawChain_size << " = " << obj.m_rawChainSize
574  << "\n" << obj.m_option_rawChain_generateExtra << " = " << obj.m_rawChainGenerateExtra
575  << "\n" << obj.m_option_rawChain_displayPeriod << " = " << obj.m_rawChainDisplayPeriod
576  << "\n" << obj.m_option_rawChain_measureRunTimes << " = " << obj.m_rawChainMeasureRunTimes
577  << "\n" << obj.m_option_rawChain_dataOutputPeriod << " = " << obj.m_rawChainDataOutputPeriod
578  << "\n" << obj.m_option_rawChain_dataOutputFileName << " = " << obj.m_rawChainDataOutputFileName
579  << "\n" << obj.m_option_rawChain_dataOutputFileType << " = " << obj.m_rawChainDataOutputFileType
580  << "\n" << obj.m_option_rawChain_dataOutputAllowAll << " = " << obj.m_rawChainDataOutputAllowAll
581  << "\n" << obj.m_option_rawChain_dataOutputAllowedSet << " = ";
582  for (std::set<unsigned int>::iterator setIt = obj.m_rawChainDataOutputAllowedSet.begin(); setIt != obj.m_rawChainDataOutputAllowedSet.end(); ++setIt) {
583  os << *setIt << " ";
584  }
585  os
586 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
587  << "\n" << obj.m_option_rawChain_computeStats << " = " << obj.m_rawChainComputeStats
588 #endif
589  << "\n" << obj.m_option_filteredChain_generate << " = " << obj.m_filteredChainGenerate
590  << "\n" << obj.m_option_filteredChain_discardedPortion << " = " << obj.m_filteredChainDiscardedPortion
591  << "\n" << obj.m_option_filteredChain_lag << " = " << obj.m_filteredChainLag
592  << "\n" << obj.m_option_filteredChain_dataOutputFileName << " = " << obj.m_filteredChainDataOutputFileName
593  << "\n" << obj.m_option_filteredChain_dataOutputFileType << " = " << obj.m_filteredChainDataOutputFileType
594  << "\n" << obj.m_option_filteredChain_dataOutputAllowAll << " = " << obj.m_filteredChainDataOutputAllowAll
595  << "\n" << obj.m_option_filteredChain_dataOutputAllowedSet << " = ";
596  for (std::set<unsigned int>::iterator setIt = obj.m_filteredChainDataOutputAllowedSet.begin(); setIt != obj.m_filteredChainDataOutputAllowedSet.end(); ++setIt) {
597  os << *setIt << " ";
598  }
599  os
600 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
601  << "\n" << obj.m_option_filteredChain_computeStats << " = " << obj.m_filteredChainComputeStats
602 #endif
603  << "\n" << obj.m_option_displayCandidates << " = " << obj.m_displayCandidates
604  << "\n" << obj.m_option_putOutOfBoundsInChain << " = " << obj.m_putOutOfBoundsInChain
605  << "\n" << obj.m_option_tk_useLocalHessian << " = " << obj.m_tkUseLocalHessian
606  << "\n" << obj.m_option_tk_useNewtonComponent << " = " << obj.m_tkUseNewtonComponent
607  << "\n" << obj.m_option_dr_maxNumExtraStages << " = " << obj.m_drMaxNumExtraStages
608  << "\n" << obj.m_option_dr_listOfScalesForExtraStages << " = ";
609  for (unsigned int i = 0; i < obj.m_drScalesForExtraStages.size(); ++i) {
610  os << obj.m_drScalesForExtraStages[i] << " ";
611  }
612  os << "\n" << obj.m_option_dr_duringAmNonAdaptiveInt << " = " << obj.m_drDuringAmNonAdaptiveInt
613  << "\n" << obj.m_option_am_keepInitialMatrix << " = " << obj.m_amKeepInitialMatrix
614  << "\n" << obj.m_option_am_initialNonAdaptInterval << " = " << obj.m_amInitialNonAdaptInterval
615  << "\n" << obj.m_option_am_adaptInterval << " = " << obj.m_amAdaptInterval
616  << "\n" << obj.m_option_am_adaptedMatrices_dataOutputPeriod << " = " << obj.m_amAdaptedMatricesDataOutputPeriod
617  << "\n" << obj.m_option_am_adaptedMatrices_dataOutputFileName << " = " << obj.m_amAdaptedMatricesDataOutputFileName
618  << "\n" << obj.m_option_am_adaptedMatrices_dataOutputFileType << " = " << obj.m_amAdaptedMatricesDataOutputFileType
619  << "\n" << obj.m_option_am_adaptedMatrices_dataOutputAllowAll << " = " << obj.m_amAdaptedMatricesDataOutputAllowAll
620  << "\n" << obj.m_option_am_adaptedMatrices_dataOutputAllowedSet << " = ";
621  for (std::set<unsigned int>::iterator setIt = obj.m_amAdaptedMatricesDataOutputAllowedSet.begin(); setIt != obj.m_amAdaptedMatricesDataOutputAllowedSet.end(); ++setIt) {
622  os << *setIt << " ";
623  }
624  os << "\n" << obj.m_option_am_eta << " = " << obj.m_amEta
625  << "\n" << obj.m_option_am_epsilon << " = " << obj.m_amEpsilon
626  << "\n" << obj.m_option_enableBrooksGelmanConvMonitor << " = " << obj.m_enableBrooksGelmanConvMonitor
627  << "\n" << obj.m_option_BrooksGelmanLag << " = " << obj.m_BrooksGelmanLag
628  << "\n" << obj.m_option_outputLogLikelihood << " = " << obj.m_outputLogLikelihood
629  << "\n" << obj.m_option_outputLogTarget << " = " << obj.m_outputLogTarget
630  << "\n" << obj.m_option_doLogitTransform << " = " << obj.m_doLogitTransform
631  << std::endl;
632 
633  return os;
634 }
std::ostream& QUESO::operator<< ( std::ostream &  os,
const MLSamplingLevelOptions &  obj 
)

Definition at line 683 of file MLSamplingLevelOptions.C.

References QUESO::MLSamplingLevelOptions::m_parser, and QUESO::MLSamplingLevelOptions::print().

684 {
685  os << (*(obj.m_parser)) << std::endl;
686  obj.print(os);
687  return os;
688 }
std::ostream & QUESO::operator<< ( std::ostream &  os,
const MetropolisHastingsSGOptions &  obj 
)

Definition at line 1482 of file MetropolisHastingsSGOptions.C.

References QUESO::MetropolisHastingsSGOptions::print(), and queso_deprecated.

1483 {
1484  queso_deprecated();
1485 
1486  obj.print(os);
1487 
1488  return os;
1489 }
#define queso_deprecated()
Definition: Defines.h:120
template<class P_V , class P_M >
std::ostream& QUESO::operator<< ( std::ostream &  os,
const MLSampling< P_V, P_M > &  obj 
)

Definition at line 4815 of file MLSampling.C.

4816 {
4817  obj.print(os);
4818 
4819  return os;
4820 }
bool QUESO::operator== ( const GslVector &  lhs,
const GslVector &  rhs 
)

Definition at line 1181 of file GslVector.C.

References queso_require_equal_to_msg, and QUESO::GslVector::sizeLocal().

1182 {
1183  bool answer = true;
1184 
1185  unsigned int size1 = lhs.sizeLocal();
1186  unsigned int size2 = rhs.sizeLocal();
1187  queso_require_equal_to_msg(size1, size2, "different sizes of lhs and rhs");
1188 
1189  for (unsigned int i = 0; i < size1; ++i) {
1190  if (lhs[i] != rhs[i]) {
1191  answer = false;
1192  break;
1193  }
1194  }
1195 
1196  return answer;
1197 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
int QUESO::QUESO_get_numeric_version ( )

Definition at line 79 of file Environment.C.

References QUESO_MAJOR_VERSION, QUESO_MICRO_VERSION, and QUESO_MINOR_VERSION.

Referenced by QUESO_version_print().

80  {
81  // Note: return format follows the versioning convention xx.yy.z where
82  //
83  // xx = major version number
84  // yy = minor version number
85  // zz = micro version number
86  //
87  // For example:
88  // v. 0.23 -> 002300 = 2300
89  // v. 0.23.1 -> 002301 = 2301
90  // v. 10.23.2 -> 102302
91 
92  int major_version = 0;
93  int minor_version = 0;
94  int micro_version = 0;
95 
96 #ifdef QUESO_MAJOR_VERSION
97  major_version = QUESO_MAJOR_VERSION;
98 #endif
99 
100 #ifdef QUESO_MINOR_VERSION
101  minor_version = QUESO_MINOR_VERSION;
102 #endif
103 
104 #ifdef QUESO_MICRO_VERSION
105  micro_version = QUESO_MICRO_VERSION;
106 #endif
107 
108  return(major_version*10000 + minor_version*100 + micro_version);
109  }
#define QUESO_MAJOR_VERSION
Definition: queso.h:34
#define QUESO_MICRO_VERSION
Definition: queso.h:36
#define QUESO_MINOR_VERSION
Definition: queso.h:35
void QUESO::queso_terminate_handler ( )

Function for unhandled exceptions in Queso.

queso_terminate_handler This function deals with unhandled exceptions encountered in Queso. It provides a call to MPI_abort using the global communicator.

Definition at line 1378 of file Environment.C.

References old_terminate_handler.

Referenced by QUESO::FullEnvironment::FullEnvironment().

1379 {
1380  int mpi_initialized;
1381  MPI_Initialized (&mpi_initialized);
1382 
1383  if (mpi_initialized)
1384  {
1385  //MPI_Abort(m_fullComm->Comm(), 1);
1386  MPI_Abort(MPI_COMM_WORLD, 1);
1387  }
1388  else
1389  {
1390  // The system terminate_handler may do useful things like printing
1391  // uncaught exception information, or the user may have created
1392  // their own terminate handler that we want to call.
1394  }
1395  exit(1);
1396 }
std::terminate_handler old_terminate_handler
Definition: Environment.C:126
void QUESO::QUESO_version_print ( std::ostream &  os)

Definition at line 49 of file Environment.C.

References QUESO_BUILD_ARCH, QUESO_BUILD_DATE, QUESO_BUILD_HOST, QUESO_BUILD_USER, QUESO_BUILD_VERSION, QUESO_CXX, QUESO_CXXFLAGS, QUESO_get_numeric_version(), QUESO_GLPK_DIR, QUESO_GRVY_DIR, QUESO_GSL_DIR, QUESO_HDF5_DIR, QUESO_LIB_RELEASE, QUESO_LIB_VERSION, and QUESO_TRILINOS_DIR.

Referenced by QUESO::FullEnvironment::FullEnvironment(), and main().

50  {
51  {
52  os << "------------------------------------------------------------------------------------------" ;
53  os << "--------------------" << std::endl;
54  os << "QUESO Library: Version = " << QUESO_LIB_VERSION;
55  os << " (" << QUESO_get_numeric_version() << ")" << std::endl << std::endl;
56 
57  os << QUESO_LIB_RELEASE << std::endl << std::endl;
58 
59  os << "Build Date = " << QUESO_BUILD_DATE << std::endl;
60  os << "Build Host = " << QUESO_BUILD_HOST << std::endl;
61  os << "Build User = " << QUESO_BUILD_USER << std::endl;
62  os << "Build Arch = " << QUESO_BUILD_ARCH << std::endl;
63  os << "Build Rev = " << QUESO_BUILD_VERSION << std::endl << std::endl;
64 
65  os << "C++ Config = " << QUESO_CXX << " " << QUESO_CXXFLAGS << std::endl;
66  os << std::endl;
67  os << "Trilinos DIR = " << QUESO_TRILINOS_DIR << std::endl;
68  os << "GSL Libs = " << QUESO_GSL_DIR << std::endl;
69  os << "GRVY DIR = " << QUESO_GRVY_DIR << std::endl;
70  os << "GLPK DIR = " << QUESO_GLPK_DIR << std::endl;
71  os << "HDF5 DIR = " << QUESO_HDF5_DIR << std::endl;
72  os << "------------------------------------------------------------------------------------------" ;
73  os << "--------------------" << std::endl;
74  }
75 
76  return;
77  }
#define QUESO_TRILINOS_DIR
Definition: queso.h:52
#define QUESO_BUILD_VERSION
Definition: queso.h:42
#define QUESO_BUILD_HOST
Definition: queso.h:40
#define QUESO_CXXFLAGS
Definition: queso.h:48
#define QUESO_GLPK_DIR
Definition: queso.h:55
#define QUESO_LIB_VERSION
Definition: queso.h:44
int QUESO_get_numeric_version()
Definition: Environment.C:79
#define QUESO_CXX
Definition: queso.h:47
#define QUESO_BUILD_USER
Definition: queso.h:38
#define QUESO_BUILD_ARCH
Definition: queso.h:39
#define QUESO_GRVY_DIR
Definition: queso.h:54
#define QUESO_LIB_RELEASE
Definition: queso.h:45
#define QUESO_GSL_DIR
Definition: queso.h:53
#define QUESO_HDF5_DIR
Definition: queso.h:56
#define QUESO_BUILD_DATE
Definition: queso.h:41
GslMatrix QUESO::rightDiagScaling ( const GslMatrix &  mat,
const GslVector &  vec 
)

Definition at line 2063 of file GslMatrix.C.

References QUESO::GslMatrix::numCols(), QUESO::GslMatrix::numRowsLocal(), queso_require_equal_to_msg, and QUESO::GslVector::sizeLocal().

2064 {
2065  unsigned int vSize = vec.sizeLocal();
2066  unsigned int mRows = mat.numRowsLocal();
2067  unsigned int mCols = mat.numCols();
2068 
2069  queso_require_equal_to_msg(vSize, mCols, "size of vector is different from the number of cols in matrix");
2070 
2071  queso_require_equal_to_msg(mCols, mRows, "routine currently works for square matrices only");
2072 
2073  GslMatrix answer(mat);
2074  for (unsigned int j = 0; j < mCols; ++j) {
2075  double vecValue = vec[j];
2076  for (unsigned int i = 0; i < mRows; ++i) {
2077  answer(i,j) *= vecValue;
2078  }
2079  }
2080 
2081  return answer;
2082 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
double QUESO::scalarProduct ( const GslVector &  x,
const GslVector &  y 
)

Definition at line 1150 of file GslVector.C.

References queso_require_equal_to_msg, and QUESO::GslVector::sizeLocal().

Referenced by QUESO::GcmJointInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmJointInfo(), QUESO::GcmJointTildeInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmJointTildeInfo(), QUESO::GcmSimulationInfo< S_V, S_M, P_V, P_M, Q_V, Q_M >::GcmSimulationInfo(), QUESO::GcmSimulationTildeInfo< S_V, S_M, P_V, P_M, Q_V, Q_M >::GcmSimulationTildeInfo(), QUESO::GcmZTildeInfo< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::GcmZTildeInfo(), QUESO::GpmsaComputerModel< S_V, S_M, D_V, D_M, P_V, P_M, Q_V, Q_M >::likelihoodRoutine(), and QUESO::GslVector::norm2Sq().

1151 {
1152  unsigned int size1 = x.sizeLocal();
1153  unsigned int size2 = y.sizeLocal();
1154  queso_require_equal_to_msg(size1, size2, "different sizes of x and y");
1155 
1156  double result = 0.;
1157  for (unsigned int i = 0; i < size1; ++i) {
1158  result += x[i]*y[i];
1159  }
1160 
1161  return result;
1162 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
template<class T >
double QUESO::SubF1F2Gaussian2dKdeIntegral ( const ScalarSequence< T > &  scalarSeq1,
const ScalarSequence< T > &  scalarSeq2,
unsigned int  initialPos,
double  scaleValue1,
double  scaleValue2,
const Base1D1DFunction &  func1,
const Base1D1DFunction &  func2,
unsigned int  quadratureOrder 
)

Calculates the integral of a 2D Gaussian KDE.

This function performs numerical integration (via Hermite-Gauss quadrature, see GaussianHermite1DQuadrature), of a bi-variate Gaussian KDE (refer to ScalarSequence::subGaussian1dKde(), ArrayOfSequences::gaussianKDE(), or SequenceOfVectors::subGaussian1dKde().

Definition at line 875 of file 1D1DFunction.C.

References k, queso_require_equal_to_msg, QUESO::ScalarSequence< T >::subSequenceSize(), and QUESO::Base1D1DFunction::value().

883 {
884  double resultValue = 0.;
885 
886  queso_require_equal_to_msg(initialPos, 0, "not implemented yet for initialPos != 0");
887  queso_require_equal_to_msg(scalarSeq1.subSequenceSize(), scalarSeq2.subSequenceSize(), "different sizes");
888 
889  GaussianHermite1DQuadrature quadObj(0.,1.,quadratureOrder);
890  const std::vector<double>& quadPositions = quadObj.positions();
891  const std::vector<double>& quadWeights = quadObj.weights ();
892  queso_require_equal_to_msg(quadPositions.size(), quadWeights.size(), "quadObj has invalid state");
893 
894  unsigned int numQuadraturePositions = quadPositions.size();
895  unsigned int dataSize = scalarSeq1.subSequenceSize();
896  for (unsigned int k = 0; k < dataSize; ++k) {
897  double value1 = 0.;
898  double value2 = 0.;
899  double x1k = scalarSeq1[k];
900  double x2k = scalarSeq2[k];
901  for (unsigned int j = 0; j < numQuadraturePositions; ++j) {
902  value1 += func1.value(scaleValue1*quadPositions[j]+x1k)*quadWeights[j];
903  value2 += func2.value(scaleValue2*quadPositions[j]+x2k)*quadWeights[j];
904  }
905  resultValue += value1*value2;
906  }
907  resultValue *= 1./(2.*M_PI)/((double) dataSize);
908 
909  return resultValue;
910 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
int k
Definition: ann_sample.cpp:53

Variable Documentation

std::terminate_handler QUESO::old_terminate_handler
const int QUESO::UQ_FAILED_READING_FILE_RC = -9

Definition at line 85 of file Defines.h.

Referenced by MiscReadCharsAndDoubleFromFile(), and MiscReadStringAndDoubleFromFile().

const int QUESO::UQ_FAILED_TO_OPEN_FILE_RC = -7

Definition at line 83 of file Defines.h.

const int QUESO::UQ_INCOMPLETE_IMPLEMENTATION_RC = -1

Definition at line 77 of file Defines.h.

Referenced by QUESO::MetropolisHastingsSG< P_V, P_M >::adapt().

const int QUESO::UQ_INVALID_INTERNAL_RESULT_RC = -5

Definition at line 81 of file Defines.h.

const int QUESO::UQ_INVALID_INTERNAL_STATE_RC = -6

Definition at line 82 of file Defines.h.

const int QUESO::UQ_INVALID_OBSERVABLE_SPEC_RC = -3

Definition at line 79 of file Defines.h.

const int QUESO::UQ_INVALID_PARAMETER_SPEC_RC = -2

Definition at line 78 of file Defines.h.

const int QUESO::UQ_INVALID_QOI_SPEC_RC = -4

Definition at line 80 of file Defines.h.

const int QUESO::UQ_INVALID_SPACE_COMPONENT_ID_RC = -10

Definition at line 86 of file Defines.h.

const int QUESO::UQ_MATRIX_IS_NOT_POS_DEFINITE_RC = -8
const int QUESO::UQ_MATRIX_SVD_FAILED_RC = -11

Definition at line 87 of file Defines.h.

Referenced by QUESO::GslMatrix::internalSvd().

const int QUESO::UQ_OK_RC = 0

Definition at line 76 of file Defines.h.

Referenced by QUESO::MonteCarloSG< P_V, P_M, Q_V, Q_M >::actualGenerateSequence(), QUESO::MetropolisHastingsSG< P_V, P_M >::adapt(), QUESO::MetropolisHastingsSG< P_V, P_M >::generateFullChain(), QUESO::MLSampling< P_V, P_M >::generateSequence(), QUESO::MetropolisHastingsSG< P_V, P_M >::generateSequence(), QUESO::MLSampling< P_V, P_M >::generateSequence_Level0_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step01_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step02_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step03_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step04_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step05_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step06_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step07_inter0(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step08_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step09_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step10_all(), QUESO::MLSampling< P_V, P_M >::generateSequence_Step11_inter0(), QUESO::MLSampling< P_V, P_M >::justBalance_proc0(), MiscReadCharsAndDoubleFromFile(), MiscReadStringAndDoubleFromFile(), QUESO::SequenceOfVectors< V, M >::unifiedReadContents(), QUESO::ScalarSequence< T >::unifiedReadContents(), QUESO::SequenceOfVectors< V, M >::unifiedWriteContents(), QUESO::ScalarSequence< T >::unifiedWriteContents(), and QUESO::MetropolisHastingsSG< P_V, P_M >::writeInfo().

const int QUESO::UQ_UNAVAILABLE_RANK = -1

Definition at line 74 of file Defines.h.


Generated on Thu Jun 11 2015 13:52:33 for queso-0.53.0 by  doxygen 1.8.5