The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

Questions about DGELSD

Open discussion regarding features, bugs, issues, vendors, etc.

Questions about DGELSD

Postby lambda » Mon Oct 29, 2007 7:56 am

Hi,

I have a few questions about DGELSD. It gets an IWORK array as parameter, but no LIWORK, even though the documentation states in the description of IWORK that

Code: Select all
LIWORK >= 3 * MINMN * NLVL + 11 * MINMN, where MINMN = MIN( M,N )


Should I pass an array of exactly this size?

The docs also state that

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


and that SMLSIZ is returned by ILAENV, but after reading the docs to ILAENV, I don't understand how to call it to get the SMLSIZ value.

Thanks for any help,
Boris
lambda
 
Posts: 1
Joined: Mon Oct 29, 2007 7:37 am

Postby Julien Langou » Mon Oct 29, 2007 11:28 am

Indeed it is not that easy to get LIWORK when you are not used to LAPACK.
Here is a quick made auxiliary routine that does the job for you. Julien.

Code: Select all
      SUBROUTINE COMPUTE_DGELSD_LIWORK( M, N, LIWORK )
*
      INTEGER            LIWORK, M, N
*
*  Purpose
*  =======
*   
*  Compute LIWORK needed by DGELSD.
*  M and N are input only arguments.
*  LIWORK is output only argument.
*
      DOUBLE PRECISION   TWO
      PARAMETER          ( TWO = 2.0D0 )
*   
      INTEGER            MINMN, NLVL, SMLSIZ
*
      INTEGER            ILAENV
      EXTERNAL           ILAENV
*   
      INTRINSIC          DBLE, INT, LOG, MAX, MIN
*     ..
*     .. Executable Statements ..
*   
      MINMN = MIN( M, N )
      MINMN = MAX( 1, MINMN )
*       
      SMLSIZ = ILAENV( 9, 'DGELSD', ' ', 0, 0, 0, 0 )
*   
      NLVL = MAX( INT( LOG( DBLE( MINMN ) / DBLE( SMLSIZ+1 ) ) /
     $       LOG( TWO ) ) + 1, 0 )
*   
      LIWORK = 3 * MINMN * NLVL + 11 * MINMN
*       
      END
Julien Langou
 
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 4 guests