Examples of DistributionFactory


Examples of org.apache.cassandra.stress.generate.DistributionFactory

        {
            for (Map<String, Object> spec : yaml.columnspec)
            {
                lowerCase(spec);
                String name = (String) spec.remove("name");
                DistributionFactory population = !spec.containsKey("population") ? null : OptionDistribution.get((String) spec.remove("population"));
                DistributionFactory size = !spec.containsKey("size") ? null : OptionDistribution.get((String) spec.remove("size"));
                DistributionFactory clustering = !spec.containsKey("cluster") ? null : OptionDistribution.get((String) spec.remove("cluster"));

                if (!spec.isEmpty())
                    throw new IllegalArgumentException("Unrecognised option(s) in column spec: " + spec);
                if (name == null)
                    throw new IllegalArgumentException("Missing name argument in column spec");
View Full Code Here

Examples of org.apache.cassandra.stress.generate.DistributionFactory

        {
            for (Map<String, Object> spec : yaml.columnspec)
            {
                lowerCase(spec);
                String name = (String) spec.remove("name");
                DistributionFactory population = !spec.containsKey("population") ? null : OptionDistribution.get((String) spec.remove("population"));
                DistributionFactory size = !spec.containsKey("size") ? null : OptionDistribution.get((String) spec.remove("size"));
                DistributionFactory clustering = !spec.containsKey("cluster") ? null : OptionDistribution.get((String) spec.remove("cluster"));

                if (!spec.isEmpty())
                    throw new IllegalArgumentException("Unrecognised option(s) in column spec: " + spec);
                if (name == null)
                    throw new IllegalArgumentException("Missing name argument in column spec");
View Full Code Here

Examples of org.apache.cassandra.stress.generate.DistributionFactory

        columnConfigs = new HashMap<>();
        for (Map<String,Object> spec : yaml.columnspec)
        {
            lowerCase(spec);
            String name = (String) spec.remove("name");
            DistributionFactory population = !spec.containsKey("population") ? null : OptionDistribution.get((String) spec.remove("population"));
            DistributionFactory size = !spec.containsKey("size") ? null : OptionDistribution.get((String) spec.remove("size"));
            DistributionFactory clustering = !spec.containsKey("cluster") ? null : OptionDistribution.get((String) spec.remove("cluster"));

            if (!spec.isEmpty())
                throw new IllegalArgumentException("Unrecognised option(s) in column spec: " + spec);
            if (name == null)
                throw new IllegalArgumentException("Missing name argument in column spec");
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

    boolean isCumulative = ((Boolean)args[3]).booleanValue();
   
    if(number>trails || number <0)
      throw new SSErrorXelException(SSError.NUM);
    else{
      DistributionFactory factory = DistributionFactory.newInstance();
      BinomialDistribution bd = factory.createBinomialDistribution(trails, p_s);
      if(isCumulative)
        return UtilFns.validateNumber(bd.cumulativeProbability(number));
      else
        return UtilFns.validateNumber(bd.probability(number));
    }
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

    double x = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    if(x <0)
      throw new SSErrorXelException(SSError.NUM);
    else{   
      DistributionFactory factory = DistributionFactory.newInstance();
      return UtilFns.validateNumber(1-factory.createChiSquareDistribution(df).cumulativeProbability(x));
    }
  }
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

    double p = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    if(p<0 || p>1)
      throw new SSErrorXelException(SSError.NUM);
    else{
      DistributionFactory factory = DistributionFactory.newInstance();
      return UtilFns.validateNumber(factory.createChiSquareDistribution(df).inverseCumulativeProbability((1-p)));
    }
  }
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

    double x = CommonFns.toNumber(args[0]).doubleValue();
    double lambda = CommonFns.toNumber(args[1]).doubleValue();
    double mean = 1 / lambda;
    boolean isCumulative = ((Boolean)args[2]).booleanValue();
   
    DistributionFactory factory = DistributionFactory.newInstance();
    if(isCumulative)
      return UtilFns.validateNumber(factory.createExponentialDistribution(mean).cumulativeProbability(x));
    else
      return UtilFns.validateNumber((1-factory.createExponentialDistribution(mean).cumulativeProbability(x))/mean);
  }
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

      Degrees_freedom2   is the denominator degrees of freedom.
     */
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    double ddf = CommonFns.toNumber(args[2]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    return UtilFns.validateNumber(factory.createFDistribution(df, ddf).cumulativeProbability(x));
  }
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

   */
  public static Object statFinv(Object[] args, XelContext ctx) throws MathException{
    double p = CommonFns.toNumber(args[0]).doubleValue();
    double df = CommonFns.toNumber(args[1]).doubleValue();
    double ddf = CommonFns.toNumber(args[2]).doubleValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    return UtilFns.validateNumber(factory.createFDistribution(df, ddf).inverseCumulativeProbability(p));
  }
View Full Code Here

Examples of org.apache.commons.math.distribution.DistributionFactory

    //EXCEL: GAMMADIST(x,alpha,beta,cumulative)
    double x = CommonFns.toNumber(args[0]).doubleValue();
    double alpha = CommonFns.toNumber(args[1]).doubleValue();
    double beta = CommonFns.toNumber(args[2]).doubleValue();
    boolean isCumulative = ((Boolean)args[3]).booleanValue();
    DistributionFactory factory = DistributionFactory.newInstance();
    if(isCumulative)
      return UtilFns.validateNumber(factory.createGammaDistribution(alpha, beta).cumulativeProbability(x));
    else
      return new Integer(-1); //TODO
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.