Package cern.jet.random

Examples of cern.jet.random.Normal


        base = logmean + s*s/2;
    }

    private double[] generateBootstrapSamples() {
        RandomEngine u = new MersenneTwister();
        Normal normal = new Normal(0, 1, u);
        ChiSquare chisquare = new ChiSquare(numSamples-1, u);
        int bootstrapSize = Settings.getInt("logCI.bootstrapSize", 2000);
        double[] samples = new double[bootstrapSize];
        for (int i = bootstrapSize;   i-- > 0; )
             samples[i] = generateBootstrapSample(normal, chisquare, numSamples,
View Full Code Here


   */
  public Normal createNormal(double mean, double std) {
    if (isDebugEnabled()) {
      distributions.put(NORMAL_DEFAULT, new UNormalController(mean, std, generators.get(null)));
    } else {
      distributions.put(NORMAL_DEFAULT, new Normal(mean, std, generators.get(null)));
    }

    // <- LOGGING
    if (logger.isDebugEnabled()) {
      logger.debug("Create normal distribution with mean " + mean + " and std.dev. " + std
View Full Code Here

    // LOGGING ->
   
    if (isDebugEnabled()) {
       return new UNormalController(mean, std, generator);
    } else {
      return new Normal(mean, std, generator);
    }
  } 
View Full Code Here

    };
  }

  @Test
  public void testGetSRID() {
    AbstractDistribution one = new Normal(1.0, 0.0, generator);
    AbstractDistribution two = new Normal(1.0, 0.0, generator);
   
    assertEquals(one.nextDouble(), two.nextDouble(), 0.0001);
  }
View Full Code Here

    ////                         protected methods                 ////

    /** Method that is called after _randomNumberGenerator is changed.
     */
    protected void _createdNewRandomNumberGenerator() {
        _generator = new Normal(1.0, 1.0, _randomNumberGenerator);
    }
View Full Code Here

    @Test
    public void testComprehensiveOnMixture() {
        RandomEngine r = new MersenneTwister64(0);
        Normal[] dists = new Normal[]{
                new Normal(100, 50, r),
                new Normal(150, 20, r),
                new Normal(500, 300, r),
                new Normal(10000, 10000, r),
                new Normal(1200, 300, r),
        };
        for (int numSamples : new int[]{1, 10, 100, 1000, 10000}) {
            long[][] samples = new long[dists.length][];
            for (int i = 0; i < dists.length; ++i) {
                samples[i] = new long[numSamples];
View Full Code Here

   */
  public Normal createNormal(double mean, double std) {
    if (isDebugEnabled()) {
      distributions.put(NORMAL_DEFAULT, new UNormalController(mean, std, generators.get(null)));
    } else {
      distributions.put(NORMAL_DEFAULT, new Normal(mean, std, generators.get(null)));
    }

    // <- LOGGING
    if (logger.isDebugEnabled()) {
      logger.debug("Create normal distribution with mean " + mean + " and std.dev. " + std
View Full Code Here

    // LOGGING ->
   
    if (isDebugEnabled()) {
       return new UNormalController(mean, std, generator);
    } else {
      return new Normal(mean, std, generator);
    }
  } 
View Full Code Here

    @Test
    public void testNormalDistribution() {
        final double requiredPrecision = 1E-10;

        final Normal n = new Normal(0.0, 1.0, null);
        for( final double mu : new double[]{-5.0, -3.2, -1.5, 0.0, 1.2, 3.0, 5.8977} ) {
            for( final double sigma : new double[]{1.2, 3.0, 5.8977} ) {
                for( final double x : new double[]{-5.0, -3.2, -1.5, 0.0, 1.2, 3.0, 5.8977} ) {
                    n.setState(mu, sigma);
                    Assert.assertEquals(n.pdf(x), MathUtils.normalDistribution(mu, sigma, x), requiredPrecision);
                    Assert.assertEquals(Math.log10(n.pdf(x)), MathUtils.normalDistributionLog10(mu, sigma, x), requiredPrecision);
                }
            }
        }
    }
View Full Code Here

  public NormalDistribution(final double mean, final double standardDeviation, final RandomEngine randomEngine) {
    Validate.isTrue(standardDeviation > 0, "standard deviation");
    Validate.notNull(randomEngine);
    _mean = mean;
    _standardDeviation = standardDeviation;
    _normal = new Normal(mean, standardDeviation, randomEngine);
  }
View Full Code Here

TOP

Related Classes of cern.jet.random.Normal

Copyright © 2018 www.massapicom. 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.