예제 #1
0
	// fill a vector with probabilities as reals
	cxsc::real EquiProbProposal::EquiProbProposal::fillNodeProposalProbs(
									const size_t nLeaf,
									const size_t nCherry,
									RealVec& probs) const
	{
		cxsc::real retSum = 0.0;
		probs.reserve(nLeaf + nCherry);

		if (nLeaf + nCherry > 0) {
			cxsc::real pNode = 1.0/(nLeaf + nCherry);
			retSum += pNode*(1.0*nLeaf + 1.0*nCherry);

			probs.assign(nLeaf+nCherry, pNode);
		}

		return retSum;
	}
예제 #2
0
	// fill a vector with probabilities as reals
	cxsc::real UniformSSMProposal::fillNodeProposalProbs(
			const size_t nLeaf, const size_t nCherry,
			RealVec& probs) const
	{
		cxsc::real retSum = 0.0;
		probs.reserve(nLeaf + nCherry);

		if (nLeaf > 0) {
			cxsc::real pLeaf = probSplitMerge/nLeaf;
			retSum += (1.0*nLeaf * pLeaf);
			probs.assign(nLeaf, pLeaf);
		}
		if (nCherry > 0) {
			cxsc::real pCherry = probSplitMerge/nCherry;
			retSum += (1.0*nCherry * pCherry);
			probs.insert(probs.end(), nCherry, pCherry);
		}

		return retSum;
	}