@Override protected MatrixByteBuffered2x2DType newMatrixFrom(final MatrixReadable2x2DType m) { final ByteBuffer buf = ByteBuffer.allocate(200); final MatrixByteBuffered2x2DType mr = MatrixByteBufferedM2x2D.newMatrixFromByteBuffer(buf, 0L); MatrixM2x2D.copy(m, mr); return mr; }
@Override protected MatrixByteBuffered2x2DType newMatrix() { final ByteBuffer buf = ByteBuffer.allocate(200); final MatrixByteBuffered2x2DType mr = MatrixByteBufferedM2x2D.newMatrixFromByteBuffer(buf, 0L); MatrixM2x2D.setIdentity(mr); return mr; }
@Override protected MatrixByteBuffered2x2DType newMatrixAtIndexFromSize( final long size, final long offset) { final ByteBuffer buf = ByteBuffer.allocate((int) size); final MatrixByteBuffered2x2DType mr = MatrixByteBufferedM2x2D.newMatrixFromByteBuffer(buf, offset); return mr; }
@Test public void testImplementationSpecificMemoryLayout0() { final ByteBuffer b = ByteBuffer.allocate(4 * 8); b.order(ByteOrder.BIG_ENDIAN); final MatrixByteBuffered2x2DType m = MatrixByteBufferedM2x2D.newMatrixFromByteBuffer(b, 0L); m.setRowColumnD(0, 0, Double.longBitsToDouble(0x0102030405060708L)); m.setRowColumnD(1, 0, Double.longBitsToDouble(0x1112131415161718L)); m.setRowColumnD(0, 1, Double.longBitsToDouble(0x4142434445464748L)); m.setRowColumnD(1, 1, Double.longBitsToDouble(0x5152535455565758L)); Assert.assertEquals(0x0102030405060708L, b.getLong(0)); Assert.assertEquals(0x1112131415161718L, b.getLong(8)); Assert.assertEquals(0x4142434445464748L, b.getLong(16)); Assert.assertEquals(0x5152535455565758L, b.getLong(24)); }
@Override protected MatrixByteBuffered2x2DType newMatrixWithBaseOffset( final int size, final AtomicLong base, final int offset) { final ByteBuffer buf = ByteBuffer.allocate(size); return MatrixByteBufferedM2x2D.newMatrixFromByteBufferAndBase(buf, base, offset); }