~ubuntu-branches/ubuntu/trusty/nwchem/trusty-proposed

« back to all changes in this revision

Viewing changes to src/lapack/single/slaed8.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 SLAED8 used by sstedc. Merges eigenvalues and deflates secular equation. Used when the original matrix is dense.
 
2
*
 
3
*  =========== DOCUMENTATION ===========
 
4
*
 
5
* Online html documentation available at 
 
6
*            http://www.netlib.org/lapack/explore-html/ 
 
7
*
 
8
*> \htmlonly
 
9
*> Download SLAED8 + dependencies 
 
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaed8.f"> 
 
11
*> [TGZ]</a> 
 
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaed8.f"> 
 
13
*> [ZIP]</a> 
 
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaed8.f"> 
 
15
*> [TXT]</a>
 
16
*> \endhtmlonly 
 
17
*
 
18
*  Definition:
 
19
*  ===========
 
20
*
 
21
*       SUBROUTINE SLAED8( ICOMPQ, K, N, QSIZ, D, Q, LDQ, INDXQ, RHO,
 
22
*                          CUTPNT, Z, DLAMDA, Q2, LDQ2, W, PERM, GIVPTR,
 
23
*                          GIVCOL, GIVNUM, INDXP, INDX, INFO )
 
24
 
25
*       .. Scalar Arguments ..
 
26
*       INTEGER            CUTPNT, GIVPTR, ICOMPQ, INFO, K, LDQ, LDQ2, N,
 
27
*      $                   QSIZ
 
28
*       REAL               RHO
 
29
*       ..
 
30
*       .. Array Arguments ..
 
31
*       INTEGER            GIVCOL( 2, * ), INDX( * ), INDXP( * ),
 
32
*      $                   INDXQ( * ), PERM( * )
 
33
*       REAL               D( * ), DLAMDA( * ), GIVNUM( 2, * ),
 
34
*      $                   Q( LDQ, * ), Q2( LDQ2, * ), W( * ), Z( * )
 
35
*       ..
 
36
*  
 
37
*
 
38
*> \par Purpose:
 
39
*  =============
 
40
*>
 
41
*> \verbatim
 
42
*>
 
43
*> SLAED8 merges the two sets of eigenvalues together into a single
 
44
*> sorted set.  Then it tries to deflate the size of the problem.
 
45
*> There are two ways in which deflation can occur:  when two or more
 
46
*> eigenvalues are close together or if there is a tiny element in the
 
47
*> Z vector.  For each such occurrence the order of the related secular
 
48
*> equation problem is reduced by one.
 
49
*> \endverbatim
 
50
*
 
51
*  Arguments:
 
52
*  ==========
 
53
*
 
54
*> \param[in] ICOMPQ
 
55
*> \verbatim
 
56
*>          ICOMPQ is INTEGER
 
57
*>          = 0:  Compute eigenvalues only.
 
58
*>          = 1:  Compute eigenvectors of original dense symmetric matrix
 
59
*>                also.  On entry, Q contains the orthogonal matrix used
 
60
*>                to reduce the original matrix to tridiagonal form.
 
61
*> \endverbatim
 
62
*>
 
63
*> \param[out] K
 
64
*> \verbatim
 
65
*>          K is INTEGER
 
66
*>         The number of non-deflated eigenvalues, and the order of the
 
67
*>         related secular equation.
 
68
*> \endverbatim
 
69
*>
 
70
*> \param[in] N
 
71
*> \verbatim
 
72
*>          N is INTEGER
 
73
*>         The dimension of the symmetric tridiagonal matrix.  N >= 0.
 
74
*> \endverbatim
 
75
*>
 
76
*> \param[in] QSIZ
 
77
*> \verbatim
 
78
*>          QSIZ is INTEGER
 
79
*>         The dimension of the orthogonal matrix used to reduce
 
80
*>         the full matrix to tridiagonal form.  QSIZ >= N if ICOMPQ = 1.
 
81
*> \endverbatim
 
82
*>
 
83
*> \param[in,out] D
 
84
*> \verbatim
 
85
*>          D is REAL array, dimension (N)
 
86
*>         On entry, the eigenvalues of the two submatrices to be
 
87
*>         combined.  On exit, the trailing (N-K) updated eigenvalues
 
88
*>         (those which were deflated) sorted into increasing order.
 
89
*> \endverbatim
 
90
*>
 
91
*> \param[in,out] Q
 
92
*> \verbatim
 
93
*>          Q is REAL array, dimension (LDQ,N)
 
94
*>         If ICOMPQ = 0, Q is not referenced.  Otherwise,
 
95
*>         on entry, Q contains the eigenvectors of the partially solved
 
96
*>         system which has been previously updated in matrix
 
97
*>         multiplies with other partially solved eigensystems.
 
