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

« back to all changes in this revision

Viewing changes to src/lapack/double/dlarf.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 DLARF applies an elementary reflector to a general rectangular matrix.
 
2
*
 
3
*  =========== DOCUMENTATION ===========
 
4
*
 
5
* Online html documentation available at 
 
6
*            http://www.netlib.org/lapack/explore-html/ 
 
7
*
 
8
*> \htmlonly
 
9
*> Download DLARF + dependencies 
 
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarf.f"> 
 
11
*> [TGZ]</a> 
 
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarf.f"> 
 
13
*> [ZIP]</a> 
 
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarf.f"> 
 
15
*> [TXT]</a>
 
16
*> \endhtmlonly 
 
17
*
 
18
*  Definition:
 
19
*  ===========
 
20
*
 
21
*       SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
 
22
 
23
*       .. Scalar Arguments ..
 
24
*       CHARACTER          SIDE
 
25
*       INTEGER            INCV, LDC, M, N
 
26
*       DOUBLE PRECISION   TAU
 
27
*       ..
 
28
*       .. Array Arguments ..
 
29
*       DOUBLE PRECISION   C( LDC, * ), V( * ), WORK( * )
 
30
*       ..
 
31
*  
 
32
*
 
33
*> \par Purpose:
 
34
*  =============
 
35
*>
 
36
*> \verbatim
 
37
*>
 
38
*> DLARF applies a real elementary reflector H to a real m by n matrix
 
39
*> C, from either the left or the right. H is represented in the form
 
40
*>
 
41
*>       H = I - tau * v * v**T
 
42
*>
 
43
*> where tau is a real scalar and v is a real vector.
 
44
*>
 
45
*> If tau = 0, then H is taken to be the unit matrix.
 
46
*> \endverbatim
 
47
*
 
48
*  Arguments:
 
49
*  ==========
 
50
*
 
51
*> \param[in] SIDE
 
52
*> \verbatim
 
53
*>          SIDE is CHARACTER*1
 
54
*>          = 'L': form  H * C
 
55
*>          = 'R': form  C * H
 
56
*> \endverbatim
 
57
*>
 
58
*> \param[in] M
 
59
*> \verbatim
 
60
*>          M is INTEGER
 
61
*>          The number of rows of the matrix C.
 
62
*> \endverbatim
 
63
*>
 
64
*> \param[in] N
 
65
*> \verbatim
 
66
*>          N is INTEGER
 
67
*>          The number of columns of the matrix C.
 
68
*> \endverbatim
 
69
*>
 
70
*> \param[in] V
 
71
*> \verbatim
 
72
*>          V is DOUBLE PRECISION array, dimension
 
73
*>                     (1 + (M-1)*abs(INCV)) if SIDE = 'L'
 
74
*>                  or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
 
75
*>          The vector v in the representation of H. V is not used if
 
76
*>          TAU = 0.
 
77
*> \endverbatim
 
78
*>
 
79
*> \param[in] INCV
 
80
*> \verbatim
 
81
*>          INCV is INTEGER
 
82
*>          The increment between elements of v. INCV <> 0.
 
83
*> \endverbatim
 
84
*>
 
85
*> \param[in] TAU
 
86
*> \verbatim
 
87
*>          TAU is DOUBLE PRECISION
 
88
*>          The value tau in the representation of H.
 
89
*> \endverbatim
 
90
*>
 
91
*> \param[in,out] C
 
92
*> \verbatim
 
93
*>          C is DOUBLE PRECISION array, dimension (LDC,N)
 
94
*>          On entry, the m by n matrix C.
 
95
*>          On exit, C is overwritten by the matrix H * C if SIDE = 'L',
 
96
*>          or C * H if SIDE = 'R'.
 
97
*> \endverbatim
 
98
*>
 
99
*> \param[in] LDC
 
100
*> \verbatim
 
101
*>          LDC is INTEGER
 
102
*>          The leading dimension of the array C. LDC >= max(1,M).
 
103
*> \endverbatim
 
104
*>
 
105
*> \param[out] WORK
 
106
*> \verbatim
 
