我不知道有现成的一步解决方案。对于两步混合匹配方法,您可以熟悉Boost.Math,它在统计分布部分有一个单变量正态分布的扩展示例:
// [...] many headers and namespaces inclusions
int main()
{
// Construct a standard normal distribution s
normal s; // (default mean = zero, and standard deviation = unity)
cout << "Standard normal distribution, mean = "<< s.mean()
<< ", standard deviation = " << s.standard_deviation() << endl;
/*` First the probability distribution function (pdf).
*/
cout << "Probability distribution function values" << endl;
cout << " z " " pdf " << endl;
cout.precision(5);
for (double z = -range; z < range + step; z += step)
{
cout << left << setprecision(3) << setw(6) << z << " "
<< setprecision(precision) << setw(12) << pdf(s, z) << endl;
}
cout.precision(6); // default
// [...] much more
}
然后,您可以使用 Eigen 进行必要的向量和矩阵操作,以将标量传递给它。这篇博文有更多细节(尽管它使用Boost.Random来生成样本值)。