本文整理汇总了C++中Chain::compute_partialJointPosteriorDensity_overSubLoci方法的典型用法代码示例。如果您正苦于以下问题:C++ Chain::compute_partialJointPosteriorDensity_overSubLoci方法的具体用法?C++ Chain::compute_partialJointPosteriorDensity_overSubLoci怎么用?C++ Chain::compute_partialJointPosteriorDensity_overSubLoci使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chain
的用法示例。
在下文中一共展示了Chain::compute_partialJointPosteriorDensity_overSubLoci方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeLogJointDensity_MPI_overSubLoci
// 1/4/2016
// 'demographicPara' is a 1x6 matrix.
long double MaxPosterior::computeLogJointDensity_MPI_overSubLoci(Eigen::MatrixXd demographicPara, IM im, popTree* poptree, Chain coldCh, unsigned int nProcs, unsigned int crr_procID)
{
// std::cout <<"In computeLogJointDensity_MPI_overSubLoci()\n";
poptree->replacePara(demographicPara);
coldCh.compute_partialJointPosteriorDensity_overSubLoci(poptree, im, crr_procID, nProcs);
std::vector<long double> logExpectationOfEachCoalProb = coldCh.get_logExpectationOfCoalProb();
unsigned int numSubLoci = coldCh.getNumSubLoci();
// std::cout <<"numSubLoci ="<<numSubLoci <<"\n";
long double posterior = 1;
if(numSubLoci != logExpectationOfEachCoalProb.size())
{
std::cout << "** Error In MaxPosterior::computeJointDensity_MPI_overSubSample() **\n";
std::cout << "numSubLoci = " << numSubLoci
<< " expectationOfEachCoalProb.size() = " << logExpectationOfEachCoalProb.size() <<"\n\n";
}
long double local_logPosterior_subLoci =0;
long double global_logPosterior = 0;
for(unsigned int lc=0; lc< numSubLoci; lc++)
{
local_logPosterior_subLoci += logExpectationOfEachCoalProb.at(lc);
}
MPI::COMM_WORLD.Barrier();
MPI::COMM_WORLD.Allreduce(&local_logPosterior_subLoci, &global_logPosterior, 1, MPI_LONG_DOUBLE, MPI_SUM);
MPI::COMM_WORLD.Barrier();
long double logPosterior = 0;
if(crr_procID ==0)
{
Eigen::Vector3d paraMax = im.get_paraMax();
double priorPopTree = poptree->computeJointPrior(paraMax);
//posterior = exp(global_logPosterior+log(priorPopTree));
logPosterior = global_logPosterior; // +log(priorPopTree);
// std::cout <<"log(priorPopTree) = " << log(priorPopTree) <<"\n";
}
// std::cout << "crr_procID=" << crr_procID << " logPosterior = " << logPosterior <<"\n";
return logPosterior;
}