Examples of DoubleArray


Examples of net.imglib2.img.basictypeaccess.array.DoubleArray

  @Override
  public ArrayImg< T, DoubleArray > createDoubleInstance( final long[] dimensions, final Fraction entitiesPerPixel )
  {
    final int numEntities = numEntitiesRangeCheck( dimensions, entitiesPerPixel );

    return new ArrayImg< T, DoubleArray >( new DoubleArray( numEntities ), dimensions, entitiesPerPixel );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.DoubleArray

   * Creates an {@link ArrayImg}<{@link DoubleType}, {@link DoubleArray}>
   * reusing a passed double[] array.
   */
  final public static ArrayImg< DoubleType, DoubleArray > doubles( final double[] array, final long... dim )
  {
    final DoubleArray access = new DoubleArray( array );
    final ArrayImg< DoubleType, DoubleArray > img = new ArrayImg< DoubleType, DoubleArray >( access, dim, new Fraction() );
    final DoubleType t = new DoubleType( img )
    img.setLinkedType( t );
    return img;
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.DoubleArray

   * Creates an {@link ArrayImg}<{@link DoubleType}, {@link DoubleArray}>
   * reusing a passed double[] array.
   */
  final public static ArrayImg< ComplexDoubleType, DoubleArray > complexDoubles( final double[] array, final long... dim )
  {
    final DoubleArray access = new DoubleArray( array );
    final ArrayImg< ComplexDoubleType, DoubleArray > img = new ArrayImg< ComplexDoubleType, DoubleArray >( access, dim, new Fraction( 2, 1 ) );
    final ComplexDoubleType t = new ComplexDoubleType( img )
    img.setLinkedType( t );
    return img;
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.DoubleArray

  }

  public NativeARGBDoubleType( final double a, final double r, final double g, final double b )
  {
    img = null;
    dataAccess = new DoubleArray( 4 );
    set( a, r, g, b );
  }
View Full Code Here

Examples of net.imglib2.img.basictypeaccess.array.DoubleArray

  }

  @Test
  public void testDoubleConstruction()
  {
    testConstruction( new DoubleArray( 1 ) );
  }
View Full Code Here

Examples of net.sf.doodleproject.numerics4j.util.DoubleArray

     */
    public double integrate(double a, double b) throws NumericException {
        TrapezoidalIntegrator.IterativeState state = new TrapezoidalIntegrator.IterativeState(
            function, a, b);

        DoubleArray r0 = new DoubleArray();
        DoubleArray r1 = new DoubleArray();
        double error = Double.MAX_VALUE;
        int n;

        r0.add(state.getResult());
        do {
            state.iterate();
            n = state.getIterations();

            r1.clear();
            r1.add(state.getResult());
            double d = 4.0;
            for (int i = 0; i < n; ++i) {
                r1.add(r1.get(i) + (r1.get(i) - r0.get(i)) / (d - 1.0));
                d *= 4.0;
            }
            error = Math.abs(r1.get(n) / r0.get(n - 1) - 1.0);
            r0 = r1;
            r1 = new DoubleArray();
        } while (n < getMaximumIterations()
            && error > getMaximumRelativeError());

        if (n >= getMaximumIterations()) {
            throw new ConvergenceException(
View Full Code Here

Examples of org.apache.uima.jcas.cas.DoubleArray

      longArrayFS.set(4, Long.MAX_VALUE - 4);
      // create a Sofa and set the SofaArray feature.
      JCas longArrayView = jcas.createView("longArraySofaData");
      longArrayView.setSofaDataArray(longArrayFS, "longs");

      DoubleArray doubleArrayFS = new DoubleArray(jcas, 5);
      doubleArrayFS.set(0, Double.MAX_VALUE);
      doubleArrayFS.set(1, Double.MIN_VALUE);
      doubleArrayFS.set(2, Double.parseDouble("1.5555"));
      doubleArrayFS.set(3, Double.parseDouble("99.000000005"));
      doubleArrayFS.set(4, Double.parseDouble("4.44444444444444444"));
      // create a Sofa and set the SofaArray feature.
      JCas doubleArrayView = jcas.createView("doubleArraySofaData");
      doubleArrayView.setSofaDataArray(doubleArrayFS, "doubles");

      // create remote sofa and set the SofaURI feature
      JCas remoteView = jcas.createView("remoteSofaData");
      String sofaFileName = "./Sofa.xcas";
      remoteView.setSofaDataURI("file:" + sofaFileName, "text");
      PrintWriter out = new PrintWriter(sofaFileName);
      out.print("this beer is good");
      out.close();
     
      // read sofa data
      InputStream is = stringView.getSofaDataStream();
      assertTrue(is != null);
      byte[] dest = new byte[1];
      StringBuffer buf = new StringBuffer();
      while (is.read(dest) != -1) {
        buf.append((char) dest[0]);
      }
      assertTrue(buf.toString().equals("this beer is good"));

      dest = new byte[4];
      is.close();
      is = intArrayView.getSofaDataStream();
      assertTrue(is != null);
      BufferedInputStream bis = new BufferedInputStream(is);
      int i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getInt() == intArrayFS.get(i++));
      }

      bis.close();
     
      is = floatArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getFloat() == floatArrayFS.get(i++));
      }

      dest = new byte[2];
      bis.close();
      is = shortArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getShort() == shortArrayFS.get(i++));
      }

      dest = new byte[1];
      bis.close();
      is = byteArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).get() == byteArrayFS.get(i++));
      }

      dest = new byte[8];
      bis.close();
      is = longArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getLong() == longArrayFS.get(i++));
      }

      bis.close();
      is = doubleArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getDouble() == doubleArrayFS.get(i++));
      }

      dest = new byte[1];
      bis.close();
      is = remoteView.getSofaDataStream();