107
*>          WORK is DOUBLE PRECISION array, dimension
 
108
*>                         (N) if SIDE = 'L'
 
109
*>                      or (M) if SIDE = 'R'
 
110
*> \endverbatim
 
111
*
 
112
*  Authors:
 
113
*  ========
 
114
*
 
115
*> \author Univ. of Tennessee 
 
116
*> \author Univ. of California Berkeley 
 
117
*> \author Univ. of Colorado Denver 
 
118
*> \author NAG Ltd. 
 
119
*
 
120
*> \date September 2012
 
121
*
 
122
*> \ingroup doubleOTHERauxiliary
 
123
*
 
124
*  =====================================================================
1
125
      SUBROUTINE DLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
2
126
*
3
 
*  -- LAPACK auxiliary routine (version 2.0) --
4
 
*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5
 
*     Courant Institute, Argonne National Lab, and Rice University
6
 
*     February 29, 1992
 
127
*  -- LAPACK auxiliary routine (version 3.4.2) --
 
128
*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
 
129
*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
 
130
*     September 2012
7
131
*
8
132
*     .. Scalar Arguments ..
9
133
      CHARACTER          SIDE
14
138
      DOUBLE PRECISION   C( LDC, * ), V( * ), WORK( * )
15
139
*     ..
16
140
*
17
 
c
18
 
* $Id: dlarf.f 19697 2010-10-29 16:57:34Z d3y133 $
19
 
c
20
 
*  Purpose
21
 
*  =======
22
 
*
23
 
*  DLARF applies a real elementary reflector H to a real m by n matrix
24
 
*  C, from either the left or the right. H is represented in the form
25
 
*
26
 
*        H = I - tau * v * v'
27
 
*
28
 
*  where tau is a real scalar and v is a real vector.
29
 
*
30
 
*  If tau = 0, then H is taken to be the unit matrix.
31
 
*
32
 
*  Arguments
33
 
*  =========
34
 
*
35
 
*  SIDE    (input) CHARACTER*1
36
 
*          = 'L': form  H * C
37
 
*          = 'R': form  C * H
38
 
*
39
 
*  M       (input) INTEGER
40
 
*          The number of rows of the matrix C.
41
 
*
42
 
*  N       (input) INTEGER
43
 
*          The number of columns of the matrix C.
44
 
*
45
 
*  V       (input) DOUBLE PRECISION array, dimension
46
 
*                     (1 + (M-1)*abs(INCV)) if SIDE = 'L'
47
 
*                  or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
48
 
*          The vector v in the representation of H. V is not used if
49
 
*          TAU = 0.
50
 
*
51
 
*  INCV    (input) INTEGER
52
 
*          The increment between elements of v. INCV <> 0.
53
 
*
54
 
*  TAU     (input) DOUBLE PRECISION
55
 
*          The value tau in the representation of H.
56
 
*
57
 
*  C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
58
 
*          On entry, the m by n matrix C.
59
 
*          On exit, C is overwritten by the matrix H * C if SIDE = 'L',
60
 
*          or C * H if SIDE = 'R'.
61
 
*
62
 
*  LDC     (input) INTEGER
63
 
*          The leading dimension of the array C. LDC >= max(1,M).
64
 
*
65
 
*  WORK    (workspace) DOUBLE PRECISION array, dimension
66
 
*                         (N) if SIDE = 'L'
67
 
*                      or (M) if SIDE = 'R'
68
 
*
69
141
*  =====================================================================
70
142
*
71
143
*     .. Parameters ..
72
144
      DOUBLE PRECISION   ONE, ZERO
73
145
      PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
74
146
*     ..
 
147
*     .. Local Scalars ..
 
148
      LOGICAL            APPLYLEFT
 
149
      INTEGER            I, LASTV, LASTC
 
150
*     ..
75
151
*     .. External Subroutines ..
76
152
      EXTERNAL           DGEMV, DGER
77
153
*     ..
78
154
*     .. External Functions ..
79
155
      LOGICAL            LSAME
80
 
      EXTERNAL           LSAME
 
156
      INTEGER            ILADLR, ILADLC
 
