Examples of DoubleArray


Examples of ca.eandb.util.DoubleArray

      int callbackInterval = Math.min(1000,
          Math.max(1, pairsPerSeedTask / 100));
      int nextCallback = 0;

      DoubleArray weight = new DoubleArray();
      short[] lightPathLength = new short[pairsPerSeedTask];
      short[] eyePathLength = new short[pairsPerSeedTask];

      long randomSeed = initialRandomSeed;
      for (int i = 0; i < pairsPerSeedTask; i++) {
        if (--nextCallback <= 0) {
          if (!monitor.notifyProgress(i, pairsPerSeedTask)) {
            monitor.notifyCancelled();
            return null;
          }
          nextCallback = callbackInterval;
        }

        Path path = generatePath(randomSeed++);

        /* store information about the path so we don't have to
         * regenerate it during the resampling phase.
         */
        if (path.getLightPathLength() > Short.MAX_VALUE) {
          throw new UnexpectedException("Light subpath too long.");
        }
        if (path.getEyePathLength() > Short.MAX_VALUE) {
          throw new UnexpectedException("Eye subpath too long.");
        }
        lightPathLength[i] = (short) path.getLightPathLength();
        eyePathLength[i] = (short) path.getEyePathLength();

        join(path.getLightTail(), path.getEyeTail(), weight);
      }

      monitor.notifyStatusChanged("Resampling MLT seeds");

      double totalWeight = MathUtil.sum(weight);
      double scale = (double) numPathSeeds / totalWeight;
      double x = 0.5;
      int x0 = (int) Math.floor(x);
      int x1;
      List<PathSeed> seeds = new ArrayList<PathSeed>();

      for (int i = 0, n = 0; i < pairsPerSeedTask; i++) {
        int s0 = lightPathLength[i];
        int t0 = eyePathLength[i];
        for (int s = s0; s >= -1; s--) {
          for (int t = t0; t >= -1; t--, n++) {
            x += scale * weight.get(n);
            x1 = (int) Math.floor(x);
            for (int j = x0; j < x1; j++) {
              PathSeed seed = new PathSeed();
              seed.randomSeed = initialRandomSeed + (long) i;
              seed.lightPathLength = s;
View Full Code Here

Examples of ca.eandb.util.DoubleArray

  private int position = 0;

  public RepeatableRandom(Random inner) {
    this.inner = inner;
    values.add(new DoubleArray());
  }
View Full Code Here

Examples of ca.eandb.util.DoubleArray

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Random#next()
   */
  public double next() {
    DoubleArray seq = values.get(sequence);
    while (position >= seq.size()) {
      seq.add(inner.next());
    }
    return seq.get(position++);
  }
View Full Code Here

Examples of ca.eandb.util.DoubleArray

    values.get(sequence).resize(position);
  }

  public void mark() {
    if (++sequence >= values.size()) {
      values.add(new DoubleArray());
    }
    position = 0;
  }
View Full Code Here

Examples of ca.eandb.util.DoubleArray

  public void mutate() {
    mutate(1.0 / 16.0);
  }

  public void mutate(double width) {
    DoubleArray seq = values.get(sequence);
    for (int i = position, n = seq.size(); i < n; i++) {
      seq.set(i, mutate(seq.get(i), width));
    }
  }
View Full Code Here

Examples of ca.eandb.util.DoubleArray

      seq.set(i, mutate(seq.get(i), width));
    }
  }

  public void mutate(double width, int n) {
    DoubleArray seq = values.get(sequence);
    for (int i = position, j = 0; j < n && i < seq.size(); i++, j++) {
      seq.set(i, mutate(seq.get(i), width));
    }
  }
View Full Code Here

Examples of ca.eandb.util.DoubleArray

    }
  }

  public void clear() {
    values.clear();
    values.add(new DoubleArray());
    sequence = 0;
    position = 0;
  }
View Full Code Here

Examples of ca.eandb.util.DoubleArray

        values.add((int) reader.readUnsignedInt());
      }
      return new PlyIntegralListProperty(values, this);
    }
    case FLOAT: {
      DoubleArray values = new DoubleArray(count);
      for (int i = 0; i < count; i++) {
        values.add(reader.readFloat());
      }
      return new PlyFloatListProperty(values, this);
    }
    case DOUBLE: {
      DoubleArray values = new DoubleArray(count);
      for (int i = 0; i < count; i++) {
        values.add(reader.readDouble());
      }
      return new PlyFloatListProperty(values, this);
    }
    default:
      throw new UnexpectedException(String.format(
View Full Code Here

Examples of com.linkedin.data.template.DoubleArray

    result = test("[1.1, 2.2, 3.3]", FloatArray.class);
    Assert.assertEquals(result, new FloatArray(Arrays.asList(1.1F, 2.2F, 3.3F)));
    Assert.assertSame(result.getClass(), FloatArray.class);

    result = test("[2.2, 3.3, 4.4]", DoubleArray.class);
    Assert.assertEquals(result, new DoubleArray(Arrays.asList(2.2D, 3.3D, 4.4D)));
    Assert.assertSame(result.getClass(), DoubleArray.class);

    result = test("[\"APPLE\", \"BANANA\"]", EnumFruitsArray.class);
    Assert.assertEquals(result, new EnumFruitsArray(Arrays.asList(EnumFruits.APPLE, EnumFruits.BANANA)));
    Assert.assertSame(result.getClass(), EnumFruitsArray.class);
View Full Code Here

Examples of com.linkedin.data.template.DoubleArray

  public void testArraySchema()
  {
    TyperefTest record = new TyperefTest();
    RecordDataSchema recordDataSchema = record.schema();

    DoubleArray doubleArray = new DoubleArray();
    record.setDoubleRefArray(doubleArray);
    doubleArray = record.getDoubleRefArray();
    assertEquals(doubleArray.schema(), DataTemplateUtil.getSchema(DoubleArray.class));
    assertNotEquals(recordDataSchema.getField("doubleRefArray").getType(), doubleArray.schema());

    IntegerArray intArray = new IntegerArray();
    record.setIntArray(intArray);
    intArray = record.getIntArray();
    assertEquals(intArray.schema(), DataTemplateUtil.getSchema(IntegerArray.class));
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.