184 IMPLICIT NONE
185
186
187
188
189
190
191 INTEGER NM, NN, NNB, NNS, NOUT
192 REAL THRESH
193
194
195 LOGICAL DOTYPE( * )
196 INTEGER IWORK( * ), NBVAL( * ), MVAL( * ), NVAL( * ),
197 $ NSVAL( * ), NXVAL( * )
198 REAL S( * ), RWORK( * )
199 COMPLEX 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 REAL ONE, ZERO, BIGNUM
211 COMPLEX CONE, CZERO
212 parameter( one = 1.0e+0, zero = 0.0e+0,
213 $ czero = ( 0.0e+0, 0.0e+0 ),
214 $ cone = ( 1.0e+0, 0.0e+0 ),
215 $ bignum = 1.0e+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 REAL ANORM, CNDNUM, EPS, ABSTOL, RELTOL,
229 $ DTEMP, MAXC2NRMK, RELMAXC2NRMK
230
231
232 INTEGER ISEED( 4 ), ISEEDY( 4 )
233 REAL RESULT( NTESTS ), RDUMMY( 1 )
234
235
236 REAL SLAMCH, CQPT01, CQRT11, CQRT12, CLANGE
238
239
243
244
245 INTRINSIC abs, max, min, mod, real
246
247
248 LOGICAL LERR, OK
249 CHARACTER*32 SRNAMT
250 INTEGER INFOT, IOUNIT, CUNMQR_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 ) = 'Complex 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 clatb4( path, 14, m, nrhs,
TYPE, KL, KU, ANORM,
300 $ MODE, CNDNUM, DIST )
301
302 srnamt = 'CLATMS'
303 CALL clatms( 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,
'CLATMS', 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 claset(
'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 clatb4( path, imat, m, n,
TYPE, KL, KU, ANORM,
368 $ MODE, CNDNUM, DIST )
369
370 srnamt = 'CLATMS'
371 CALL clatms( 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,
'CLATMS', info, 0,
' ', m, n,
379 $ -1, -1, -1, imat, nfail, nerrs,
380 $ nout )
381 cycle
382 END IF
383
384 CALL slaord(
'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 claset(
'Full', m, nb_zero, czero, czero,
485 $ copya, lda )
486
487
488
489
490
491 CALL clatb4( path, imat, m, nb_gen,
TYPE, KL, KU,
492 $ ANORM, MODE, CNDNUM, DIST )
493
494 srnamt = 'CLATMS'
495
496 ind_offset_gen = nb_zero * lda
497
498 CALL clatms( 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,
'CLATMS', 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 slaord(
'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 clacpy(
'All', m, n, copya, lda, a, lda )
606 CALL clacpy(
'All', m, nrhs, copyb, lda,
607 $ a( lda*n + 1 ), lda )
608 CALL clacpy(
'All', m, nrhs, copyb, lda,
609 $ b, lda )
610 CALL icopy( n, iwork( 1 ), 1, iwork( n+1 ), 1 )
611
612 abstol = -1.0
613 reltol = -1.0
614
615
616
617 lw = max( 1, max( 2*n + nb*( n+nrhs+1 ),
618 $ 3*n + nrhs - 1 ) )
619
620
621
622 srnamt = 'CGEQP3RK'
623 CALL cgeqp3rk( m, n, nrhs, kmax, abstol, reltol,
624 $ a, lda, kfact, maxc2nrmk,
625 $ relmaxc2nrmk, iwork( n+1 ), tau,
626 $ work, lw, rwork, iwork( 2*n+1 ),
627 $ info )
628
629
630
631 IF( info.LT.0 )
632 $
CALL alaerh( path,
'CGEQP3RK', info, 0,
' ',
633 $ m, n, nx, -1, nb, imat,
634 $ nfail, nerrs, nout )
635
636 IF( kfact.EQ.minmn ) THEN
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652 result( 1 ) =
cqrt12( m, n, a, lda, s, work,
653 $ lwork , rwork )
654
655 DO t = 1, 1
656 IF( result( t ).GE.thresh ) THEN
657 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
658 $
CALL alahd( nout, path )
659 WRITE( nout, fmt = 9999 ) 'CGEQP3RK', m, n,
660 $ nrhs, kmax, abstol, reltol, nb, nx,
661 $ imat, t, result( t )
662 nfail = nfail + 1
663 END IF
664 END DO
665 nrun = nrun + 1
666
667
668
669 END IF
670
671
672
673
674
675
676
677 result( 2 ) =
cqpt01( m, n, kfact, copya, a, lda, tau,
678 $ iwork( n+1 ), work, lwork )
679
680
681
682
683
684
685
686 result( 3 ) =
cqrt11( m, kfact, a, lda, tau, work,
687 $ lwork )
688
689
690
691
692 DO t = 2, 3
693 IF( result( t ).GE.thresh ) THEN
694 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
695 $
CALL alahd( nout, path )
696 WRITE( nout, fmt = 9999 ) 'CGEQP3RK', m, n,
697 $ nrhs, kmax, abstol, reltol,
698 $ nb, nx, imat, t, result( t )
699 nfail = nfail + 1
700 END IF
701 END DO
702 nrun = nrun + 2
703
704
705
706
707
708
709
710
711
712
713
714
715
716 IF( min(kfact, minmn).GE.2 ) THEN
717
718 DO j = 1, kfact-1, 1
719
720 dtemp = (( abs( a( (j-1)*m+j ) ) -
721 $ abs( a( (j)*m+j+1 ) ) ) /
722 $ abs( a(1) ) )
723
724 IF( dtemp.LT.zero ) THEN
725 result( 4 ) = bignum
726 END IF
727
728 END DO
729
730
731
732
733 DO t = 4, 4
734 IF( result( t ).GE.thresh ) THEN
735 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
736 $
CALL alahd( nout, path )
737 WRITE( nout, fmt = 9999 ) 'CGEQP3RK',
738 $ m, n, nrhs, kmax, abstol, reltol,
739 $ nb, nx, imat, t,
740 $ result( t )
741 nfail = nfail + 1
742 END IF
743 END DO
744 nrun = nrun + 1
745
746
747
748 END IF
749
750
751
752
753
754
755
756
757
758
759
760
761 IF( minmn.GT.0 ) THEN
762
763 lwork_mqr = max(1, nrhs)
764 CALL cunmqr(
'Left',
'Conjugate transpose',
765 $ m, nrhs, kfact, a, lda, tau, b, lda,
766 $ work, lwork_mqr, info )
767
768 DO i = 1, nrhs
769
770
771
772 CALL caxpy( m, -cone, a( ( n+i-1 )*lda+1 ), 1,
773 $ b( ( i-1 )*lda+1 ), 1 )
774 END DO
775
776 result( 5 ) =
777 $ abs(
778 $
clange(
'One-norm', m, nrhs, b, lda, rdummy ) /
779 $ ( real( m )*
slamch(
'Epsilon' ) )
780 $ )
781
782
783
784
785 DO t = 5, 5
786 IF( result( t ).GE.thresh ) THEN
787 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
788 $
CALL alahd( nout, path )
789 WRITE( nout, fmt = 9999 ) 'CGEQP3RK', m, n,
790 $ nrhs, kmax, abstol, reltol,
791 $ nb, nx, imat, t, result( t )
792 nfail = nfail + 1
793 END IF
794 END DO
795 nrun = nrun + 1
796
797
798
799 END IF
800
801
802
803 END DO
804
805
806
807 END DO
808
809
810
811 END DO
812
813
814
815 END DO
816
817
818
819 END DO
820
821
822
823 END DO
824
825
826
827 CALL alasum( path, nout, nfail, nrun, nerrs )
828
829 9999 FORMAT( 1x, a, ' M =', i5, ', N =', i5, ', NRHS =', i5,
830 $ ', KMAX =', i5, ', ABSTOL =', g12.5,
831 $ ', RELTOL =', g12.5, ', NB =', i4, ', NX =', i4,
832 $ ', type ', i2, ', test ', i2, ', ratio =', g12.5 )
833
834
835
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 cgeqp3rk(m, n, nrhs, kmax, abstol, reltol, a, lda, k, maxc2nrmk, relmaxc2nrmk, jpiv, tau, work, lwork, rwork, iwork, info)
CGEQP3RK computes a truncated Householder QR factorization with column pivoting of a complex m-by-n m...
subroutine clatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
CLATB4
subroutine clatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
CLATMS
real function cqpt01(m, n, k, a, af, lda, tau, jpvt, work, lwork)
CQPT01
real function cqrt11(m, k, a, lda, tau, work, lwork)
CQRT11
real function cqrt12(m, n, a, lda, s, work, lwork, rwork)
CQRT12
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
real function slamch(cmach)
SLAMCH
real function clange(norm, m, n, a, lda, work)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
subroutine cunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQR
subroutine icopy(n, sx, incx, sy, incy)
ICOPY
subroutine slaord(job, n, x, incx)
SLAORD