int lwork;
// Query optimal workspace. First for computing the factorization
{
work = new double[1];
intW info = new intW(0);
LAPACK.getInstance().dgelqf(m, n, new double[0], Matrices.ld(m), new double[0],
work, -1, info);
if (info.val != 0)
lwork = m;
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().dorglq(m, n, m, new double[0],
Matrices.ld(m), new double[0], workGen, -1, info);
if (info.val != 0)
lwork = m;