asFloatBuffer() public méthode

public asFloatBuffer ( ) : FloatBuffer
Résultat FloatBuffer
Exemple #1
0
        public void putData(float[,] data)
        {
            int nSamples = data.GetLength(0);

            if (nSamples == 0)
            {
                return;
            }
            int nChans = data.GetLength(1);

            if (nChans == 0)
            {
                return;
            }

            ByteBuffer buf = preparePutData(nChans, nSamples, DataType.FLOAT32);

            float[] rowData;
            for (int i = 0; i < nSamples; i++)
            {
                rowData = getRow <float>(data, i);
                buf.asFloatBuffer().put(rowData);
            }
            buf.rewind();
            writeAll(buf);
            readResponse(PUT_OK);
        }
Exemple #2
0
        public void serialize(ByteBuffer buf)
        {
            switch (type)
            {
            case DataType.CHAR:
                buf.putString(array.ToString());
                break;

            case DataType.UINT8:
            case DataType.INT8:
                buf.put((byte[])array);
                break;

            case DataType.UINT16:
            case DataType.INT16:
                buf.asShortBuffer().put((short[])array);
                break;

            case DataType.UINT32:
            case DataType.INT32:
                buf.asIntBuffer().put((int[])array);
                break;

            case DataType.UINT64:
            case DataType.INT64:
                buf.asLongBuffer().put((long[])array);
                break;

            case DataType.FLOAT32:
                buf.asFloatBuffer().put((float[])array);
                break;

            case DataType.FLOAT64:
                buf.asDoubleBuffer().put((double[])array);
                break;
            }
        }
Exemple #3
0
 public void serialize(ByteBuffer buf)
 {
     switch(type) {
         case DataType.CHAR:
             buf.putString(array.ToString());
             break;
         case DataType.UINT8:
         case DataType.INT8:
             buf.put((byte[]) array);
             break;
         case DataType.UINT16:
         case DataType.INT16:
             buf.asShortBuffer().put((short[]) array);
             break;
         case DataType.UINT32:
         case DataType.INT32:
             buf.asIntBuffer().put((int[]) array);
             break;
         case DataType.UINT64:
         case DataType.INT64:
             buf.asLongBuffer().put((long[]) array);
             break;
         case DataType.FLOAT32:
             buf.asFloatBuffer().put((float[]) array);
             break;
         case DataType.FLOAT64:
             buf.asDoubleBuffer().put((double[]) array);
             break;
     }
 }