本文整理汇总了C++中MessageBox::end方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageBox::end方法的具体用法?C++ MessageBox::end怎么用?C++ MessageBox::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageBox
的用法示例。
在下文中一共展示了MessageBox::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: functionPrecision
GaussianMessage EqualityNode::functionPrecision(int to, const MessageBox &msgs)
{
size_t size = msgs.begin()->second.size();
GaussianMessage result(size, GaussianMessage::GAUSSIAN_PRECISION);
Matrix &mean = result.mean();
Matrix &prec = result.precision();
for (MessageBox::const_iterator it = msgs.begin(); it != msgs.end(); ++it)
{
const int from = it->first;
const GaussianMessage &msg = it->second;
if (from == to)
continue;
const Matrix &msgMean = msg.mean();
const Matrix &msgPrec = msg.precision();
prec += msgPrec;
mean += msgPrec * msgMean;
}
// TODO: mult(in1, in2, out)
mean = pinv(prec) * mean;
return result;
}
示例2: functionVariance
GaussianMessage EqualityNode::functionVariance(int to, const MessageBox &msgs)
{
if (msgs.empty())
throw std::runtime_error("EqualityNode::functionVariance(): no messages");
// TODO: assert on various sizes of messages
size_t size = msgs.begin()->second.size();
GaussianMessage result(size);
Matrix &mean = result.mean();
Matrix &variance = result.variance();
Matrix sum(size, 1);
for (MessageBox::const_iterator it = msgs.begin(); it != msgs.end(); ++it)
{
const int from = it->first;
const GaussianMessage &msg = it->second;
// skipping the message itself
if (from == to)
continue;
const Matrix &msgMean = msg.mean();
const Matrix &msgVar = msg.variance();
// W_i = V^-1 = tmp^-1
Matrix msgPrec = inv(msgVar);
// W_j += W_i
variance += msgPrec;
// tmp_sum += W_i m_i
sum += msgPrec * msgMean;
}
// V_j = W_j^-1
variance.inv();
// TODO: mult(variance, sum, out)
mean = variance * sum;
return result;
}