/// <summary> /// Gibbs message to 'sample' /// </summary> /// <param name="Mean">Constant value for 'mean'.</param> /// <param name="Precision">Constant value for 'precision'.</param> /// <param name="result">Modified to contain the outgoing message</param> /// <returns><paramref name="result"/></returns> /// <remarks><para> /// The outgoing message is the factor viewed as a function of 'sample' conditioned on the given values. /// </para></remarks> public static VectorGaussian SampleConditional(Vector Mean, PositiveDefiniteMatrix Precision, VectorGaussian result) { result.SetMeanAndPrecision(Mean, Precision); return result; }
public static VectorGaussian ExtractVectorPart(VectorGaussianWishart gaussianWishart, VectorGaussian result) { if (gaussianWishart.IsVectorMarginalUniform()) { return VectorGaussian.Uniform(2); } double firstShape, secondPrecisionScale; PositiveDefiniteMatrix firstRate; Vector secondLocation; gaussianWishart.ExtractParameters(out firstShape, out firstRate, out secondLocation, out secondPrecisionScale); result.SetMeanAndPrecision(secondLocation, MathHelpers.Invert(firstRate) * (firstShape * secondPrecisionScale)); return result; }