示例#1
0
文件: SparseGP.cs 项目: 0xCM/arrows
 /// <summary>
 /// Sets this sparse GP the the power of another sparse GP
 /// </summary>
 /// <param name="dist"></param>
 /// <param name="exponent"></param>
 public void SetToPower(SparseGP dist, double exponent)
 {
     if (exponent == 1.0)
     {
         SetTo(dist);
     }
     else
     {
         FixedParameters = dist.FixedParameters;
         if (exponent == 0.0)
         {
             SetToUniform();
         }
         else if (dist.IsPointMass)
         {
             if (exponent < 0)
             {
                 throw new DivideByZeroException("The exponent is negative and the distribution is a point mass");
             }
             else
             {
                 Point = dist.Point;
             }
         }
         else if (dist.IncludePrior)
         {
             throw new ArgumentException("Cannot raise prior to a power.");
         }
         else
         {
             IncludePrior = dist.IncludePrior;
             InducingDist.SetToPower(dist.InducingDist, exponent);
             pointFunc = null;
             ClearCachedValues();
         }
     }
 }