double ret[] = new double[1];
LAPACK lapack = LAPACK.getInstance();
// Query optimal workspace. First for computing the factorization
lapack.dgeqrf(m, n, dummy, Matrices.ld(m), dummy, ret, -1, info);
lwork1 = (info.val != 0) ? n : (int) ret[0];
// Workspace needed for generating an explicit orthogonal matrix
lapack.dorgqr(m, m, k, dummy, Matrices.ld(m), dummy, ret, -1, info);
lwork2 = (info.val != 0) ? n : (int) ret[0];