int lwork;
// Query optimal workspace. First for computing the factorization
{
work = new double[1];
intW info = new intW(0);
LAPACK.getInstance().dgeqrf(m, n, new double[0], Matrices.ld(m), new double[0],
work, -1, info);
if (info.val != 0)
lwork = n;
else
lwork = (int) work[0];
lwork = Math.max(1, lwork);
work = new double[lwork];
}
// Workspace needed for generating an explicit orthogonal matrix
{
workGen = new double[1];
intW info = new intW(0);
LAPACK.getInstance().dorgqr(m, n, k, new double[0],
Matrices.ld(m), new double[0], workGen, -1, info);
if (info.val != 0)
lwork = n;