Examples of asIntBuffer()


Examples of java.nio.ByteBuffer.asIntBuffer()

            loadPffmTable(szPfmTable);
            FileInputStream fis = new FileInputStream(szIntTempFile);
            ByteBuffer bb = ByteBuffer.allocate(nIntByteSize * 3);
            ByteOrder bo = ByteOrder.BIG_ENDIAN;
            fis.read(bb.array());
            IntBuffer ib = bb.asIntBuffer();
            boolean swap = (ib.get(2) < 0 || ib.get(2) > MAX_NUM_CLASS_PRUNERS);
            if (swap) {
                bo = ByteOrder.LITTLE_ENDIAN;
                bb.order(bo);
                ib = bb.asIntBuffer();
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

            IntBuffer ib = bb.asIntBuffer();
            boolean swap = (ib.get(2) < 0 || ib.get(2) > MAX_NUM_CLASS_PRUNERS);
            if (swap) {
                bo = ByteOrder.LITTLE_ENDIAN;
                bb.order(bo);
                ib = bb.asIntBuffer();
            }
            int unicharset_size = ib.get(0);
            int NumClasses = ib.get(1);
            int NumClassPruners = ib.get(2);
            int version_id = 0;
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

                this.IndexFor[i] = sb.get(i);
            }
            bb = ByteBuffer.allocate(nIntByteSize * NumClasses);
            bb.order(bo);
            fis.read(bb.array());
            ib = bb.asIntBuffer();
            for (int i=0; i<NumClasses; i++) {
                this.ClassIdFor[i] = ib.get(i);
            }
            ArrayList<byte[][][][]> ClassPruners = new ArrayList<byte[][][][]>();
            for (int i=0; i<NumClassPruners; i++) {
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

                        new byte[NUM_CP_BUCKETS][NUM_CP_BUCKETS][NUM_CP_BUCKETS][];
                bb = ByteBuffer.allocate(nIntByteSize * NUM_CP_BUCKETS *
                        NUM_CP_BUCKETS * NUM_CP_BUCKETS * WERDS_PER_CP_VECTOR);
                bb.order(bo);
                fis.read(bb.array());
                ib = bb.asIntBuffer();
                int p = 0;
                for (int j=0; j<NUM_CP_BUCKETS; j++) {
                    for (int k=0; k<NUM_CP_BUCKETS; k++) {
                        for (int l=0; l<NUM_CP_BUCKETS; l++) {
                            Pruner[j][k][l] =
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

            // Java doesn't have unsigned byte
            this.B = unsignedByteToShort(bb.get(1));
            this.C = bb.get(2) << 9;
            this.Angle = unsignedByteToShort(bb.get(3));
            int[] nInts = new int[WERDS_PER_CONFIG_VEC];
            IntBuffer ib = bb.asIntBuffer();
            for (int i=0; i<WERDS_PER_CONFIG_VEC; i++) {
                nInts[i] = ib.get(i+1);
            }
            setConfigBits(nInts);
        } catch (IOException ex) {
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

            final int nIntByteSize = Integer.SIZE / Byte.SIZE;
            ByteBuffer bb = ByteBuffer.allocate(nIntByteSize * NUM_PP_PARAMS *
                    NUM_PP_BUCKETS * WERDS_PER_PP_VECTOR);
            bb.order(bo);
            fis.read(bb.array());
            IntBuffer ib = bb.asIntBuffer();
            int p = 0;
            for (int i=0; i<NUM_PP_PARAMS; i++) {
                for (int j=0; j<NUM_PP_BUCKETS; j++) {
                    for (int k=0; k<WERDS_PER_PP_VECTOR; k++) {
                        int nWord = ib.get(p++);
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

   */
  protected IntBuffer createIntBuffer(int size) {
    ByteBuffer temp = ByteBuffer.allocateDirect(4 * size);
    temp.order(ByteOrder.nativeOrder());

    return temp.asIntBuffer();
  }

  /**
   * Exits the test NOW, printing errorcode to stdout
   *
 
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

      // create command queue and upload color map buffer on each used device
      queues[i] = clCreateCommandQueue(clContext, devices.get(i), CL_QUEUE_PROFILING_ENABLE, null);
      queues[i].checkValid();

      final ByteBuffer colorMapBuffer = clEnqueueMapBuffer(queues[i], colorMap[i], CL_TRUE, CL_MAP_WRITE, 0, COLOR_MAP_SIZE, null, null, null);
      initColorMap(colorMapBuffer.asIntBuffer(), 32, Color.BLUE, Color.GREEN, Color.RED);
      clEnqueueUnmapMemObject(queues[i], colorMap[i], colorMapBuffer, null, null);
    }

    // check if we have 64bit FP support on all devices
    // if yes we can use only one program for all devices + one kernel per device.
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

      ja[i] = iter.getIntNext();
  }

  public ByteBuffer getDataAsByteBuffer() {
    ByteBuffer bb = ByteBuffer.allocate((int) (4 * getSize())); // default big-endian
    IntBuffer ib = bb.asIntBuffer();
    ib.put((int[]) get1DJavaArray(int.class)); // make sure its in canonical order
    return bb;
  }

  /**
 
View Full Code Here

Examples of java.nio.ByteBuffer.asIntBuffer()

        ShortBuffer sb = bb.asShortBuffer();
        return Array.factory( DataType.BYTE.getPrimitiveClassType(), shape, sb.array());

      case NCLibrary.NC_INT:
      case NCLibrary.NC_UINT:
        IntBuffer ib = bb.asIntBuffer();
        return Array.factory( DataType.BYTE.getPrimitiveClassType(), shape, ib.array());
    }

    return null;
  }
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.