I need to solve some linear least squares problems. The matrix is not necessarily full rank, so I guess I need to use xGELSY or xGELSD.

For xGELSY, I don't know what to pass for the JPVT and RCOND input parameters.

For xGELSD, I don't know what to pass for RCOND or what dimension to use for IWORK. How come the function can compute the size of WORK for you, but not IWORK?

I see that

LIWORK >= 3 * MINMN * NLVL + 11 * MINMN

where

MINMN = MIN( M,N)

and

NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) +1)

but what is SMLSIZ?