public ByteBuffer getContent() { return content.getRealByteBuffer(); }
@Override public String contentToString() { if (getSize() > 1000) { return "Cannot display variables with more than 1000 elements."; } StringBuilder sb = new StringBuilder(); for (int m = 0; m < getM(); m++) { for (int n = 0; n < getN(); n++) { sb.append(getReal(m, n)); if (isComplex()) { sb.append("+" + getImaginary(m, n)); } sb.append("\t"); } sb.append("\n"); } // don't let it end in \t\n if (sb.length() > 2) { sb.setLength(sb.length() - 2); } return sb.toString(); }
((MLNumericArray<?>) array).getRealByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getImaginaryByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getRealByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getImaginaryByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getRealByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getImaginaryByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getRealByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getImaginaryByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getRealByteBuffer()); tag.writeTo(dos); ((MLNumericArray<?>) array).getImaginaryByteBuffer()); tag.writeTo(dos);
protected void _set( ByteBuffer buffer, T value, int index ) { buffer.position( getByteOffset(index) ); buffer.put( getByteArray( value ) ); }
protected T get( ByteBuffer buffer, int index ) { buffer.position( getByteOffset(index) ); buffer.get( bytes, 0, bytes.length ); return buldFromBytes( bytes ); }
@Override public boolean equals(Object o) { if (o instanceof MLNumericArray) { boolean result = directByteBufferEquals(real, ((MLNumericArray<?>) o).real) && Arrays.equals(dims, ((MLNumericArray<?>) o).dims); if (isComplex() && result) { result &= directByteBufferEquals(imaginary, ((MLNumericArray<?>) o).imaginary); } return result; } return super.equals(o); }
protected void set(T entryAsDataType) { data.setReal(entryAsDataType, index); }
MLNumericArray<Float> z = (MLNumericArray<Float>) mfr.getMLArray("Z"); int n = x.getN(); // number of triangles int components = 3; // x, y, z int geomsize = 3; // triangle Coord3d c1 = new Coord3d(x.getReal(C1, i), y.getReal(C1, i), z.getReal(C1, i)); Coord3d c2 = new Coord3d(x.getReal(C2, i), y.getReal(C2, i), z.getReal(C2, i)); Coord3d c3 = new Coord3d(x.getReal(C3, i), y.getReal(C3, i), z.getReal(C3, i)); Coord3d no = Normal.compute(c1, c2, c3);
/** * @param index * @return */ public T getImaginary( int index ) { return get( imaginary, index ); }
/** * Normally this constructor is used only by MatFileReader and MatFileWriter * * @param name - array name * @param dims - array dimensions * @param type - array type * @param attributes - array flags */ public MLNumericArray(String name, int[] dims, int type, int attributes) { super(name, dims, type, attributes); allocate(); }
/** Returns the value at the given index for non-complex arrays. */ public T get(int index) { return getReal(index); }
@Override public String contentToString() { if (getSize() > 1000) { return "Cannot display variables with more than 1000 elements."; } StringBuilder sb = new StringBuilder(); for (int m = 0; m < getM(); m++) { for (int n = 0; n < getN(); n++) { sb.append(getReal(m, n)); if (isComplex()) { sb.append("+" + getImaginary(m, n)); } sb.append("\t"); } sb.append("\n"); } // don't let it end in \t\n if (sb.length() > 2) { sb.setLength(sb.length() - 2); } return sb.toString(); }
((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos );