JCublasJava/src/main/java/jcuda/jcublas/JCublas.java
public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb)
    {
        ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2);
        byteBufferB.order(ByteOrder.nativeOrder());
        FloatBuffer floatBufferB = byteBufferB.asFloatBuffer();
        int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb);
        if (status == cublasStatus.CUBLAS_STATUS_SUCCESS)
        {
            floatBufferB.rewind();
            for (int c=0; c<cols; c++)
            {
                for (int r=0; r<rows; r++)
                {
                    int index = c * ldb + r + offsetB;
                    B[index].x = floatBufferB.get(index*2+0);
                    B[index].y = floatBufferB.get(index*2+1);
                }
            }
        }
        return checkResult(status);
    }
public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb)
    {
        ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2);
        byteBufferB.order(ByteOrder.nativeOrder());
        FloatBuffer floatBufferB = byteBufferB.asFloatBuffer();
        int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb);
        if (status == cublasStatus.CUBLAS_STATUS_SUCCESS)
        {
            floatBufferB.rewind();
            for (int c=0; c<cols; c++)
            {
                for (int r=0; r<rows; r++)
                {
                    int index = c * ldb + r + offsetB;
                    B[index].x = floatBufferB.get(index*2+0);
                    B[index].y = floatBufferB.get(index*2+1);
                }
            }
        }
        return checkResult(status);
    }
Extended wrapper for arrays of cuComplex values. Note that this method
only exists for convenience and compatibility with native C code. It
is much more efficient to provide a Pointer to a float array that may
store the complex numbers, where each pair of consecutive numbers in
the array describes the real- and imaginary part of one complex number.

@see JCublas#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int)