Skip to content

Commit 0d2bff7

Browse files
fix DLARF1F in case lastv = 1, #1011
1 parent b8a6443 commit 0d2bff7

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

SRC/dlarf1f.f

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@
3535
*>
3636
*> \verbatim
3737
*>
38-
*> DLARF1F applies a real elementary reflector H to a real m by n matrix
38+
*> DLARF applies a real elementary reflector H to a real m by n matrix
3939
*> C, from either the left or the right. H is represented in the form
4040
*>
4141
*> H = I - tau * v * v**T
4242
*>
4343
*> where tau is a real scalar and v is a real vector.
44-
*> It is assumed that v(1) = 1. v(1) is not referenced.
4544
*>
4645
*> If tau = 0, then H is taken to be the unit matrix.
4746
*> \endverbatim
@@ -118,26 +117,7 @@
118117
*> \author Univ. of Colorado Denver
119118
*> \author NAG Ltd.
120119
*
121-
*> \ingroup larf1f
122-
*
123-
*> \par Further Details:
124-
* =====================
125-
*>
126-
*> \verbatim
127-
*>
128-
*> The algorithm update matrix C by blocks.
129-
*> C is presected in the form of 4 blocks:
130-
*> C11 - 1-by-1, C12 - 1-by-n, C21 - m-by-1 and C22 - (m-1)-by-(n-1)
131-
*>
132-
*> C = ( C11 | C12 )
133-
*> (_____|___________________)
134-
*> ( | )
135-
*> ( | )
136-
*> ( C21 | C22 )
137-
*> ( | )
138-
*> ( | )
139-
*>
140-
*> \endverbatim
120+
*> \ingroup larf
141121
*
142122
* =====================================================================
143123
SUBROUTINE DLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
@@ -167,7 +147,7 @@ SUBROUTINE DLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
167147
DOUBLE PRECISION C11, DOT1, DDOT
168148
* ..
169149
* .. External Subroutines ..
170-
EXTERNAL DGEMV, DGER, DDOT, DAXPY, DCOPY
150+
EXTERNAL DGEMV, DGER, DDOT, DAXPY, DCOPY, DSCAL
171151
* ..
172152
* .. External Functions ..
173153
LOGICAL LSAME
@@ -206,15 +186,17 @@ SUBROUTINE DLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
206186
END IF
207187
END IF
208188

209-
IF( LASTC.EQ.0 ) THEN
189+
IF( LASTC.EQ.0 .OR. LASTV.EQ.0 ) THEN
210190
RETURN
211191
END IF
212192

213193
IF( APPLYLEFT ) THEN
214194
*
215195
* Form H * C
216196
*
217-
IF( LASTV.GT.0 ) THEN
197+
IF( LASTV.EQ.1 ) THEN
198+
CALL DSCAL(LASTC, ONE - TAU, C, LDC)
199+
ELSE
218200
DOT1 = - TAU * DDOT( LASTV - 1, V( 1 + INCV ), INCV,
219201
$ C( 2, 1 ), 1 )
220202

@@ -249,7 +231,9 @@ SUBROUTINE DLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
249231
*
250232
* Form C * H
251233
*
252-
IF( LASTV.GT.0 ) THEN
234+
IF( LASTV.EQ.1 ) THEN
235+
CALL DSCAL(LASTC, ONE - TAU, C, 1)
236+
ELSE
253237
DOT1 = - TAU * DDOT( LASTV - 1, V( 1 + INCV ), INCV,
254238
$ C( 1, 2 ), LDC )
255239

0 commit comments

Comments
 (0)