コード例 #1
0
 /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="WrappedGaussianProductOp"]/message_doc[@name="AAverageConditional(WrappedGaussian, double, WrappedGaussian)"]/*'/>
 public static WrappedGaussian AAverageConditional([SkipIfUniform] WrappedGaussian Product, double B, WrappedGaussian result)
 {
     result.Period   = Product.Period / B;
     result.Gaussian = GaussianProductOp.AAverageConditional(Product.Gaussian, B);
     result.Normalize();
     return(result);
 }
コード例 #2
0
		public static WrappedGaussian AAverageConditional([SkipIfUniform] WrappedGaussian Product, double B, WrappedGaussian result)
		{
			result.Period = Product.Period/B;
			result.Gaussian = GaussianProductOp.AAverageConditional(Product.Gaussian, B);
			result.Normalize();
			return result;
		}
コード例 #3
0
ファイル: PlusDouble.cs プロジェクト: woooodbond/infer
        /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="DoublePlusOp"]/message_doc[@name="AAverageConditional(WrappedGaussian, double)"]/*'/>
        public static WrappedGaussian AAverageConditional([SkipIfUniform] WrappedGaussian sum, double b)
        {
            WrappedGaussian result = WrappedGaussian.Uniform(sum.Period);

            result.Gaussian = AAverageConditional(sum.Gaussian, b);
            result.Normalize();
            return(result);
        }
コード例 #4
0
ファイル: PlusDouble.cs プロジェクト: woooodbond/infer
        /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="DoublePlusOp"]/message_doc[@name="SumAverageConditional(WrappedGaussian, double)"]/*'/>
        public static WrappedGaussian SumAverageConditional([SkipIfUniform] WrappedGaussian a, double b)
        {
            WrappedGaussian result = WrappedGaussian.Uniform(a.Period);

            result.Gaussian = SumAverageConditional(a.Gaussian, b);
            result.Normalize();
            return(result);
        }
コード例 #5
0
ファイル: PlusDouble.cs プロジェクト: kant2002/infer
        /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="PlusWrappedGaussianOp"]/message_doc[@name="AAverageLogarithm(WrappedGaussian, double)"]/*'/>
        public static WrappedGaussian AAverageLogarithm([SkipIfUniform] WrappedGaussian sum, double b)
        {
            WrappedGaussian result = WrappedGaussian.Uniform(sum.Period);

            result.Gaussian = DoublePlusVmpOp.AAverageLogarithm(sum.Gaussian, b);
            result.Normalize();
            return(result);
        }
コード例 #6
0
		public static WrappedGaussian AAverageConditional(double Product, double B, WrappedGaussian result)
		{
			if (B == 0) {
				if (Product != 0) throw new AllZeroException();
				result.SetToUniform();
			} else result.Point = Product / B;
			result.Normalize();
			return result;
		}
コード例 #7
0
ファイル: PlusDouble.cs プロジェクト: woooodbond/infer
        /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="DoublePlusOp"]/message_doc[@name="AAverageConditional(WrappedGaussian, WrappedGaussian)"]/*'/>
        public static WrappedGaussian AAverageConditional([SkipIfUniform] WrappedGaussian sum, [SkipIfUniform] WrappedGaussian b)
        {
            if (sum.Period != b.Period)
            {
                throw new ArgumentException("sum.Period (" + sum.Period + ") != b.Period (" + b.Period + ")");
            }
            WrappedGaussian result = WrappedGaussian.Uniform(sum.Period);

            result.Gaussian = AAverageConditional(sum.Gaussian, b.Gaussian);
            result.Normalize();
            return(result);
        }
コード例 #8
0
ファイル: PlusDouble.cs プロジェクト: kant2002/infer
        /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="PlusWrappedGaussianOp"]/message_doc[@name="SumAverageConditional(WrappedGaussian, WrappedGaussian)"]/*'/>
        public static WrappedGaussian SumAverageConditional([SkipIfUniform] WrappedGaussian a, [SkipIfUniform] WrappedGaussian b)
        {
            if (a.Period != b.Period)
            {
                throw new ArgumentException("a.Period (" + a.Period + ") != b.Period (" + b.Period + ")");
            }
            WrappedGaussian result = WrappedGaussian.Uniform(a.Period);

            result.Gaussian = DoublePlusOp.SumAverageConditional(a.Gaussian, b.Gaussian);
            result.Normalize();
            return(result);
        }
コード例 #9
0
		public static WrappedGaussian ProductAverageLogarithm([SkipIfUniform] WrappedGaussian A, double B, WrappedGaussian result)
		{
			double m, v;
			A.Gaussian.GetMeanAndVariance(out m, out v);
			result.Gaussian.SetMeanAndVariance(B*m, B*B*v);
			double period = B*A.Period;
			if (period != result.Period) {
				double ratio = period / result.Period;
				double intRatio = Math.Round(ratio);
				if (Math.Abs(ratio - intRatio) > result.Period*1e-4) throw new ArgumentException("B*A.Period ("+period+") is not a multiple of result.Period ("+result.Period+")");
				// if period is a multiple of result.Period, then wrapping to result.Period is equivalent to first wrapping to period, then to result.Period.
			}
			result.Normalize();
			return result;
		}
コード例 #10
0
 /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="WrappedGaussianProductOp"]/message_doc[@name="AAverageConditional(double, double, WrappedGaussian)"]/*'/>
 public static WrappedGaussian AAverageConditional(double Product, double B, WrappedGaussian result)
 {
     if (B == 0)
     {
         if (Product != 0)
         {
             throw new AllZeroException();
         }
         result.SetToUniform();
     }
     else
     {
         result.Point = Product / B;
     }
     result.Normalize();
     return(result);
 }
コード例 #11
0
        /// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="WrappedGaussianProductOp"]/message_doc[@name="ProductAverageLogarithm(WrappedGaussian, double, WrappedGaussian)"]/*'/>
        public static WrappedGaussian ProductAverageLogarithm([SkipIfUniform] WrappedGaussian A, double B, WrappedGaussian result)
        {
            double m, v;

            A.Gaussian.GetMeanAndVariance(out m, out v);
            result.Gaussian.SetMeanAndVariance(B * m, B * B * v);
            double period = B * A.Period;

            if (period != result.Period)
            {
                double ratio    = period / result.Period;
                double intRatio = System.Math.Round(ratio);
                if (System.Math.Abs(ratio - intRatio) > result.Period * 1e-4)
                {
                    throw new ArgumentException("B*A.Period (" + period + ") is not a multiple of result.Period (" + result.Period + ")");
                }
                // if period is a multiple of result.Period, then wrapping to result.Period is equivalent to first wrapping to period, then to result.Period.
            }
            result.Normalize();
            return(result);
        }