@Override public void assign(DataBuffer data) { if (data.length() != length()) throw new IllegalArgumentException( "Unable to assign buffer of length " + data.length() + " to this buffer of length " + length()); for (int i = 0; i < data.length(); i++) { put(i, data.getDouble(i)); } }
@Override public void copyAtStride( DataBuffer buf, long n, long stride, long yStride, long offset, long yOffset) { if (dataType() == Type.FLOAT) { for (int i = 0; i < n; i++) { put(offset + i * stride, buf.getFloat(yOffset + i * yStride)); } } else { for (int i = 0; i < n; i++) { put(offset + i * stride, buf.getDouble(yOffset + i * yStride)); } } }
@Override public boolean equals(Object o) { if (o instanceof DataBuffer) { DataBuffer d = (DataBuffer) o; if (d.length() != length()) return false; for (int i = 0; i < length(); i++) { double eps = Math.abs(getDouble(i) - d.getDouble(i)); if (eps > Nd4j.EPS_THRESHOLD) return false; } } return true; }
@Override public boolean equals(Object o) { // FIXME: this is BAD. it takes too long to work, and it breaks general equals contract if (o instanceof DataBuffer) { DataBuffer d = (DataBuffer) o; if (d.length() != length()) return false; for (int i = 0; i < length(); i++) { double eps = Math.abs(getDouble(i) - d.getDouble(i)); if (eps > 1e-12) return false; } } return true; }