145 SUBROUTINE slaror( SIDE, INIT, M, N, A, LDA, ISEED, X, INFO )
153 INTEGER INFO, LDA, M, N
157 REAL A( LDA, * ), X( * )
163 REAL ZERO, ONE, TOOSML
164 parameter( zero = 0.0e+0, one = 1.0e+0,
168 INTEGER IROW, ITYPE, IXFRM, J, JCOL, KBEG, NXFRM
169 REAL FACTOR, XNORM, XNORMS
174 EXTERNAL lsame, slarnd, snrm2
185 IF( n.EQ.0 .OR. m.EQ.0 )
189 IF( lsame( side,
'L' ) )
THEN
191 ELSE IF( lsame( side,
'R' ) )
THEN
193 ELSE IF( lsame( side,
'C' ) .OR. lsame( side,
'T' ) )
THEN
199 IF( itype.EQ.0 )
THEN
201 ELSE IF( m.LT.0 )
THEN
203 ELSE IF( n.LT.0 .OR. ( itype.EQ.3 .AND. n.NE.m ) )
THEN
205 ELSE IF( lda.LT.m )
THEN
209 CALL xerbla(
'SLAROR', -info )
213 IF( itype.EQ.1 )
THEN
221 IF( lsame( init,
'I' ) )
222 $
CALL slaset(
'Full', m, n, zero, one, a, lda )
233 DO 30 ixfrm = 2, nxfrm
234 kbeg = nxfrm - ixfrm + 1
238 DO 20 j = kbeg, nxfrm
239 x( j ) = slarnd( 3, iseed )
244 xnorm = snrm2( ixfrm, x( kbeg ), 1 )
245 xnorms = sign( xnorm, x( kbeg ) )
246 x( kbeg+nxfrm ) = sign( one, -x( kbeg ) )
247 factor = xnorms*( xnorms+x( kbeg ) )
248 IF( abs( factor ).LT.toosml )
THEN
250 CALL xerbla(
'SLAROR', info )
253 factor = one / factor
255 x( kbeg ) = x( kbeg ) + xnorms
259 IF( itype.EQ.1 .OR. itype.EQ.3 )
THEN
263 CALL sgemv(
'T', ixfrm, n, one, a( kbeg, 1 ), lda,
264 $ x( kbeg ), 1, zero, x( 2*nxfrm+1 ), 1 )
265 CALL sger( ixfrm, n, -factor, x( kbeg ), 1, x( 2*nxfrm+1 ),
266 $ 1, a( kbeg, 1 ), lda )
270 IF( itype.EQ.2 .OR. itype.EQ.3 )
THEN
274 CALL sgemv(
'N', m, ixfrm, one, a( 1, kbeg ), lda,
275 $ x( kbeg ), 1, zero, x( 2*nxfrm+1 ), 1 )
276 CALL sger( m, ixfrm, -factor, x( 2*nxfrm+1 ), 1, x( kbeg ),
277 $ 1, a( 1, kbeg ), lda )
282 x( 2*nxfrm ) = sign( one, slarnd( 3, iseed ) )
286 IF( itype.EQ.1 .OR. itype.EQ.3 )
THEN
288 CALL sscal( n, x( nxfrm+irow ), a( irow, 1 ), lda )
292 IF( itype.EQ.2 .OR. itype.EQ.3 )
THEN
294 CALL sscal( m, x( nxfrm+jcol ), a( 1, jcol ), 1 )
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.