98
*>         On exit, Q contains the trailing (N-K) updated eigenvectors
 
99
*>         (those which were deflated) in its last N-K columns.
 
100
*> \endverbatim
 
101
*>
 
102
*> \param[in] LDQ
 
103
*> \verbatim
 
104
*>          LDQ is INTEGER
 
105
*>         The leading dimension of the array Q.  LDQ >= max(1,N).
 
106
*> \endverbatim
 
107
*>
 
108
*> \param[in] INDXQ
 
109
*> \verbatim
 
110
*>          INDXQ is INTEGER array, dimension (N)
 
111
*>         The permutation which separately sorts the two sub-problems
 
112
*>         in D into ascending order.  Note that elements in the second
 
113
*>         half of this permutation must first have CUTPNT added to
 
114
*>         their values in order to be accurate.
 
115
*> \endverbatim
 
116
*>
 
117
*> \param[in,out] RHO
 
118
*> \verbatim
 
119
*>          RHO is REAL
 
120
*>         On entry, the off-diagonal element associated with the rank-1
 
121
*>         cut which originally split the two submatrices which are now
 
122
*>         being recombined.
 
123
*>         On exit, RHO has been modified to the value required by
 
124
*>         SLAED3.
 
125
*> \endverbatim
 
126
*>
 
127
*> \param[in] CUTPNT
 
128
*> \verbatim
 
129
*>          CUTPNT is INTEGER
 
130
*>         The location of the last eigenvalue in the leading
 
131
*>         sub-matrix.  min(1,N) <= CUTPNT <= N.
 
132
*> \endverbatim
 
133
*>
 
134
*> \param[in] Z
 
135
*> \verbatim
 
136
*>          Z is REAL array, dimension (N)
 
137
*>         On entry, Z contains the updating vector (the last row of
 
138
*>         the first sub-eigenvector matrix and the first row of the
 
139
*>         second sub-eigenvector matrix).
 
140
*>         On exit, the contents of Z are destroyed by the updating
 
141
*>         process.
 
142
*> \endverbatim
 
143
*>
 
144
*> \param[out] DLAMDA
 
145
*> \verbatim
 
146
*>          DLAMDA is REAL array, dimension (N)
 
147
*>         A copy of the first K eigenvalues which will be used by
 
148
*>         SLAED3 to form the secular equation.
 
149
*> \endverbatim
 
150
*>
 
151
*> \param[out] Q2
 
152
*> \verbatim
 
153
*>          Q2 is REAL array, dimension (LDQ2,N)
 
154
*>         If ICOMPQ = 0, Q2 is not referenced.  Otherwise,
 
155
*>         a copy of the first K eigenvectors which will be used by
 
156
*>         SLAED7 in a matrix multiply (SGEMM) to update the new
 
157
*>         eigenvectors.
 
158
*> \endverbatim
 
159
*>
 
160
*> \param[in] LDQ2
 
161
*> \verbatim
 
162
*>          LDQ2 is INTEGER
 
163
*>         The leading dimension of the array Q2.  LDQ2 >= max(1,N).
 
164
*> \endverbatim
 
165
*>
 
166
*> \param[out] W
 
167
*> \verbatim
 
168
*>          W is REAL array, dimension (N)
 
169
*>         The first k values of the final deflation-altered z-vector and
 
170
*>         will be passed to SLAED3.
 
171
*> \endverbatim
 
172
*>
 
173
*> \param[out] PERM
 
174
*> \verbatim
 
175
*>          PERM is INTEGER array, dimension (N)
 
176
*>         The permutations (from deflation and sorting) to be applied
 
177
*>         to each eigenblock.
 
178
*> \endverbatim
 
179
*>
 
180
*> \param[out] GIVPTR
 
181
*> \verbatim
 
182
*>          GIVPTR is INTEGER
 
183
*>         The number of Givens rotations which took place in this
 
184
*>         subproblem.
 
185
*> \endverbatim
 
186
*>
 
187
*> \param[out] GIVCOL
 
188
*> \verbatim
 
189
*>          GIVCOL is INTEGER array, dimension (2, N)
 
190
*>         Each pair of numbers indicates a pair of columns to take place
 
191
*>         in a Givens rotation.
 
192
*> \endverbatim
 
193
*>
 
194
*> \param[out] GIVNUM
 
195
*> \verbatim
 
196
*>          GIVNUM is REAL array, dimension (2, N)
 
197
*>         Each number indicates the S value to be used in the
 
198
*>         corresponding Givens rotation.
 
199
*> \endverbatim
 
200
*>
 
201
*> \param[out] INDXP
 
202
*> \verbatim
 
203
*>          INDXP is INTEGER array, dimension (N)
 
204
*>         The permutation used to place deflated values of D at the end
 
205
*>         of the array.  INDXP(1:K) points to the nondeflated D-values
 
