159 SUBROUTINE dorm22( SIDE, TRANS, M, N, N1, N2, Q, LDQ, C, LDC,
160 $ WORK, LWORK, INFO )
169 CHARACTER SIDE, TRANS
170 INTEGER M, N, N1, N2, LDQ, LDC, LWORK, INFO
173 DOUBLE PRECISION Q( LDQ, * ), C( LDC, * ), WORK( * )
180 parameter( one = 1.0d+0 )
183 LOGICAL LEFT, LQUERY, NOTRAN
184 INTEGER I, LDWORK, LEN, LWKOPT, NB, NQ, NW
194 INTRINSIC dble, max, min
201 left = lsame( side,
'L' )
202 notran = lsame( trans,
'N' )
203 lquery = ( lwork.EQ.-1 )
214 IF( n1.EQ.0 .OR. n2.EQ.0 ) nw = 1
215 IF( .NOT.left .AND. .NOT.lsame( side,
'R' ) )
THEN
217 ELSE IF( .NOT.lsame( trans,
'N' ) .AND.
218 $ .NOT.lsame( trans,
'T' ) )
221 ELSE IF( m.LT.0 )
THEN
223 ELSE IF( n.LT.0 )
THEN
225 ELSE IF( n1.LT.0 .OR. n1+n2.NE.nq )
THEN
227 ELSE IF( n2.LT.0 )
THEN
229 ELSE IF( ldq.LT.max( 1, nq ) )
THEN
231 ELSE IF( ldc.LT.max( 1, m ) )
THEN
233 ELSE IF( lwork.LT.nw .AND. .NOT.lquery )
THEN
239 work( 1 ) = dble( lwkopt )
243 CALL xerbla(
'DORM22', -info )
245 ELSE IF( lquery )
THEN
251 IF( m.EQ.0 .OR. n.EQ.0 )
THEN
259 CALL dtrmm( side,
'Upper', trans,
'Non-Unit', m, n, one,
263 ELSE IF( n2.EQ.0 )
THEN
264 CALL dtrmm( side,
'Lower', trans,
'Non-Unit', m, n, one,
272 nb = max( 1, min( lwork, lwkopt ) / nq )
277 len = min( nb, n-i+1 )
282 CALL dlacpy(
'All', n1, len, c( n2+1, i ), ldc, work,
284 CALL dtrmm(
'Left',
'Lower',
'No Transpose',
286 $ n1, len, one, q( 1, n2+1 ), ldq, work,
291 CALL dgemm(
'No Transpose',
'No Transpose', n1, len,
293 $ one, q, ldq, c( 1, i ), ldc, one, work,
298 CALL dlacpy(
'All', n2, len, c( 1, i ), ldc,
299 $ work( n1+1 ), ldwork )
300 CALL dtrmm(
'Left',
'Upper',
'No Transpose',
302 $ n2, len, one, q( n1+1, 1 ), ldq,
303 $ work( n1+1 ), ldwork )
307 CALL dgemm(
'No Transpose',
'No Transpose', n2, len,
309 $ one, q( n1+1, n2+1 ), ldq, c( n2+1, i ), ldc,
310 $ one, work( n1+1 ), ldwork )
314 CALL dlacpy(
'All', m, len, work, ldwork, c( 1, i ),
319 len = min( nb, n-i+1 )
324 CALL dlacpy(
'All', n2, len, c( n1+1, i ), ldc, work,
326 CALL dtrmm(
'Left',
'Upper',
'Transpose',
'Non-Unit',
327 $ n2, len, one, q( n1+1, 1 ), ldq, work,
332 CALL dgemm(
'Transpose',
'No Transpose', n2, len, n1,
333 $ one, q, ldq, c( 1, i ), ldc, one, work,
338 CALL dlacpy(
'All', n1, len, c( 1, i ), ldc,
339 $ work( n2+1 ), ldwork )
340 CALL dtrmm(
'Left',
'Lower',
'Transpose',
'Non-Unit',
341 $ n1, len, one, q( 1, n2+1 ), ldq,
342 $ work( n2+1 ), ldwork )
346 CALL dgemm(
'Transpose',
'No Transpose', n1, len, n2,
347 $ one, q( n1+1, n2+1 ), ldq, c( n1+1, i ), ldc,
348 $ one, work( n2+1 ), ldwork )
352 CALL dlacpy(
'All', m, len, work, ldwork, c( 1, i ),
359 len = min( nb, m-i+1 )
364 CALL dlacpy(
'All', len, n2, c( i, n1+1 ), ldc, work,
366 CALL dtrmm(
'Right',
'Upper',
'No Transpose',
368 $ len, n2, one, q( n1+1, 1 ), ldq, work,
373 CALL dgemm(
'No Transpose',
'No Transpose', len, n2,
375 $ one, c( i, 1 ), ldc, q, ldq, one, work,
380 CALL dlacpy(
'All', len, n1, c( i, 1 ), ldc,
381 $ work( 1 + n2*ldwork ), ldwork )
382 CALL dtrmm(
'Right',
'Lower',
'No Transpose',
384 $ len, n1, one, q( 1, n2+1 ), ldq,
385 $ work( 1 + n2*ldwork ), ldwork )
389 CALL dgemm(
'No Transpose',
'No Transpose', len, n1,
391 $ one, c( i, n1+1 ), ldc, q( n1+1, n2+1 ), ldq,
392 $ one, work( 1 + n2*ldwork ), ldwork )
396 CALL dlacpy(
'All', len, n, work, ldwork, c( i, 1 ),
401 len = min( nb, m-i+1 )
406 CALL dlacpy(
'All', len, n1, c( i, n2+1 ), ldc, work,
408 CALL dtrmm(
'Right',
'Lower',
'Transpose',
'Non-Unit',
409 $ len, n1, one, q( 1, n2+1 ), ldq, work,
414 CALL dgemm(
'No Transpose',
'Transpose', len, n1, n2,
415 $ one, c( i, 1 ), ldc, q, ldq, one, work,
420 CALL dlacpy(
'All', len, n2, c( i, 1 ), ldc,
421 $ work( 1 + n1*ldwork ), ldwork )
422 CALL dtrmm(
'Right',
'Upper',
'Transpose',
'Non-Unit',
423 $ len, n2, one, q( n1+1, 1 ), ldq,
424 $ work( 1 + n1*ldwork ), ldwork )
428 CALL dgemm(
'No Transpose',
'Transpose', len, n2, n1,
429 $ one, c( i, n2+1 ), ldc, q( n1+1, n2+1 ), ldq,
430 $ one, work( 1 + n1*ldwork ), ldwork )
434 CALL dlacpy(
'All', len, n, work, ldwork, c( i, 1 ),
440 work( 1 ) = dble( lwkopt )