157
      EXTERNAL           LSAME, ILADLR, ILADLC
81
158
*     ..
82
159
*     .. Executable Statements ..
83
160
*
84
 
      IF( LSAME( SIDE, 'L' ) ) THEN
 
161
      APPLYLEFT = LSAME( SIDE, 'L' )
 
162
      LASTV = 0
 
163
      LASTC = 0
 
164
      IF( TAU.NE.ZERO ) THEN
 
165
!     Set up variables for scanning V.  LASTV begins pointing to the end
 
166
!     of V.
 
167
         IF( APPLYLEFT ) THEN
 
168
            LASTV = M
 
169
         ELSE
 
170
            LASTV = N
 
171
         END IF
 
172
         IF( INCV.GT.0 ) THEN
 
173
            I = 1 + (LASTV-1) * INCV
 
174
         ELSE
 
175
            I = 1
 
176
         END IF
 
177
!     Look for the last non-zero row in V.
 
178
         DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO )
 
179
            LASTV = LASTV - 1
 
180
            I = I - INCV
 
181
         END DO
 
182
         IF( APPLYLEFT ) THEN
 
183
!     Scan for the last non-zero column in C(1:lastv,:).
 
184
            LASTC = ILADLC(LASTV, N, C, LDC)
 
185
         ELSE
 
186
!     Scan for the last non-zero row in C(:,1:lastv).
 
187
            LASTC = ILADLR(M, LASTV, C, LDC)
 
188
         END IF
 
189
      END IF
 
190
!     Note that lastc.eq.0 renders the BLAS operations null; no special
 
191
!     case is needed at this level.
 
192
      IF( APPLYLEFT ) THEN
85
193
*
86
194
*        Form  H * C
87
195
*
88
 
         IF( TAU.NE.ZERO ) THEN
89
 
*
90
 
*           w := C' * v
91
 
*
92
 
            CALL DGEMV( 'Transpose', M, N, ONE, C, LDC, V, INCV, ZERO,
93
 
     $                  WORK, 1 )
94
 
*
95
 
*           C := C - v * w'
96
 
*
97
 
            CALL DGER( M, N, -TAU, V, INCV, WORK, 1, C, LDC )
 
196
         IF( LASTV.GT.0 ) THEN
 
197
*
 
198
*           w(1:lastc,1) := C(1:lastv,1:lastc)**T * v(1:lastv,1)
 
199
*
 
200
            CALL DGEMV( 'Transpose', LASTV, LASTC, ONE, C, LDC, V, INCV,
 
201
     $           ZERO, WORK, 1 )
 
202
*
 
203
*           C(1:lastv,1:lastc) := C(...) - v(1:lastv,1) * w(1:lastc,1)**T
 
204
*
 
205
            CALL DGER( LASTV, LASTC, -TAU, V, INCV, WORK, 1, C, LDC )
98
206
         END IF
99
207
      ELSE
100
208
*
101
209
*        Form  C * H
102
210
*
103
 
         IF( TAU.NE.ZERO ) THEN
104
 
*
105
 
*           w := C * v
106
 
*
107
 
            CALL DGEMV( 'No transpose', M, N, ONE, C, LDC, V, INCV,
108
 
     $                  ZERO, WORK, 1 )
109
 
*
110
 
*           C := C - w * v'
111
 
*
112
 
            CALL DGER( M, N, -TAU, WORK, 1, V, INCV, C, LDC )
 
211
         IF( LASTV.GT.0 ) THEN
 
212
*
 
213
*           w(1:lastc,1) := C(1:lastc,1:lastv) * v(1:lastv,1)
 
214
*
 
215
            CALL DGEMV( 'No transpose', LASTC, LASTV, ONE, C, LDC,
 
216
     $           V, INCV, ZERO, WORK, 1 )
 
217
*
 
218
*           C(1:lastc,1:lastv) := C(...) - w(1:lastc,1) * v(1:lastv,1)**T
 
219
*
 
220
            CALL DGER( LASTC, LASTV, -TAU, WORK, 1, V, INCV, C, LDC )
113
221
         END IF
114
222
      END IF
115
223
      RETURN