~ubuntu-branches/ubuntu/utopic/nwchem/utopic

« back to all changes in this revision

Viewing changes to src/lapack/double/zheev.f

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Daniel Leidert, Andreas Tille, Michael Banck
  • Date: 2013-07-04 12:14:55 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130704121455-5tvsx2qabor3nrui
Tags: 6.3-1
* New upstream release.
* Fixes anisotropic properties (Closes: #696361).
* New features include:
  + Multi-reference coupled cluster (MRCC) approaches
  + Hybrid DFT calculations with short-range HF 
  + New density-functionals including Minnesota (M08, M11) and HSE hybrid
    functionals
  + X-ray absorption spectroscopy (XAS) with TDDFT
  + Analytical gradients for the COSMO solvation model
  + Transition densities from TDDFT 
  + DFT+U and Electron-Transfer (ET) methods for plane wave calculations
  + Exploitation of space group symmetry in plane wave geometry optimizations
  + Local density of states (LDOS) collective variable added to Metadynamics
  + Various new XC functionals added for plane wave calculations, including
    hybrid and range-corrected ones
  + Electric field gradients with relativistic corrections 
  + Nudged Elastic Band optimization method
  + Updated basis sets and ECPs 

[ Daniel Leidert ]
* debian/watch: Fixed.

[ Andreas Tille ]
* debian/upstream: References

[ Michael Banck ]
* debian/upstream (Name): New field.
* debian/patches/02_makefile_flags.patch: Refreshed.
* debian/patches/06_statfs_kfreebsd.patch: Likewise.
* debian/patches/07_ga_target_force_linux.patch: Likewise.
* debian/patches/05_avoid_inline_assembler.patch: Removed, no longer needed.
* debian/patches/09_backported_6.1.1_fixes.patch: Likewise.
* debian/control (Build-Depends): Added gfortran-4.7 and gcc-4.7.
* debian/patches/10_force_gcc-4.7.patch: New patch, explicitly sets
  gfortran-4.7 and gcc-4.7, fixes test suite hang with gcc-4.8 (Closes:
  #701328, #713262).
* debian/testsuite: Added tests for COSMO analytical gradients and MRCC.
* debian/rules (MRCC_METHODS): New variable, required to enable MRCC methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
*> \brief <b> ZHEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices</b>
 
2
*
 
3
*  =========== DOCUMENTATION ===========
 
4
*
 
5
* Online html documentation available at 
 
6
*            http://www.netlib.org/lapack/explore-html/ 
 
7
*
 
8
*> \htmlonly
 
9
*> Download ZHEEV + dependencies 
 
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zheev.f"> 
 
11
*> [TGZ]</a> 
 
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zheev.f"> 
 
13
*> [ZIP]</a> 
 
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zheev.f"> 
 
15
*> [TXT]</a>
 
16
*> \endhtmlonly 
 
17
*
 
18
*  Definition:
 
19
*  ===========
 
20
*
 
21
*       SUBROUTINE ZHEEV( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK,
 
22
*                         INFO )
 
23
 
24
*       .. Scalar Arguments ..
 
25
*       CHARACTER          JOBZ, UPLO
 
26
*       INTEGER            INFO, LDA, LWORK, N
 
27
*       ..
 
28
*       .. Array Arguments ..
 
29
*       DOUBLE PRECISION   RWORK( * ), W( * )
 
30
*       COMPLEX*16         A( LDA, * ), WORK( * )
 
31
*       ..
 
32
*  
 
33
*
 
34
*> \par Purpose:
 
35
*  =============
 
36
*>
 
37
*> \verbatim
 
38
*>
 
39
*> ZHEEV computes all eigenvalues and, optionally, eigenvectors of a
 
40
*> complex Hermitian matrix A.
 
41
*> \endverbatim
 
42
*
 
43
*  Arguments:
 
44
*  ==========
 
45
*
 
46
*> \param[in] JOBZ
 
47
*> \verbatim
 
48
*>          JOBZ is CHARACTER*1
 
49
*>          = 'N':  Compute eigenvalues only;
 
50
*>          = 'V':  Compute eigenvalues and eigenvectors.
 
51
*> \endverbatim
 
52
*>
 
53
*> \param[in] UPLO
 
54
*> \verbatim
 
55
*>          UPLO is CHARACTER*1
 
56
*>          = 'U':  Upper triangle of A is stored;
 
57
*>          = 'L':  Lower triangle of A is stored.
 
58
*> \endverbatim
 
59
*>
 
60
*> \param[in] N
 
61
*> \verbatim
 
62
*>          N is INTEGER
 
63
*>          The order of the matrix A.  N >= 0.
 
64
*> \endverbatim
 
65
*>
 
66
*> \param[in,out] A
 
67
*> \verbatim
 
68
*>          A is COMPLEX*16 array, dimension (LDA, N)
 
69
*>          On entry, the Hermitian matrix A.  If UPLO = 'U', the
 
70
*>          leading N-by-N upper triangular part of A contains the
 
71
*>          upper triangular part of the matrix A.  If UPLO = 'L',
 
72
*>          the leading N-by-N lower triangular part of A contains
 
73
*>          the lower triangular part of the matrix A.
 
74
*>          On exit, if JOBZ = 'V', then if INFO = 0, A contains the
 
75
*>          orthonormal eigenvectors of the matrix A.
 
76
*>          If JOBZ = 'N', then on exit the lower triangle (if UPLO='L')
 
77
*>          or the upper triangle (if UPLO='U') of A, including the
 
78
*>          diagonal, is destroyed.
 
79
*> \endverbatim
 
80
*>
 
81
*> \param[in] LDA
 
82
*> \verbatim
 
83
*>          LDA is INTEGER
 
84
*>          The leading dimension of the array A.  LDA >= max(1,N).
 
85
*> \endverbatim
 
86
*>
 
87
*> \param[out] W
 
88
*> \verbatim
 
89
*>          W is DOUBLE PRECISION array, dimension (N)
 
90
*>          If INFO = 0, the eigenvalues in ascending order.
 
91
*> \endverbatim
 
92
*>
 
93
*> \param[out] WORK
 
94
*> \verbatim
 
95
*>          WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
 
96
*>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
 
97
*> \endverbatim
 
98
*>
 
99
*> \param[in] LWORK
 
100
*> \verbatim
 
101
*>          LWORK is INTEGER
 
102
*>          The length of the array WORK.  LWORK >= max(1,2*N-1).
 
103
*>          For optimal efficiency, LWORK >= (NB+1)*N,
 
104
*>          where NB is the blocksize for ZHETRD returned by ILAENV.
 
105
*>
 
106
*>          If LWORK = -1, then a workspace query is assumed; the routine
 
107
*>          only calculates the optimal size of the WORK array, returns
 
108
*>          this value as the first entry of the WORK array, and no error
 
109
*>          message related to LWORK is issued by XERBLA.
 
110
*> \endverbatim
 
111
*>
 
112
*> \param[out] RWORK
 
113
*> \verbatim
 
114
*>          RWORK is DOUBLE PRECISION array, dimension (max(1, 3*N-2))
 
115
*> \endverbatim
 
116
*>
 
117
*> \param[out] INFO
 
118
*> \verbatim
 
119
*>          INFO is INTEGER
 
120
*>          = 0:  successful exit
 
121
*>          < 0:  if INFO = -i, the i-th argument had an illegal value
 
122
*>          > 0:  if INFO = i, the algorithm failed to converge; i
 
123
*>                off-diagonal elements of an intermediate tridiagonal
 
124
*>                form did not converge to zero.
 
125
*> \endverbatim
 
126
*
 
127
*  Authors:
 
128
*  ========
 
129
*
 
130
*> \author Univ. of Tennessee 
 
131
*> \author Univ. of California Berkeley 
 
132
*> \author Univ. of Colorado Denver 
 
133
*> \author NAG Ltd. 
 
134
*
 
135
*> \date November 2011
 
136
*
 
137
*> \ingroup complex16HEeigen
 
138
*
 
139
*  =====================================================================
1
140
      SUBROUTINE ZHEEV( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK,
2
141
     $                  INFO )
3
142
*
4
 
*  -- LAPACK driver routine (version 2.0) --
5
 
*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6
 
*     Courant Institute, Argonne National Lab, and Rice University
7
 
*     September 30, 1994
 
143
*  -- LAPACK driver routine (version 3.4.0) --
 
144
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
 
145
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
 
146
*     November 2011
8
147
*
9
148
*     .. Scalar Arguments ..
10
149
      CHARACTER          JOBZ, UPLO
15
154
      COMPLEX*16         A( LDA, * ), WORK( * )
16
155
*     ..
17
156
*
18
 
c
19
 
* $Id: zheev.f 19697 2010-10-29 16:57:34Z d3y133 $
20
 
c
21
 
*  Purpose
22
 
*  =======
23
 
*
24
 
*  ZHEEV computes all eigenvalues and, optionally, eigenvectors of a
25
 
*  complex Hermitian matrix A.
26
 
*
27
 
*  Arguments
28
 
*  =========
29
 
*
30
 
*  JOBZ    (input) CHARACTER*1
31
 
*          = 'N':  Compute eigenvalues only;
32
 
*          = 'V':  Compute eigenvalues and eigenvectors.
33
 
*
34
 
*  UPLO    (input) CHARACTER*1
35
 
*          = 'U':  Upper triangle of A is stored;
36
 
*          = 'L':  Lower triangle of A is stored.
37
 
*
38
 
*  N       (input) INTEGER
39
 
*          The order of the matrix A.  N >= 0.
40
 
*
41
 
*  A       (input/output) COMPLEX*16 array, dimension (LDA, N)
42
 
*          On entry, the Hermitian matrix A.  If UPLO = 'U', the
43
 
*          leading N-by-N upper triangular part of A contains the
44
 
*          upper triangular part of the matrix A.  If UPLO = 'L',
45
 
*          the leading N-by-N lower triangular part of A contains
46
 
*          the lower triangular part of the matrix A.
47
 
*          On exit, if JOBZ = 'V', then if INFO = 0, A contains the
48
 
*          orthonormal eigenvectors of the matrix A.
49
 
*          If JOBZ = 'N', then on exit the lower triangle (if UPLO='L')
50
 
*          or the upper triangle (if UPLO='U') of A, including the
51
 
*          diagonal, is destroyed.
52
 
*
53
 
*  LDA     (input) INTEGER
54
 
*          The leading dimension of the array A.  LDA >= max(1,N).
55
 
*
56
 
*  W       (output) DOUBLE PRECISION array, dimension (N)
57
 
*          If INFO = 0, the eigenvalues in ascending order.
58
 
*
59
 
*  WORK    (workspace/output) COMPLEX*16 array, dimension (LWORK)
60
 
*          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
61
 
*
62
 
*  LWORK   (input) INTEGER
63
 
*          The length of the array WORK.  LWORK >= max(1,2*N-1).
64
 
*          For optimal efficiency, LWORK >= (NB+1)*N,
65
 
*          where NB is the blocksize for ZHETRD returned by ILAENV.
66
 
*
67
 
*  RWORK   (workspace) DOUBLE PRECISION array, dimension (max(1, 3*N-2))
68
 
*
69
 
*  INFO    (output) INTEGER
70
 
*          = 0:  successful exit
71
 
*          < 0:  if INFO = -i, the i-th argument had an illegal value
72
 
*          > 0:  if INFO = i, the algorithm failed to converge; i
73
 
*                off-diagonal elements of an intermediate tridiagonal
74
 
*                form did not converge to zero.
75
 
*
76
157
*  =====================================================================
77
158
*
78
159
*     .. Parameters ..
82
163
      PARAMETER          ( CONE = ( 1.0D0, 0.0D0 ) )
83
164
*     ..
84
165
*     .. Local Scalars ..
85
 
      LOGICAL            LOWER, WANTZ
 
166
      LOGICAL            LOWER, LQUERY, WANTZ
86
167
      INTEGER            IINFO, IMAX, INDE, INDTAU, INDWRK, ISCALE,
87
 
     $                   LLWORK, LOPT
 
168
     $                   LLWORK, LWKOPT, NB
88
169
      DOUBLE PRECISION   ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA,
89
170
     $                   SMLNUM
90
171
*     ..
91
172
*     .. External Functions ..
92
173
      LOGICAL            LSAME
 
174
      INTEGER            ILAENV
93
175
      DOUBLE PRECISION   DLAMCH, ZLANHE
94
 
      EXTERNAL           LSAME, DLAMCH, ZLANHE
 
176
      EXTERNAL           LSAME, ILAENV, DLAMCH, ZLANHE
95
177
*     ..
96
178
*     .. External Subroutines ..
97
179
      EXTERNAL           DSCAL, DSTERF, XERBLA, ZHETRD, ZLASCL, ZSTEQR,
106
188
*
107
189
      WANTZ = LSAME( JOBZ, 'V' )
108
190
      LOWER = LSAME( UPLO, 'L' )
 
191
      LQUERY = ( LWORK.EQ.-1 )
109
192
*
110
193
      INFO = 0
111
194
      IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
116
199
         INFO = -3
117
200
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
118
201
         INFO = -5
119
 
      ELSE IF( LWORK.LT.MAX( 1, 2*N-1 ) ) THEN
120
 
         INFO = -8
 
202
      END IF
 
203
*
 
204
      IF( INFO.EQ.0 ) THEN
 
205
         NB = ILAENV( 1, 'ZHETRD', UPLO, N, -1, -1, -1 )
 
206
         LWKOPT = MAX( 1, ( NB+1 )*N )
 
207
         WORK( 1 ) = LWKOPT
 
208
*
 
209
         IF( LWORK.LT.MAX( 1, 2*N-1 ) .AND. .NOT.LQUERY )
 
210
     $      INFO = -8
121
211
      END IF
122
212
*
123
213
      IF( INFO.NE.0 ) THEN
124
214
         CALL XERBLA( 'ZHEEV ', -INFO )
125
215
         RETURN
 
216
      ELSE IF( LQUERY ) THEN
 
217
         RETURN
126
218
      END IF
127
219
*
128
220
*     Quick return if possible
129
221
*
130
222
      IF( N.EQ.0 ) THEN
131
 
         WORK( 1 ) = 1
132
223
         RETURN
133
224
      END IF
134
225
*
135
226
      IF( N.EQ.1 ) THEN
136
227
         W( 1 ) = A( 1, 1 )
137
 
         WORK( 1 ) = 3
 
228
         WORK( 1 ) = 1
138
229
         IF( WANTZ )
139
230
     $      A( 1, 1 ) = CONE
140
231
         RETURN
171
262
      LLWORK = LWORK - INDWRK + 1
172
263
      CALL ZHETRD( UPLO, N, A, LDA, W, RWORK( INDE ), WORK( INDTAU ),
173
264
     $             WORK( INDWRK ), LLWORK, IINFO )
174
 
      LOPT = N + WORK( INDWRK )
175
265
*
176
266
*     For eigenvalues only, call DSTERF.  For eigenvectors, first call
177
267
*     ZUNGTR to generate the unitary matrix, then call ZSTEQR.
199
289
*
200
290
*     Set WORK(1) to optimal complex workspace size.
201
291
*
202
 
      WORK( 1 ) = MAX( 2*N-1, LOPT )
 
292
      WORK( 1 ) = LWKOPT
203
293
*
204
294
      RETURN
205
295
*