const GaussianVectorRV<V,M>& ScaledCovMatrixTKGroup<V,M>::rv(unsigned int stageId) const { queso_require_not_equal_to_msg(m_rvs.size(), 0, "m_rvs.size() = 0"); queso_require_msg(m_rvs[0], "m_rvs[0] == NULL"); queso_require_greater_msg(m_preComputingPositions.size(), stageId, "m_preComputingPositions.size() <= stageId"); queso_require_msg(m_preComputingPositions[stageId], "m_preComputingPositions[stageId] == NULL"); if ((m_env.subDisplayFile() ) && (m_env.displayVerbosity() >= 10)) { *m_env.subDisplayFile() << "In ScaledCovMatrixTKGroup<V,M>::rv1()" << ", stageId = " << stageId << ": about to call m_rvs[0]->updateLawExpVector()" << ", vector = " << *m_preComputingPositions[stageId] // FIX ME: might demand parallelism << std::endl; } GaussianVectorRV<V, M> * gaussian_rv = dynamic_cast<GaussianVectorRV<V, M> * >(m_rvs[0]); gaussian_rv->updateLawExpVector(*m_preComputingPositions[stageId]); return (*gaussian_rv); }
const InvLogitGaussianVectorRV<V,M>& TransformedScaledCovMatrixTKGroup<V,M>::rv(unsigned int stageId) const { queso_require_not_equal_to_msg(m_rvs.size(), 0, "m_rvs.size() = 0"); queso_require_msg(m_rvs[0], "m_rvs[0] == NULL"); queso_require_greater_msg(m_preComputingPositions.size(), stageId, "m_preComputingPositions.size() <= stageId"); queso_require_msg(m_preComputingPositions[stageId], "m_preComputingPositions[stageId] == NULL"); if ((m_env.subDisplayFile() ) && (m_env.displayVerbosity() >= 10)) { *m_env.subDisplayFile() << "In TransformedScaledCovMatrixTKGroup<V,M>::rv1()" << ", stageId = " << stageId << ": about to call m_rvs[0]->updateLawExpVector()" << ", vector = " << *m_preComputingPositions[stageId] // FIX ME: might demand parallelism << std::endl; } InvLogitGaussianVectorRV<V, M> * invlogit_gaussian = dynamic_cast<InvLogitGaussianVectorRV<V, M> * >(m_rvs[0]); V transformedPreComputingPositions(*m_preComputingPositions[stageId]); transformToGaussianSpace(*m_preComputingPositions[stageId], transformedPreComputingPositions); invlogit_gaussian->updateLawExpVector(transformedPreComputingPositions); return (*invlogit_gaussian); }
WignerJointPdf<V,M>::WignerJointPdf( const char* prefix, const VectorSet<V,M>& domainSet, const V& centerPos, double radius) : BaseJointPdf<V,M>(((std::string)(prefix)+"uni").c_str(), domainSet), m_centerPos(new V(centerPos)), m_radius (radius) { if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) { *m_env.subDisplayFile() << "Entering WignerJointPdf<V,M>::constructor()" << ": prefix = " << m_prefix << std::endl; } queso_require_greater_msg(m_radius, 0., "invalid radius"); if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) { *m_env.subDisplayFile() << "Leaving WignerJointPdf<V,M>::constructor()" << ": prefix = " << m_prefix << std::endl; } }
void OptimizerOptions::checkOptions() { queso_require_greater_msg(m_tolerance, 0.0, "optimizer tolerance must be > 0"); queso_require_greater_msg(m_finiteDifferenceStepSize, 0.0, "finite difference step must be > 0"); queso_require_greater_msg(m_maxIterations, 0, "max iterations must be > 0"); queso_require_greater_msg(m_fstepSize, 0.0, "fstepSize must be > 0"); queso_require_greater_msg(m_fdfstepSize, 0.0, "fdfstepSize must be > 0"); queso_require_greater_msg(m_lineTolerance, 0.0, "line tolerance must be > 0"); }
WignerVectorRealizer<V,M>::WignerVectorRealizer( const char* prefix, const VectorSet<V,M>& unifiedImageSet, const V& centerPos, double radius) : BaseVectorRealizer<V,M>(((std::string)(prefix)+"gen").c_str(),unifiedImageSet,std::numeric_limits<unsigned int>::max()), m_centerPos(new V(centerPos)), m_radius (radius) { if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) { *m_env.subDisplayFile() << "Entering WignerVectorRealizer<V,M>::constructor()" << ": prefix = " << m_prefix << std::endl; } queso_require_greater_msg(m_radius, 0., "invalid radius"); if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 5)) { *m_env.subDisplayFile() << "Leaving WignerVectorRealizer<V,M>::constructor()" << ": prefix = " << m_prefix << std::endl; } }
void GslVector::matlabLinearInterpExtrap( const GslVector& x1Vec, const GslVector& y1Vec, const GslVector& x2Vec) { queso_require_greater_msg(x1Vec.sizeLocal(), 1, "invalid 'x1' size"); queso_require_equal_to_msg(x1Vec.sizeLocal(), y1Vec.sizeLocal(), "invalid 'x1' and 'y1' sizes"); queso_require_equal_to_msg(x2Vec.sizeLocal(), this->sizeLocal(), "invalid 'x2' and 'this' sizes"); for (unsigned int i = 1; i < x1Vec.sizeLocal(); ++i) { // Yes, '1' queso_require_greater_msg(x1Vec[i], x1Vec[i-1], "invalid 'x1' values"); } for (unsigned int id2 = 0; id2 < x2Vec.sizeLocal(); ++id2) { double x2 = x2Vec[id2]; unsigned int id1 = 0; bool found1 = false; for (id1 = 0; id1 < x1Vec.sizeLocal(); ++id1) { if (x2 <= x1Vec[id1]) { found1 = true; break; } } bool makeLinearModel = false; double xa = 0.; double xb = 0.; double ya = 0.; double yb = 0.; if (x2 == x1Vec[id1]) { (*this)[id2] = y1Vec[id1]; } else if (x2 < x1Vec[0]) { // Extrapolation case makeLinearModel = true; xa = x1Vec[0]; xb = x1Vec[1]; ya = y1Vec[0]; yb = y1Vec[1]; } else if (found1 == true) { // Interpolation case makeLinearModel = true; xa = x1Vec[id1-1]; xb = x1Vec[id1]; ya = y1Vec[id1-1]; yb = y1Vec[id1]; } else { // Extrapolation case makeLinearModel = true; xa = x1Vec[x1Vec.sizeLocal()-2]; xb = x1Vec[x1Vec.sizeLocal()-1]; ya = y1Vec[x1Vec.sizeLocal()-2]; yb = y1Vec[x1Vec.sizeLocal()-1]; } if (makeLinearModel) { double rate = (yb-ya)/(xb-xa); (*this)[id2] = ya + (x2-xa)*rate; } } return; }