Many ScaLAPACK routines require one or more work arrays to be passed as arguments. The name of a work array is usually WORK - sometimes IWORK or RWORK to distinguish work arrays of type integer or real. Immediately following the work array in the argument list is the specified length of the work array, LWORK , LIWORK, or LRWORK, respectively. LWORK is defined as the minimum amount of workspace necessary to perform the operation specified.
The first element of the work array is always used to return the correct value of LWORK for the computation. Whether or not an error is detected, the minimum value of LWORK is placed in WORK(1) on exit from the routine.
If the user passes a value for LWORK that is too small, an input error is detected and INFO is set accordingly (see section 4.6.6), the correct value for LWORK is placed in WORK(1), and the routine PXERBLA is called. The user is thus strongly advised to always check the value of INFO on exit from the called routine.