View Full Code Here

Examples of org.apache.uima.jcas.cas.DoubleArray

      amounts.add((int) amount);
      parts.add(part);
    }
    JCas jCas = stream.getJCas();
    StringArray nameArray = UIMAUtils.toStringArray(jCas, names.toArray(new String[] {}));
    DoubleArray totalArray = UIMAUtils.toDoubleArray(jCas, getDoubleArray(totals));
    IntegerArray amountArray = UIMAUtils.toIntegerArray(jCas, getIntegerArray(amounts));
    DoubleArray partArray = UIMAUtils.toDoubleArray(jCas, getDoubleArray(parts));

    Type type = jCas.getCasType(Statistics.type);
    Feature fname = type.getFeatureByBaseName("name");
    Feature ftotal = type.getFeatureByBaseName("total");
    Feature famount = type.getFeatureByBaseName("amount");
View Full Code Here

Examples of org.apache.uima.jcas.cas.DoubleArray

    uimaSArray.copyFromArray(sArray, 0, 0, sArray.length);
    return uimaSArray;
  }

  public static DoubleArray toDoubleArray(JCas jCas, double[] sArray) {
    DoubleArray uimaSArray = new DoubleArray(jCas, sArray.length);
    uimaSArray.copyFromArray(sArray, 0, 0, sArray.length);
    return uimaSArray;
  }
View Full Code Here

Examples of org.apache.uima.jcas.cas.DoubleArray

      longArrayFS.set(4, Long.MAX_VALUE - 4);
      // create a Sofa and set the SofaArray feature.
      JCas longArrayView = jcas.createView("longArraySofaData");
      longArrayView.setSofaDataArray(longArrayFS, "longs");

      DoubleArray doubleArrayFS = new DoubleArray(jcas, 5);
      doubleArrayFS.set(0, Double.MAX_VALUE);
      doubleArrayFS.set(1, Double.MIN_VALUE);
      doubleArrayFS.set(2, Double.parseDouble("1.5555"));
      doubleArrayFS.set(3, Double.parseDouble("99.000000005"));
      doubleArrayFS.set(4, Double.parseDouble("4.44444444444444444"));
      // create a Sofa and set the SofaArray feature.
      JCas doubleArrayView = jcas.createView("doubleArraySofaData");
      doubleArrayView.setSofaDataArray(doubleArrayFS, "doubles");

      // create remote sofa and set the SofaURI feature
      JCas remoteView = jcas.createView("remoteSofaData");
      String sofaFileName = "./Sofa.xcas";
      remoteView.setSofaDataURI("file:" + sofaFileName, "text");

      // read sofa data
      InputStream is = stringView.getSofaDataStream();
      assertTrue(is != null);
      byte[] dest = new byte[1];
      StringBuffer buf = new StringBuffer();
      while (is.read(dest) != -1) {
        buf.append((char) dest[0]);
      }
      assertTrue(buf.toString().equals("this beer is good"));

      dest = new byte[4];
      is.close();
      is = intArrayView.getSofaDataStream();
      assertTrue(is != null);
      BufferedInputStream bis = new BufferedInputStream(is);
      int i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getInt() == intArrayFS.get(i++));
      }

      bis.close();
     
      is = floatArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getFloat() == floatArrayFS.get(i++));
      }

      dest = new byte[2];
      bis.close();
      is = shortArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getShort() == shortArrayFS.get(i++));
      }

      dest = new byte[1];
      bis.close();
      is = byteArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).get() == byteArrayFS.get(i++));
      }

      dest = new byte[8];
      bis.close();
      is = longArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getLong() == longArrayFS.get(i++));
      }

      bis.close();
      is = doubleArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getDouble() == doubleArrayFS.get(i++));
      }

      dest = new byte[1];
      bis.close();
      is = remoteView.getSofaDataStream();
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.