Examples of Normal


Examples of jpbrt.core.Normal

        double f = N.dot(d2Pduv);
        double g = N.dot(d2Pdvv);
       
        // compute dndu and dndv from fundamental form coefficients
        double invEGF2 = 1.0 / (E*G - F*F);
        Normal dndu = new Normal(dpdu.mul( (f*F - e*G) * invEGF2 ).addLocal( dpdv.mul((e*F - f*E) * invEGF2) ));
        Normal dndv = new Normal(dpdu.mul( (g*F - f*G) * invEGF2 ).addLocal( dpdv.mul((f*F - g*E) * invEGF2) ));
       
        // initialize DifferentialGeometry from parametric information
        result.dg = new DifferentialGeometry(
                objectToWorld.transform(phit),
                objectToWorld.transform(dpdu),
View Full Code Here

Examples of jpbrt.core.Normal

        double tv = b0 * uvs[0][1] + b1 * uvs[1][1] + b2 * uvs[2][1];
       
        // test intersection against alpha texture, if present
        if (mesh.alphaTex != null)
        {
            Normal zeroN = new Normal(0, 0, 0);
            DifferentialGeometry dgLocal = new DifferentialGeometry(ray.eval(t), dpdu, dpdv, zeroN, zeroN, tu, tv, this);
            if (mesh.alphaTex.evaluate(dgLocal) == 0)
                return result;
        }
       
        // fill in DifferetialGeometry from triangle hit
        Normal zeroN = new Normal(0, 0, 0);
        DifferentialGeometry dg = new DifferentialGeometry(ray.eval(t), dpdu, dpdv, zeroN, zeroN, tu, tv, this);
       
        result.dg = dg;
        result.tHit = t;
        result.rayEpsilon = 1e-3 * t;
 
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

  private void initialize(int numDimensions) {
    if (initialized)
      return;
    initialized = true;
    projection = new DenseMatrix(BITS, numDimensions);
    projection.assign(new Normal(0, 1, RandomUtils.getRandom()));
  }
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

    Path output = getTestTempFilePath("stdDev/output.file");
    FileSystem fs = FileSystem.get(conf);
    SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, input, IntWritable.class,
            DoubleWritable.class);
    Random random = RandomUtils.getRandom();
    Normal normal = new Normal(5, 3, random);
    for (int i = 0; i < 1000000; i++) {
      writer.append(new IntWritable(i), new DoubleWritable((long) normal.nextInt()));
    }
    writer.close();
    double v = BasicStats.stdDev(input, output, conf);
    assertEquals(3, v, 0.02);
  }
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

  @Test
  public void testEntropy() {
    Auc auc = new Auc();
    Random gen = RandomUtils.getRandom();
    Normal n0 = new Normal(-1, 1, gen);
    Normal n1 = new Normal(1, 1, gen);
    for (int i=0;i<100000;i++) {
      double score = n0.nextDouble();
      double p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(0, p);

      score = n1.nextDouble();
      p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(1, p);
    }
    Matrix m = auc.entropy();
    assertEquals(-0.35, m.get(0, 0), 0.02);
    assertEquals(-2.34, m.get(0, 1), 0.02);
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

  @Test
  public void testSimpleOps() {

    T v0 = vectorToTest(20);
    Random gen = RandomUtils.getRandom();
    Vector v1 = v0.assign(new Normal(0, 1, gen));

    // verify that v0 and v1 share and are identical
    assertEquals(v0.get(12), v1.get(12), 0);
    v0.set(12, gen.nextDouble());
    assertEquals(v0.get(12), v1.get(12), 0);
    assertSame(v0, v1);

    Vector v2 = vectorToTest(20).assign(new Normal(0, 1, gen));
    Vector dv1 = new DenseVector(v1);
    Vector dv2 = new DenseVector(v2);
    Vector sv1 = new RandomAccessSparseVector(v1);
    Vector sv2 = new RandomAccessSparseVector(v2);
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

  @Test
  public void testEntropy() {
    Auc auc = new Auc();
    Random gen = RandomUtils.getRandom();
    Normal n0 = new Normal(-1, 1, gen);
    Normal n1 = new Normal(1, 1, gen);
    for (int i=0; i<100000; i++) {
      double score = n0.nextDouble();
      double p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(0, p);

      score = n1.nextDouble();
      p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(1, p);
    }
    Matrix m = auc.entropy();
    assertEquals(-0.35, m.get(0, 0), 0.02);
    assertEquals(-2.36, m.get(0, 1), 0.02);
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

    Path output = getTestTempFilePath("stdDev/output.file");
    FileSystem fs = FileSystem.get(input.toUri(), conf);
    SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, input, IntWritable.class,
            DoubleWritable.class);
    Random random = RandomUtils.getRandom();
    Normal normal = new Normal(5, 3, random);
    for (int i = 0; i < 1000000; i++) {
      writer.append(new IntWritable(i), new DoubleWritable((long) normal.nextInt()));
    }
    writer.close();
    double v = BasicStats.stdDev(input, output, conf);
    assertEquals(3, v, 0.02);
  }
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

    public void testNarrowNormal() {
        // this mixture of a uniform and normal distribution has a very narrow peak which is centered
        // near the median.  Our system should be scale invariant and work well regardless.
        final Random gen = RandomUtils.getRandom();
        AbstractContinousDistribution mix = new AbstractContinousDistribution() {
            AbstractContinousDistribution normal = new Normal(0, 1e-5, gen);
            AbstractContinousDistribution uniform = new Uniform(-1, 1, gen);

            @Override
            public double nextDouble() {
                double x;
                if (gen.nextDouble() < 0.5) {
                    x = uniform.nextDouble();
                } else {
                    x = normal.nextDouble();
                }
                return x;
            }
        };
View Full Code Here

Examples of org.apache.mahout.math.jet.random.Normal

  @Test
  public void testEntropy() {
    Auc auc = new Auc();
    Random gen = RandomUtils.getRandom();
    Normal n0 = new Normal(-1, 1, gen);
    Normal n1 = new Normal(1, 1, gen);
    for (int i=0;i<100000;i++) {
      double score = n0.nextDouble();
      double p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(0, p);

      score = n1.nextDouble();
      p = n1.pdf(score) / (n0.pdf(score) + n1.pdf(score));
      auc.add(1, p);
    }
    Matrix m = auc.entropy();
    assertEquals(-0.35, m.get(0, 0), 0.02);
    assertEquals(-2.34, m.get(0, 1), 0.02);
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.