206
*>         and INDXP(K+1:N) points to the deflated eigenvalues.
 
207
*> \endverbatim
 
208
*>
 
209
*> \param[out] INDX
 
210
*> \verbatim
 
211
*>          INDX is INTEGER array, dimension (N)
 
212
*>         The permutation used to sort the contents of D into ascending
 
213
*>         order.
 
214
*> \endverbatim
 
215
*>
 
216
*> \param[out] INFO
 
217
*> \verbatim
 
218
*>          INFO is INTEGER
 
219
*>          = 0:  successful exit.
 
220
*>          < 0:  if INFO = -i, the i-th argument had an illegal value.
 
221
*> \endverbatim
 
222
*
 
223
*  Authors:
 
224
*  ========
 
225
*
 
226
*> \author Univ. of Tennessee 
 
227
*> \author Univ. of California Berkeley 
 
228
*> \author Univ. of Colorado Denver 
 
229
*> \author NAG Ltd. 
 
230
*
 
231
*> \date September 2012
 
232
*
 
233
*> \ingroup auxOTHERcomputational
 
234
*
 
235
*> \par Contributors:
 
236
*  ==================
 
237
*>
 
238
*> Jeff Rutter, Computer Science Division, University of California
 
239
*> at Berkeley, USA
 
240
*
 
241
*  =====================================================================
1
242
      SUBROUTINE SLAED8( ICOMPQ, K, N, QSIZ, D, Q, LDQ, INDXQ, RHO,
2
243
     $                   CUTPNT, Z, DLAMDA, Q2, LDQ2, W, PERM, GIVPTR,
3
244
     $                   GIVCOL, GIVNUM, INDXP, INDX, INFO )
4
245
*
5
 
*  -- LAPACK routine (version 3.0) --
6
 
*     Univ. of Tennessee, Oak Ridge National Lab, Argonne National Lab,
7
 
*     Courant Institute, NAG Ltd., and Rice University
8
 
*     September 30, 1994
 
246
*  -- LAPACK computational routine (version 3.4.2) --
 
247
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
 
248
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
 
249
*     September 2012
9
250
*
10
251
*     .. Scalar Arguments ..
11
252
      INTEGER            CUTPNT, GIVPTR, ICOMPQ, INFO, K, LDQ, LDQ2, N,
19
260
     $                   Q( LDQ, * ), Q2( LDQ2, * ), W( * ), Z( * )
20
261
*     ..
21
262
*
22
 
*  Purpose
23
 
*  =======
24
 
*
25
 
*  SLAED8 merges the two sets of eigenvalues together into a single
26
 
*  sorted set.  Then it tries to deflate the size of the problem.
27
 
*  There are two ways in which deflation can occur:  when two or more
28
 
*  eigenvalues are close together or if there is a tiny element in the
29
 
*  Z vector.  For each such occurrence the order of the related secular
30
 
*  equation problem is reduced by one.
31
 
*
32
 
*  Arguments
33
 
*  =========
34
 
*
35
 
*  ICOMPQ  (input) INTEGER
36
 
*          = 0:  Compute eigenvalues only.
37
 
*          = 1:  Compute eigenvectors of original dense symmetric matrix
38
 
*                also.  On entry, Q contains the orthogonal matrix used
39
 
*                to reduce the original matrix to tridiagonal form.
40
 
*
41
 
*  K      (output) INTEGER
42
 
*         The number of non-deflated eigenvalues, and the order of the
43
 
*         related secular equation.
44
 
*
45
 
*  N      (input) INTEGER
46
 
*         The dimension of the symmetric tridiagonal matrix.  N >= 0.
47
 
*
48
 
*  QSIZ   (input) INTEGER
49
 
*         The dimension of the orthogonal matrix used to reduce
50
 
*         the full matrix to tridiagonal form.  QSIZ >= N if ICOMPQ = 1.
51
 
*
52
 
*  D      (input/output) REAL array, dimension (N)
53
 
*         On entry, the eigenvalues of the two submatrices to be
54
 
*         combined.  On exit, the trailing (N-K) updated eigenvalues
55
 
*         (those which were deflated) sorted into increasing order.
56
 
*
57
 
*  Q      (input/output) REAL array, dimension (LDQ,N)
58
 
*         If ICOMPQ = 0, Q is not referenced.  Otherwise,
59
 
*         on entry, Q contains the eigenvectors of the partially solved
60
 
*         system which has been previously updated in matrix
61
 
*         multiplies with other partially solved eigensystems.
62
 
*         On exit, Q contains the trailing (N-K) updated eigenvectors
63
 
*         (those which were deflated) in its last N-K columns.
64
 
*
65
 
*  LDQ    (input) INTEGER
66
 
*         The leading dimension of the array Q.  LDQ >= max(1,N).
67
 
