184 IMPLICIT NONE
185
186
187
188
189
190
191 INTEGER NM, NN, NNB, NNS, NOUT
192 DOUBLE PRECISION THRESH
193
194
195 LOGICAL DOTYPE( * )
196 INTEGER IWORK( * ), NBVAL( * ), MVAL( * ), NVAL( * ),
197 $ NSVAL( * ), NXVAL( * )
198 DOUBLE PRECISION S( * ), RWORK( * )
199 COMPLEX*16 A( * ), COPYA( * ), B( * ), COPYB( * ),
200 $ TAU( * ), WORK( * )
201
202
203
204
205
206 INTEGER NTYPES
207 parameter( ntypes = 19 )
208 INTEGER NTESTS
209 parameter( ntests = 5 )
210 DOUBLE PRECISION ONE, ZERO, BIGNUM
211 COMPLEX*16 CONE, CZERO
212 parameter( one = 1.0d+0, zero = 0.0d+0,
213 $ czero = ( 0.0d+0, 0.0d+0 ),
214 $ cone = ( 1.0d+0, 0.0d+0 ),
215 $ bignum = 1.0d+38 )
216
217
218 CHARACTER DIST, TYPE
219 CHARACTER*3 PATH
220 INTEGER I, IHIGH, ILOW, IM, IMAT, IN, INC_ZERO,
221 $ INB, IND_OFFSET_GEN,
222 $ IND_IN, IND_OUT, INS, INFO,
223 $ ISTEP, J, J_INC, J_FIRST_NZ, JB_ZERO,
224 $ KFACT, KL, KMAX, KU, LDA, LW, LWORK,
225 $ LWORK_MQR, M, MINMN, MINMNB_GEN, MODE, N,
226 $ NB, NB_ZERO, NERRS, NFAIL, NB_GEN, NRHS,
227 $ NRUN, NX, T
228 DOUBLE PRECISION ANORM, CNDNUM, EPS, ABSTOL, RELTOL,
229 $ DTEMP, MAXC2NRMK, RELMAXC2NRMK
230
231
232 INTEGER ISEED( 4 ), ISEEDY( 4 )
233 DOUBLE PRECISION RESULT( NTESTS ), RDUMMY( 1 )
234
235
236 DOUBLE PRECISION DLAMCH, ZQPT01, ZQRT11, ZQRT12, ZLANGE
238
239
243
244
245 INTRINSIC abs, dble, max, min, mod
246
247
248 LOGICAL LERR, OK
249 CHARACTER*32 SRNAMT
250 INTEGER INFOT, IOUNIT, ZUNMQR_LWORK
251
252
253 COMMON / infoc / infot, iounit, ok, lerr
254 COMMON / srnamc / srnamt
255
256
257 DATA iseedy / 1988, 1989, 1990, 1991 /
258
259
260
261
262
263 path( 1: 1 ) = 'Zomplex precision'
264 path( 2: 3 ) = 'QK'
265 nrun = 0
266 nfail = 0
267 nerrs = 0
268 DO i = 1, 4
269 iseed( i ) = iseedy( i )
270 END DO
272 infot = 0
273
274 DO im = 1, nm
275
276
277
278 m = mval( im )
279 lda = max( 1, m )
280
281 DO in = 1, nn
282
283
284
285 n = nval( in )
286 minmn = min( m, n )
287 lwork = max( 1, m*max( m, n )+4*minmn+max( m, n ),
288 $ m*n + 2*minmn + 4*n )
289
290 DO ins = 1, nns
291 nrhs = nsval( ins )
292
293
294
295
296
297
298
299 CALL zlatb4( path, 14, m, nrhs,
TYPE, KL, KU, ANORM,
300 $ MODE, CNDNUM, DIST )
301
302 srnamt = 'ZLATMS'
303 CALL zlatms( m, nrhs, dist, iseed,
TYPE, S, MODE,
304 $ CNDNUM, ANORM, KL, KU, 'No packing',
305 $ COPYB, LDA, WORK, INFO )
306
307
308
309 IF( info.NE.0 ) THEN
310 CALL alaerh( path,
'ZLATMS', info, 0,
' ', m,
311 $ nrhs, -1, -1, -1, 6, nfail, nerrs,
312 $ nout )
313 cycle
314 END IF
315
316 DO imat = 1, ntypes
317
318
319
320 IF( .NOT.dotype( imat ) )
321 $ cycle
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350 IF( imat.EQ.1 ) THEN
351
352
353
354 CALL zlaset(
'Full', m, n, czero, czero, copya, lda )
355 DO i = 1, minmn
356 s( i ) = zero
357 END DO
358
359 ELSE IF( (imat.GE.2 .AND. imat.LE.4 )
360 $ .OR. (imat.GE.14 .AND. imat.LE.19 ) ) THEN
361
362
363
364
365
366
367 CALL zlatb4( path, imat, m, n,
TYPE, KL, KU, ANORM,
368 $ MODE, CNDNUM, DIST )
369
370 srnamt = 'ZLATMS'
371 CALL zlatms( m, n, dist, iseed,
TYPE, S, MODE,
372 $ CNDNUM, ANORM, KL, KU, 'No packing',
373 $ COPYA, LDA, WORK, INFO )
374
375
376
377 IF( info.NE.0 ) THEN
378 CALL alaerh( path,
'ZLATMS', info, 0,
' ', m, n,
379 $ -1, -1, -1, imat, nfail, nerrs,
380 $ nout )
381 cycle
382 END IF
383
384 CALL dlaord(
'Decreasing', minmn, s, 1 )
385
386 ELSE IF( minmn.GE.2
387 $ .AND. imat.GE.5 .AND. imat.LE.13 ) THEN
388
389
390
391
392
393
394
395
396
397
398
399
400
401 IF( imat.EQ.5 ) THEN
402
403
404
405 jb_zero = 1
406 nb_zero = 1
407 nb_gen = n - nb_zero
408
409 ELSE IF( imat.EQ.6 ) THEN
410
411
412
413 jb_zero = minmn
414 nb_zero = 1
415 nb_gen = n - nb_zero
416
417 ELSE IF( imat.EQ.7 ) THEN
418
419
420
421 jb_zero = n
422 nb_zero = 1
423 nb_gen = n - nb_zero
424
425 ELSE IF( imat.EQ.8 ) THEN
426
427
428
429 jb_zero = minmn / 2 + 1
430 nb_zero = 1
431 nb_gen = n - nb_zero
432
433 ELSE IF( imat.EQ.9 ) THEN
434
435
436
437 jb_zero = 1
438 nb_zero = minmn / 2
439 nb_gen = n - nb_zero
440
441 ELSE IF( imat.EQ.10 ) THEN
442
443
444
445
446 jb_zero = minmn / 2 + 1
447 nb_zero = n - jb_zero + 1
448 nb_gen = n - nb_zero
449
450 ELSE IF( imat.EQ.11 ) THEN
451
452
453
454
455
456 jb_zero = minmn / 2 - (minmn / 2) / 2 + 1
457 nb_zero = minmn / 2
458 nb_gen = n - nb_zero
459
460 ELSE IF( imat.EQ.12 ) THEN
461
462
463
464 nb_gen = n / 2
465 nb_zero = n - nb_gen
466 j_inc = 2
467 j_first_nz = 2
468
469 ELSE IF( imat.EQ.13 ) THEN
470
471
472
473 nb_zero = n / 2
474 nb_gen = n - nb_zero
475 j_inc = 2
476 j_first_nz = 1
477
478 END IF
479
480
481
482
483
484 CALL zlaset(
'Full', m, nb_zero, czero, czero,
485 $ copya, lda )
486
487
488
489
490
491 CALL zlatb4( path, imat, m, nb_gen,
TYPE, KL, KU,
492 $ ANORM, MODE, CNDNUM, DIST )
493
494 srnamt = 'ZLATMS'
495
496 ind_offset_gen = nb_zero * lda
497
498 CALL zlatms( m, nb_gen, dist, iseed,
TYPE, S, MODE,
499 $ CNDNUM, ANORM, KL, KU, 'No packing',
500 $ COPYA( IND_OFFSET_GEN + 1 ), LDA,
501 $ WORK, INFO )
502
503
504
505 IF( info.NE.0 ) THEN
506 CALL alaerh( path,
'ZLATMS', info, 0,
' ', m,
507 $ nb_gen, -1, -1, -1, imat, nfail,
508 $ nerrs, nout )
509 cycle
510 END IF
511
512
513
514
515
516 IF( imat.EQ.6
517 $ .OR. imat.EQ.7
518 $ .OR. imat.EQ.8
519 $ .OR. imat.EQ.10
520 $ .OR. imat.EQ.11 ) THEN
521
522
523
524
525
526
527 DO j = 1, jb_zero-1, 1
529 $ copya( ( nb_zero+j-1)*lda+1), 1,
530 $ copya( (j-1)*lda + 1 ), 1 )
531 END DO
532
533 ELSE IF( imat.EQ.12 .OR. imat.EQ.13 ) THEN
534
535
536
537
538
539
540
541
542
543
544
545 DO j = 1, nb_gen, 1
546 ind_out = ( nb_zero+j-1 )*lda + 1
547 ind_in = ( j_inc*(j-1)+(j_first_nz-1) )*lda
548 $ + 1
550 $ copya( ind_out ), 1,
551 $ copya( ind_in), 1 )
552 END DO
553
554 END IF
555
556
557
558
559
560
561 minmnb_gen = min( m, nb_gen )
562
563 CALL dlaord(
'Decreasing', minmnb_gen, s, 1 )
564
565 DO i = minmnb_gen+1, minmn
566 s( i ) = zero
567 END DO
568
569 ELSE
570
571
572
573 cycle
574 END IF
575
576
577
578 DO i = 1, n
579 iwork( i ) = 0
580 END DO
581
582 DO inb = 1, nnb
583
584
585
586 nb = nbval( inb )
588 nx = nxval( inb )
590
591
592
593
594
595 DO kmax = 0, min(m,n)+1
596
597
598
599
600
601
602
603
604
605 CALL zlacpy(
'All', m, n, copya, lda, a, lda )
606 CALL zlacpy(
'All', m, nrhs, copyb, lda,
607 $ a( lda*n + 1 ), lda )
608 CALL zlacpy(
'All', m, nrhs, copyb, lda,
609 $ b, lda )
610 CALL icopy( n, iwork( 1 ), 1, iwork( n+1 ), 1 )
611 DO i = 1, ntests
612 result( i ) = zero
613 END DO
614
615 abstol = -1.0
616 reltol = -1.0
617
618
619
620 lw = max( 1, max( 2*n + nb*( n+nrhs+1 ),
621 $ 3*n + nrhs - 1 ) )
622
623
624
625 srnamt = 'ZGEQP3RK'
626 CALL zgeqp3rk( m, n, nrhs, kmax, abstol, reltol,
627 $ a, lda, kfact, maxc2nrmk,
628 $ relmaxc2nrmk, iwork( n+1 ), tau,
629 $ work, lw, rwork, iwork( 2*n+1 ),
630 $ info )
631
632
633
634 IF( info.LT.0 )
635 $
CALL alaerh( path,
'ZGEQP3RK', info, 0,
' ',
636 $ m, n, nx, -1, nb, imat,
637 $ nfail, nerrs, nout )
638
639 IF( kfact.EQ.minmn ) THEN
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655 result( 1 ) =
zqrt12( m, n, a, lda, s, work,
656 $ lwork , rwork )
657
658 nrun = nrun + 1
659
660
661
662 END IF
663
664
665
666
667
668
669
670 result( 2 ) =
zqpt01( m, n, kfact, copya, a, lda, tau,
671 $ iwork( n+1 ), work, lwork )
672
673
674
675
676
677
678
679 result( 3 ) =
zqrt11( m, kfact, a, lda, tau, work,
680 $ lwork )
681
682 nrun = nrun + 2
683
684
685
686
687
688
689
690
691
692
693
694
695
696 IF( min(kfact, minmn).GE.2 ) THEN
697
698 DO j = 1, kfact-1, 1
699
700 dtemp = (( abs( a( (j-1)*lda+j ) ) -
701 $ abs( a( (j)*lda+j+1 ) ) ) /
702 $ abs( a(1) ) )
703
704 IF( dtemp.LT.zero ) THEN
705 result( 4 ) = bignum
706 END IF
707
708 END DO
709
710 nrun = nrun + 1
711
712
713
714 END IF
715
716
717
718
719
720
721
722
723
724
725
726
727 IF( minmn.GT.0 ) THEN
728
729 lwork_mqr = max(1, nrhs)
730 CALL zunmqr(
'Left',
'Conjugate transpose',
731 $ m, nrhs, kfact, a, lda, tau, b, lda,
732 $ work, lwork_mqr, info )
733
734 DO i = 1, nrhs
735
736
737
738 CALL zaxpy( m, -cone, a( ( n+i-1 )*lda+1 ), 1,
739 $ b( ( i-1 )*lda+1 ), 1 )
740 END DO
741
742 result( 5 ) = abs(
743 $
zlange(
'One-norm', m, nrhs, b, lda, rdummy ) /
744 $ ( dble( m )*
dlamch(
'Epsilon' ) ) )
745
746 nrun = nrun + 1
747
748
749
750 END IF
751
752
753
754
755 DO t = 1, ntests
756 IF( result( t ).GE.thresh ) THEN
757 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
758 $
CALL alahd( nout, path )
759 WRITE( nout, fmt = 9999 ) 'ZGEQP3RK', m, n,
760 $ nrhs, kmax, abstol, reltol,
761 $ nb, nx, imat, t, result( t )
762 nfail = nfail + 1
763 END IF
764 END DO
765
766
767
768 END DO
769
770
771
772 END DO
773
774
775
776 END DO
777
778
779
780 END DO
781
782
783
784 END DO
785
786
787
788 END DO
789
790
791
792 CALL alasum( path, nout, nfail, nrun, nerrs )
793
794 9999 FORMAT( 1x, a, ' M =', i5, ', N =', i5, ', NRHS =', i5,
795 $ ', KMAX =', i5, ', ABSTOL =', g12.5,
796 $ ', RELTOL =', g12.5, ', NB =', i4, ', NX =', i4,
797 $ ', type ', i2, ', test ', i2, ', ratio =', g12.5 )
798
799
800
subroutine alasum(type, nout, nfail, nrun, nerrs)
ALASUM
subroutine xlaenv(ispec, nvalue)
XLAENV
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
subroutine alahd(iounit, path)
ALAHD
subroutine dlaord(job, n, x, incx)
DLAORD
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
double precision function dlamch(cmach)
DLAMCH
double precision function zlange(norm, m, n, a, lda, work)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
subroutine zunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMQR
subroutine icopy(n, sx, incx, sy, incy)
ICOPY
subroutine zgeqp3rk(m, n, nrhs, kmax, abstol, reltol, a, lda, k, maxc2nrmk, relmaxc2nrmk, jpiv, tau, work, lwork, rwork, iwork, info)
ZGEQP3RK computes a truncated Householder QR factorization with column pivoting of a complex m-by-n m...
subroutine zlatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
ZLATB4
subroutine zlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
ZLATMS
double precision function zqpt01(m, n, k, a, af, lda, tau, jpvt, work, lwork)
ZQPT01
double precision function zqrt11(m, k, a, lda, tau, work, lwork)
ZQRT11
double precision function zqrt12(m, n, a, lda, s, work, lwork, rwork)
ZQRT12