protected void assertComplex() { if (!isComplex()) { throw new UnsupportedOperationException("Cannot use this method for non-Complex matrices"); } }
protected void assertComplex() { if (!isComplex()) { throw new UnsupportedOperationException("Cannot use this method for non-Complex matrices"); } }
@Override public int hashCode() { if (isComplex()) { return Arrays.hashCode(new Object[]{real, dims, imaginary}); } else { return Arrays.hashCode(new Object[]{real, dims}); } }
public void putImaginaryByteBuffer(ByteBuffer buff) { if (!isComplex()) { throw new RuntimeException("Array is not complex"); } imaginary.rewind(); imaginary.put(buff); }
@Override public int hashCode() { if (isComplex()) { return Arrays.hashCode(new Object[]{real, dims, imaginary}); } else { return Arrays.hashCode(new Object[]{real, dims}); } }
public void putImaginaryByteBuffer( ByteBuffer buff ) { if ( !isComplex() ) { throw new RuntimeException("Array is not complex"); } imaginary.rewind(); imaginary.put( buff ); }
public void putImaginaryByteBuffer( ByteBuffer buff ) { if ( !isComplex() ) { throw new RuntimeException("Array is not complex"); } imaginary.rewind(); imaginary.put( buff ); }
public void putImaginaryByteBuffer(ByteBuffer buff) { if (!isComplex()) { throw new RuntimeException("Array is not complex"); } imaginary.rewind(); imaginary.put(buff); }
public void putImaginaryByteBuffer( ByteBuffer buff ) { if ( !isComplex() ) { throw new RuntimeException("Array is not complex"); } imaginary.rewind(); imaginary.put( buff ); }
/** * @param vector */ public void set(T[] vector) { if ( isComplex() ) { throw new IllegalStateException("Cannot use this method for Complex matrices"); } setReal(vector); } private int getByteOffset( int index )
/** * @param vector vector */ public void set(T[] vector) { if ( isComplex() ) { throw new IllegalStateException("Cannot use this method for Complex matrices"); } setReal(vector); } private int getByteOffset( int index )
/** * @param vector */ public void set(T[] vector) { if ( isComplex() ) { throw new IllegalStateException("Cannot use this method for Complex matrices"); } setReal(vector); } private int getByteOffset( int index )
@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); }
@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); }
/** Returns the imaginary value at the given index, always 0 for non-complex arrays. */ public T getImaginary(int index) { if (isComplex()) { return _get(imaginary, index); } else { return zero(); } }
/** Returns the imaginary value at the given index, always 0 for non-complex arrays. */ public T getImaginary(int index) { if (isComplex()) { return _get(imaginary, index); } else { return zero(); } }
protected void allocate() { real = ByteBuffer.allocate(getSize() * getBytesAllocated()); if (isComplex()) { imaginary = ByteBuffer.allocate(getSize() * getBytesAllocated()); } bytes = new byte[getBytesAllocated()]; }
protected void allocate( ) { real = ByteBuffer.allocate( getSize()*getBytesAllocated()); if ( isComplex() ) { imaginary = ByteBuffer.allocate( getSize()*getBytesAllocated()); } bytes = new byte[ getBytesAllocated() ]; }
protected void allocate( ) { real = ByteBuffer.allocate( getSize()*getBytesAllocated()); if ( isComplex() ) { imaginary = ByteBuffer.allocate( getSize()*getBytesAllocated()); } bytes = new byte[ getBytesAllocated() ]; }
protected void allocate( ) { real = ByteBuffer.allocate( getSize()*getBytesAllocated()); if ( isComplex() ) { imaginary = ByteBuffer.allocate( getSize()*getBytesAllocated()); } bytes = new byte[ getBytesAllocated() ]; }