*
68
 
*  INDXQ  (input) INTEGER array, dimension (N)
69
 
*         The permutation which separately sorts the two sub-problems
70
 
*         in D into ascending order.  Note that elements in the second
71
 
*         half of this permutation must first have CUTPNT added to
72
 
*         their values in order to be accurate.
73
 
*
74
 
*  RHO    (input/output) REAL
75
 
*         On entry, the off-diagonal element associated with the rank-1
76
 
*         cut which originally split the two submatrices which are now
77
 
*         being recombined.
78
 
*         On exit, RHO has been modified to the value required by
79
 
*         SLAED3.
80
 
*
81
 
*  CUTPNT (input) INTEGER
82
 
*         The location of the last eigenvalue in the leading
83
 
*         sub-matrix.  min(1,N) <= CUTPNT <= N.
84
 
*
85
 
*  Z      (input) REAL array, dimension (N)
86
 
*         On entry, Z contains the updating vector (the last row of
87
 
*         the first sub-eigenvector matrix and the first row of the
88
 
*         second sub-eigenvector matrix).
89
 
*         On exit, the contents of Z are destroyed by the updating
90
 
*         process.
91
 
*
92
 
*  DLAMDA (output) REAL array, dimension (N)
93
 
*         A copy of the first K eigenvalues which will be used by
94
 
*         SLAED3 to form the secular equation.
95
 
*
96
 
*  Q2     (output) REAL array, dimension (LDQ2,N)
97
 
*         If ICOMPQ = 0, Q2 is not referenced.  Otherwise,
98
 
*         a copy of the first K eigenvectors which will be used by
99
 
*         SLAED7 in a matrix multiply (SGEMM) to update the new
100
 
*         eigenvectors.
101
 
*
102
 
*  LDQ2   (input) INTEGER
103
 
*         The leading dimension of the array Q2.  LDQ2 >= max(1,N).
104
 
*
105
 
*  W      (output) REAL array, dimension (N)
106
 
*         The first k values of the final deflation-altered z-vector and
107
 
*         will be passed to SLAED3.
108
 
*
109
 
*  PERM   (output) INTEGER array, dimension (N)
110
 
*         The permutations (from deflation and sorting) to be applied
111
 
*         to each eigenblock.
112
 
*
113
 
*  GIVPTR (output) INTEGER
114
 
*         The number of Givens rotations which took place in this
115
 
*         subproblem.
116
 
*
117
 
*  GIVCOL (output) INTEGER array, dimension (2, N)
118
 
*         Each pair of numbers indicates a pair of columns to take place
119
 
*         in a Givens rotation.
120
 
*
121
 
*  GIVNUM (output) REAL array, dimension (2, N)
122
 
*         Each number indicates the S value to be used in the
123
 
*         corresponding Givens rotation.
124
 
*
125
 
*  INDXP  (workspace) INTEGER array, dimension (N)
126
 
*         The permutation used to place deflated values of D at the end
127
 
*         of the array.  INDXP(1:K) points to the nondeflated D-values
128
 
*         and INDXP(K+1:N) points to the deflated eigenvalues.
129
 
*
130
 
*  INDX   (workspace) INTEGER array, dimension (N)
131
 
*         The permutation used to sort the contents of D into ascending
132
 
*         order.
133
 
*
134
 
*  INFO   (output) INTEGER
135
 
*          = 0:  successful exit.
136
 
*          < 0:  if INFO = -i, the i-th argument had an illegal value.
137
 
*
138
 
*  Further Details
139
 
*  ===============
140
 
*
141
 
*  Based on contributions by
142
 
*     Jeff Rutter, Computer Science Division, University of California
143
 
*     at Berkeley, USA
144
 
*
145
263
*  =====================================================================
146
264
*
147
265
*     .. Parameters ..
189
307
         RETURN
190
308
      END IF
191
309
*
 
310
*     Need to initialize GIVPTR to O here in case of quick exit
 
311
*     to prevent an unspecified code behavior (usually sigfault) 
 
312
*     when IWORK array on entry to *stedc is not zeroed 
 
313
*     (or at least some IWORK entries which used in *laed7 for GIVPTR).
 
314
*
 
315
      GIVPTR = 0
 
316
*
192
317
*     Quick return if possible
193
318
*
194
319
      IF( N.EQ.0 )
263
388
*     components of Z are zero in this new basis.
264
389
*
265
390
      K = 0
266
 
      GIVPTR = 0
267
391
      K2 = N + 1
268
392
      DO 70 J = 1, N
269
393
         IF( RHO*ABS( Z( J ) ).LE.TOL ) THEN
398
522
*     End of SLAED8
399
523
*
400
524
      END
401
 
c $Id: slaed8.f 21176 2011-10-10 06:35:49Z d3y133 $