1!--------------------------------------------------------------------------------------------------! 2! DFTB+: general package for performing fast atomistic simulations ! 3! Copyright (C) 2006 - 2019 DFTB+ developers group ! 4! ! 5! See the LICENSE file for terms of usage and distribution. ! 6!--------------------------------------------------------------------------------------------------! 7 8!> Interface wrapper for the lapack routines. See the <a href="http://www.netlib.org/lapack/">lapack 9!> project documentation</a> for more details 10module dftbp_lapack 11 use dftbp_accuracy, only : rsp, rdp 12 implicit none 13 public 14 15 16 !> Real symmetric eigensolver 17 interface ssyev 18 19 !> Real symmetric eigensolver 20 subroutine ssyev(jobz, uplo, nn, aa, lda, ww, work, lwork, info) 21 import rsp 22 23 !> job type 24 character, intent(in) :: jobz 25 26 !> Upper 'U' or lower 'L' triangle 27 character, intent(in) :: uplo 28 29 !> matrix dimension 30 integer, intent(in) :: nn 31 32 !> Leading dimension of A 33 integer, intent(in) :: lda 34 35 !> matrix A 36 real(rsp), intent(inout) :: aa(lda, *) 37 38 !> Eigenvalues 39 real(rsp), intent(out) :: ww(*) 40 41 !> workspace 42 real(rsp), intent(inout) :: work(*) 43 44 !> workspace sizing 45 integer, intent(in) :: lwork 46 47 !> state of routine on return 48 integer, intent(out) :: info 49 end subroutine ssyev 50 end interface ssyev 51 52 53 !> Double precision symmetric eigensolver 54 interface dsyev 55 56 !> Double precision symmetric eigensolver 57 subroutine dsyev(jobz, uplo, nn, aa, lda, ww, work, lwork, info) 58 import rdp 59 60 !> job type 61 character, intent(in) :: jobz 62 63 !> Upper 'U' or lower 'L' triangle 64 character, intent(in) :: uplo 65 66 !> matrix dimension 67 integer, intent(in) :: nn 68 69 !> Leading dimension of A 70 integer, intent(in) :: lda 71 72 !> matrix A 73 real(rdp), intent(inout) :: aa(lda, *) 74 75 !> eigenvalues 76 real(rdp), intent(out) :: ww(*) 77 78 !> workspace 79 real(rdp), intent(inout) :: work(*) 80 81 !> workspace sizing 82 integer, intent(in) :: lwork 83 84 !> state of routine on return 85 integer, intent(out) :: info 86 end subroutine dsyev 87 end interface dsyev 88 89 90 !> Complex hermitian eigensolver 91 interface cheev 92 93 !> Complex hermitian eigensolver 94 subroutine cheev(jobz, uplo, nn, aa, lda, ww, work, lwork, rwork, info) 95 import rsp 96 97 !> job type 98 character, intent(in) :: jobz 99 100 !> Upper 'U' or lower 'L' triangle 101 character, intent(in) :: uplo 102 103 !> matrix dimension 104 integer, intent(in) :: nn 105 106 !> Leading dimension of A 107 integer, intent(in) :: lda 108 109 !> matrix A 110 complex(rsp), intent(inout) :: aa(lda, *) 111 112 !> Eigenvalues 113 real(rsp), intent(out) :: ww(*) 114 115 !> workspace 116 complex(rsp), intent(inout) :: work(*) 117 118 !> workspace sizing 119 integer, intent(in) :: lwork 120 121 !> real workspace 122 real(rsp), intent(inout) :: rwork(*) 123 124 !> state of routine on return 125 integer, intent(out) :: info 126 end subroutine cheev 127 end interface cheev 128 129 130 !> Double complex hermitian eigensolver 131 interface zheev 132 133 !> Double complex hermitian eigensolver 134 subroutine zheev(jobz, uplo, nn, aa, lda, ww, work, lwork, rwork, info) 135 import rdp 136 137 !> job type 138 character, intent(in) :: jobz 139 140 !> Upper 'U' or lower 'L' triangle 141 character, intent(in) :: uplo 142 143 !> matrix dimension 144 integer, intent(in) :: nn 145 146 !> Leading dimension of A 147 integer, intent(in) :: lda 148 149 !> matrix A 150 complex(rdp), intent(inout) :: aa(lda, *) 151 152 !> eigenvalues 153 real(rdp), intent(out) :: ww(*) 154 155 !> workspace 156 complex(rdp), intent(inout) :: work(*) 157 158 !> workspace sizing 159 integer, intent(in) :: lwork 160 161 !> real workspace 162 real(rdp), intent(inout) :: rwork(*) 163 164 !> state of routine on return 165 integer, intent(out) :: info 166 end subroutine zheev 167 end interface zheev 168 169 170 !> Real symmetric generalised eigensolver 171 interface ssygv 172 173 !> Real symmetric generalised eigensolver 174 subroutine ssygv(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work, lwork,& 175 & info) 176 import rsp 177 178 !> Specifies the problem type to be solved 179 integer, intent(in) :: itype 180 181 !> job type 182 character, intent(in) :: jobz 183 184 !> Upper 'U' or lower 'L' triangle 185 character, intent(in) :: uplo 186 187 !> matrix dimension 188 integer, intent(in) :: nn 189 190 !> Leading dimension of A 191 integer, intent(in) :: lda 192 193 !> matrix A 194 real(rsp), intent(inout) :: aa(lda, *) 195 196 !> leading dimension of B 197 integer, intent(in) :: ldb 198 199 !> matrix B 200 real(rsp), intent(inout) :: bb(ldb, *) 201 202 !> Eigenvalues 203 real(rsp), intent(out) :: ww(*) 204 205 !> workspace 206 real(rsp), intent(inout) :: work(*) 207 208 !> workspace sizing 209 integer, intent(in) :: lwork 210 211 !> state of routine on return 212 integer, intent(out) :: info 213 end subroutine ssygv 214 end interface ssygv 215 216 217 !> Double precision generalised symmetric eigensolver 218 interface dsygv 219 220 !> Double precision generalised symmetric eigensolver 221 subroutine dsygv(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work, lwork,& 222 & info) 223 import rdp 224 225 !> Specifies the problem type to be solved 226 integer, intent(in) :: itype 227 228 !> job type 229 character, intent(in) :: jobz 230 231 !> Upper 'U' or lower 'L' triangle 232 character, intent(in) :: uplo 233 234 !> matrix dimension 235 integer, intent(in) :: nn 236 237 !> Leading dimension of A 238 integer, intent(in) :: lda 239 240 !> matrix A 241 real(rdp), intent(inout) :: aa(lda, *) 242 243 !> leading dimension of B 244 integer, intent(in) :: ldb 245 246 !> matrix B 247 real(rdp), intent(inout) :: bb(ldb, *) 248 249 !> eigenvalues 250 real(rdp), intent(out) :: ww(*) 251 252 !> workspace 253 real(rdp), intent(inout) :: work(*) 254 255 !> workspace sizing 256 integer, intent(in) :: lwork 257 258 !> state of routine on return 259 integer, intent(out) :: info 260 end subroutine dsygv 261 end interface dsygv 262 263 264 !> Complex generalised hermitian eigensolver 265 interface chegv 266 267 !> Complex generalised hermitian eigensolver 268 subroutine chegv(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work, lwork,& 269 & rwork, info) 270 import rsp 271 272 !> Specifies the problem type to be solved 273 integer, intent(in) :: itype 274 275 !> job type 276 character, intent(in) :: jobz 277 278 !> Upper 'U' or lower 'L' triangle 279 character, intent(in) :: uplo 280 281 !> matrix dimension 282 integer, intent(in) :: nn 283 284 !> Leading dimension of A 285 integer, intent(in) :: lda 286 287 !> matrix A 288 complex(rsp), intent(inout) :: aa(lda, *) 289 290 !> leading dimension of B 291 integer, intent(in) :: ldb 292 293 !> matrix B 294 complex(rsp), intent(inout) :: bb(ldb, *) 295 296 !> Eigenvalues 297 real(rsp), intent(out) :: ww(*) 298 299 !> workspace 300 complex(rsp), intent(inout) :: work(*) 301 302 !> workspace sizing 303 integer, intent(in) :: lwork 304 305 !> real workspace 306 real(rsp), intent(inout) :: rwork(*) 307 308 !> state of routine on return 309 integer, intent(out) :: info 310 end subroutine chegv 311 end interface chegv 312 313 314 !> Double complex generalised hermitian eigensolver 315 interface zhegv 316 317 !> Double complex generalised hermitian eigensolver 318 subroutine zhegv(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work, lwork,& 319 & rwork, info) 320 import rdp 321 322 !> Specifies the problem type to be solved 323 integer, intent(in) :: itype 324 325 !> job type 326 character, intent(in) :: jobz 327 328 !> Upper 'U' or lower 'L' triangle 329 character, intent(in) :: uplo 330 331 !> matrix dimension 332 integer, intent(in) :: nn 333 334 !> Leading dimension of A 335 integer, intent(in) :: lda 336 337 !> matrix A 338 complex(rdp), intent(inout) :: aa(lda, *) 339 340 !> leading dimension of B 341 integer, intent(in) :: ldb 342 343 !> matrix B 344 complex(rdp), intent(inout) :: bb(ldb, *) 345 346 !> eigenvalues 347 real(rdp), intent(out) :: ww(*) 348 349 !> workspace 350 complex(rdp), intent(inout) :: work(*) 351 352 !> workspace sizing 353 integer, intent(in) :: lwork 354 355 !> real workspace 356 real(rdp), intent(inout) :: rwork(*) 357 358 !> state of routine on return 359 integer, intent(out) :: info 360 end subroutine zhegv 361 end interface zhegv 362 363 364 !> Real symmetric generalised eigensolver, divide and conquer 365 interface ssygvd 366 367 !> Real symmetric generalised eigensolver, divide and conquer 368 subroutine ssygvd(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work,& 369 & lwork, iwork, liwork, info) 370 import rsp 371 372 !> Specifies the problem type to be solved 373 integer, intent(in) :: itype 374 375 !> job type 376 character, intent(in) :: jobz 377 378 !> Upper 'U' or lower 'L' triangle 379 character, intent(in) :: uplo 380 381 !> matrix dimension 382 integer, intent(in) :: nn 383 384 !> Leading dimension of A 385 integer, intent(in) :: lda 386 387 !> matrix A 388 real(rsp), intent(inout) :: aa(lda, *) 389 390 !> leading dimension of B 391 integer, intent(in) :: ldb 392 393 !> matrix B 394 real(rsp), intent(inout) :: bb(ldb, *) 395 396 !> Eigenvalues 397 real(rsp), intent(out) :: ww(*) 398 399 !> workspace 400 real(rsp), intent(inout) :: work(*) 401 402 !> workspace sizing 403 integer, intent(in) :: lwork 404 405 !> integer workspace 406 integer, intent(inout) :: iwork(*) 407 408 !> size of integer workspace 409 integer, intent(in) :: liwork 410 411 !> state of routine on return 412 integer, intent(out) :: info 413 end subroutine ssygvd 414 end interface ssygvd 415 416 417 !> Double precision generalised symmetric eigensolver, divide and conquer 418 interface dsygvd 419 420 !> Double precision generalised symmetric eigensolver, divide and conquer 421 subroutine dsygvd(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work,& 422 & lwork, iwork, liwork, info) 423 import rdp 424 425 !> Specifies the problem type to be solved 426 integer, intent(in) :: itype 427 428 !> job type 429 character, intent(in) :: jobz 430 431 !> Upper 'U' or lower 'L' triangle 432 character, intent(in) :: uplo 433 434 !> matrix dimension 435 integer, intent(in) :: nn 436 437 !> Leading dimension of A 438 integer, intent(in) :: lda 439 440 !> matrix A 441 real(rdp), intent(inout) :: aa(lda, *) 442 443 !> leading dimension of B 444 integer, intent(in) :: ldb 445 446 !> matrix B 447 real(rdp), intent(inout) :: bb(ldb, *) 448 449 !> eigenvalues 450 real(rdp), intent(out) :: ww(*) 451 452 !> workspace 453 real(rdp), intent(inout) :: work(*) 454 455 !> workspace sizing 456 integer, intent(in) :: lwork 457 458 !> integer workspace 459 integer, intent(inout) :: iwork(*) 460 461 !> size of integer workspace 462 integer, intent(in) :: liwork 463 464 !> state of routine on return 465 integer, intent(out) :: info 466 end subroutine dsygvd 467 end interface dsygvd 468 469 470 !> Complex generalised hermitian eigensolver, divide and conquer 471 interface chegvd 472 473 !> Complex generalised hermitian eigensolver, divide and conquer 474 subroutine chegvd(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work,& 475 & lwork, rwork, lrwork, iwork, liwork, info) 476 import rsp 477 478 !> Specifies the problem type to be solved 479 integer, intent(in) :: itype 480 481 !> job type 482 character, intent(in) :: jobz 483 484 !> Upper 'U' or lower 'L' triangle 485 character, intent(in) :: uplo 486 487 !> matrix dimension 488 integer, intent(in) :: nn 489 490 !> Leading dimension of A 491 integer, intent(in) :: lda 492 493 !> matrix A 494 complex(rsp), intent(inout) :: aa(lda, *) 495 496 !> leading dimension of B 497 integer, intent(in) :: ldb 498 499 !> matrix B 500 complex(rsp), intent(inout) :: bb(ldb, *) 501 502 !> Eigenvalues 503 real(rsp), intent(out) :: ww(*) 504 505 !> workspace 506 complex(rsp), intent(inout) :: work(*) 507 508 !> workspace sizing 509 integer, intent(in) :: lwork 510 511 !> real workspace 512 real(rsp), intent(inout) :: rwork(*) 513 514 !> size of rwork 515 integer, intent(in) :: lrwork 516 517 !> integer workspace 518 integer, intent(inout) :: iwork(*) 519 520 !> size of integer workspace 521 integer, intent(in) :: liwork 522 523 !> state of routine on return 524 integer, intent(out) :: info 525 end subroutine chegvd 526 end interface chegvd 527 528 529 !> Double complex generalised hermitian eigensolver, divide and conquer 530 interface zhegvd 531 532 !> Double complex generalised hermitian eigensolver, divide and conquer 533 subroutine zhegvd(itype, jobz, uplo, nn, aa, lda, bb, ldb, ww, work,& 534 & lwork, rwork, lrwork, iwork, liwork, info) 535 import rdp 536 537 !> Specifies the problem type to be solved 538 integer, intent(in) :: itype 539 540 !> job type 541 character, intent(in) :: jobz 542 543 !> Upper 'U' or lower 'L' triangle 544 character, intent(in) :: uplo 545 546 !> matrix dimension 547 integer, intent(in) :: nn 548 549 !> Leading dimension of A 550 integer, intent(in) :: lda 551 552 !> matrix A 553 complex(rdp), intent(inout) :: aa(lda, *) 554 555 !> leading dimension of B 556 integer, intent(in) :: ldb 557 558 !> matrix B 559 complex(rdp), intent(inout) :: bb(ldb, *) 560 561 !> eigenvalues 562 real(rdp), intent(out) :: ww(*) 563 564 !> workspace 565 complex(rdp), intent(inout) :: work(*) 566 567 !> workspace sizing 568 integer, intent(in) :: lwork 569 570 !> real workspace 571 real(rdp), intent(inout) :: rwork(*) 572 573 !> workspace size for rwork 574 integer, intent(in) :: lrwork 575 576 !> integer workspace 577 integer, intent(inout) :: iwork(*) 578 579 !> size of integer workspace 580 integer, intent(in) :: liwork 581 582 !> state of routine on return 583 integer, intent(out) :: info 584 end subroutine zhegvd 585 end interface zhegvd 586 587 588 !> Real symmetric generalised eigensolver, relatively robust 589 interface ssyevr 590 591 !> Real symmetric generalised eigensolver, relatively robust 592 subroutine ssyevr(jobz, range, uplo, nn, aa, lda, vl, vu, il, iu, abstol,& 593 & mm, ww, zz, ldz, isuppz, work, lwork, iwork, liwork, info) 594 import rsp 595 596 !> job type 597 character, intent(in) :: jobz 598 599 !> choice for range of eigenstates, 'A'll, 'V' half range (VL,VU], 'I' IL-th through IU-th 600 !> eigenvalues 601 character, intent(in) :: range 602 603 !> Upper 'U' or lower 'L' triangle 604 character, intent(in) :: uplo 605 606 !> matrix dimension 607 integer, intent(in) :: nn 608 609 !> Leading dimension of A 610 integer, intent(in) :: lda 611 612 !> matrix A 613 real(rsp), intent(inout) :: aa(lda, *) 614 615 !> Lower range if in mode range = V 616 real(rsp), intent(in) :: vl 617 618 !> upper range 619 real(rsp), intent(in) :: vu 620 621 !> lower number if in mode range = I 622 integer, intent(in) :: il 623 624 !> upper number if in mode range = I 625 integer, intent(in) :: iu 626 627 !> absolute error tolerance for the eigenvalues 628 real(rsp), intent(in) :: abstol 629 630 !> total number of eigenvalues found 631 integer, intent(out) :: mm 632 633 !> Eigenvalues 634 real(rsp), intent(out) :: ww(*) 635 636 !> leading dimension of Z 637 integer, intent(in) :: ldz 638 639 !> matrix Z 640 real(rsp), intent(out) :: zz(ldz, *) 641 642 !> support of the eigenvectors in Z 643 integer, intent(out) :: isuppz(*) 644 645 !> workspace 646 real(rsp), intent(inout) :: work(*) 647 648 !> workspace sizing 649 integer, intent(in) :: lwork 650 651 !> integer workspace 652 integer, intent(inout) :: iwork(*) 653 654 !> size of integer workspace 655 integer, intent(in) :: liwork 656 657 !> state of routine on return 658 integer, intent(out) :: info 659 end subroutine ssyevr 660 end interface ssyevr 661 662 663 !> Double precision generalised symmetric eigensolver, relatively robust 664 interface dsyevr 665 666 !> Double precision generalised symmetric eigensolver, relatively robust 667 subroutine dsyevr(jobz, range, uplo, nn, aa, lda, vl, vu, il, iu, abstol,& 668 & mm, ww, zz, ldz, isuppz, work, lwork, iwork, liwork, info) 669 import rdp 670 671 !> job type 672 character, intent(in) :: jobz 673 674 !> choice for range of eigenstates, 'A'll, 'V' half range (VL,VU], 'I' IL-th through IU-th 675 !> eigenvalues 676 character, intent(in) :: range 677 678 !> Upper 'U' or lower 'L' triangle 679 character, intent(in) :: uplo 680 681 !> matrix dimension 682 integer, intent(in) :: nn 683 684 !> Leading dimension of A 685 integer, intent(in) :: lda 686 687 !> matrix A 688 real(rdp), intent(inout) :: aa(lda, *) 689 690 !> Lower range if in mode range = V 691 real(rdp), intent(in) :: vl 692 693 !> upper range 694 real(rdp), intent(in) :: vu 695 696 !> lower number if in mode range = I 697 integer, intent(in) :: il 698 699 !> upper number if in mode range = I 700 integer, intent(in) :: iu 701 702 !> absolute error tolerance for the eigenvalues 703 real(rdp), intent(in) :: abstol 704 705 !> total number of eigenvalues found 706 integer, intent(out) :: mm 707 708 !> eigenvalues 709 real(rdp), intent(out) :: ww(*) 710 711 !> leading dimension of Z 712 integer, intent(in) :: ldz 713 714 !> matrix Z 715 real(rdp), intent(out) :: zz(ldz, *) 716 717 !> support of the eigenvectors in Z 718 integer, intent(out) :: isuppz(*) 719 720 !> workspace 721 real(rdp), intent(inout) :: work(*) 722 723 !> workspace sizing 724 integer, intent(in) :: lwork 725 726 !> integer workspace 727 integer, intent(inout) :: iwork(*) 728 729 !> size of integer workspace 730 integer, intent(in) :: liwork 731 732 !> state of routine on return 733 integer, intent(out) :: info 734 end subroutine dsyevr 735 end interface dsyevr 736 737 738 !> Complex generalised hermitian eigensolver, relatively robust 739 interface cheevr 740 741 !> Complex generalised hermitian eigensolver, relatively robust 742 subroutine cheevr(jobz, range, uplo, nn, aa, lda, vl, vu, il, iu, abstol,& 743 & mm, ww, zz, ldz, isuppz, work, lwork, rwork, lrwork, iwork, liwork,& 744 & info) 745 import rsp 746 747 !> job type 748 character, intent(in) :: jobz 749 750 !> choice for range of eigenstates, 'A'll, 'V' half range (VL,VU], 'I' IL-th through IU-th 751 !> eigenvalues 752 character, intent(in) :: range 753 754 !> Upper 'U' or lower 'L' triangle 755 character, intent(in) :: uplo 756 757 !> matrix dimension 758 integer, intent(in) :: nn 759 760 !> Leading dimension of A 761 integer, intent(in) :: lda 762 763 !> matrix A 764 complex(rsp), intent(inout) :: aa(lda, *) 765 766 !> Lower range if in mode range = V 767 real(rsp), intent(in) :: vl 768 769 !> upper range 770 real(rsp), intent(in) :: vu 771 772 !> lower number if in mode range = I 773 integer, intent(in) :: il 774 775 !> upper number if in mode range = I 776 integer, intent(in) :: iu 777 778 !> absolute error tolerance for the eigenvalues 779 real(rsp), intent(in) :: abstol 780 781 !> total number of eigenvalues found 782 integer, intent(out) :: mm 783 784 !> Eigenvalues 785 real(rsp), intent(out) :: ww(*) 786 787 !> leading dimension of Z 788 integer, intent(in) :: ldz 789 790 !> matrix Z 791 complex(rsp), intent(out) :: zz(ldz, *) 792 793 !> support of the eigenvectors in Z 794 integer, intent(out) :: isuppz(*) 795 796 !> workspace 797 complex(rsp), intent(inout) :: work(*) 798 799 !> workspace sizing 800 integer, intent(in) :: lwork 801 802 !> real workspace 803 real(rsp), intent(inout) :: rwork(*) 804 805 !> size of rwork 806 integer, intent(in) :: lrwork 807 808 !> integer workspace 809 integer, intent(inout) :: iwork(*) 810 811 !> size of integer workspace 812 integer, intent(in) :: liwork 813 814 !> state of routine on return 815 integer, intent(out) :: info 816 end subroutine cheevr 817 end interface cheevr 818 819 820 !> Complex generalised hermitian eigensolver, relatively robust 821 interface zheevr 822 823 !> Complex generalised hermitian eigensolver, relatively robust 824 subroutine zheevr(jobz, range, uplo, nn, aa, lda, vl, vu, il, iu, abstol,& 825 & mm, ww, zz, ldz, isuppz, work, lwork, rwork, lrwork, iwork, liwork,& 826 & info) 827 import rdp 828 829 !> job type 830 character, intent(in) :: jobz 831 832 !> choice for range of eigenstates, 'A'll, 'V' half range (VL,VU], 'I' IL-th through IU-th 833 !> eigenvalues 834 character, intent(in) :: range 835 836 !> Upper 'U' or lower 'L' triangle 837 character, intent(in) :: uplo 838 839 !> matrix dimension 840 integer, intent(in) :: nn 841 842 !> Leading dimension of A 843 integer, intent(in) :: lda 844 845 !> matrix A 846 complex(rdp), intent(inout) :: aa(lda, *) 847 848 !> Lower range if in mode range = V 849 real(rdp), intent(in) :: vl 850 851 !> upper range 852 real(rdp), intent(in) :: vu 853 854 !> lower number if in mode range = I 855 integer, intent(in) :: il 856 857 !> upper number if in mode range = I 858 integer, intent(in) :: iu 859 860 !> absolute error tolerance for the eigenvalues 861 real(rdp), intent(in) :: abstol 862 863 !> total number of eigenvalues found 864 integer, intent(out) :: mm 865 866 !> eigenvalues 867 real(rdp), intent(out) :: ww(*) 868 869 !> leading dimension of Z 870 integer, intent(in) :: ldz 871 872 !> matrix Z 873 complex(rdp), intent(out) :: zz(ldz, *) 874 875 !> support of the eigenvectors in Z 876 integer, intent(out) :: isuppz(*) 877 878 !> workspace 879 complex(rdp), intent(inout) :: work(*) 880 881 !> workspace sizing 882 integer, intent(in) :: lwork 883 884 !> real workspace 885 real(rdp), intent(inout) :: rwork(*) 886 887 !> size of rwork 888 integer, intent(in) :: lrwork 889 890 !> integer workspace 891 integer, intent(inout) :: iwork(*) 892 893 !> size of integer workspace 894 integer, intent(in) :: liwork 895 896 !> state of routine on return 897 integer, intent(out) :: info 898 end subroutine zheevr 899 end interface zheevr 900 901 902 !> Cholesky factorization of real symmetric positive definite matrix 903 interface spotrf 904 905 !> Cholesky factorization of real symmetric positive definite matrix 906 subroutine spotrf(uplo, nn, aa, lda, info) 907 import rsp 908 909 !> Upper 'U' or lower 'L' triangle 910 character, intent(in) :: uplo 911 912 !> matrix dimension 913 integer, intent(in) :: nn 914 915 !> Leading dimension of A 916 integer, intent(in) :: lda 917 918 !> matrix A 919 real(rsp), intent(inout) :: aa(lda, *) 920 921 !> state of routine on return 922 integer, intent(out) :: info 923 end subroutine spotrf 924 end interface spotrf 925 926 927 !> Cholesky factorization of double precision symmetric positive definite matrix 928 interface dpotrf 929 930 !> Cholesky factorization of double precision symmetric positive definite matrix 931 subroutine dpotrf(uplo, nn, aa, lda, info) 932 import rdp 933 934 !> Upper 'U' or lower 'L' triangle 935 character, intent(in) :: uplo 936 937 !> matrix dimension 938 integer, intent(in) :: nn 939 940 !> Leading dimension of A 941 integer, intent(in) :: lda 942 943 !> matrix A 944 real(rdp), intent(inout) :: aa(lda, *) 945 946 !> state of routine on return 947 integer, intent(out) :: info 948 end subroutine dpotrf 949 end interface dpotrf 950 951 952 !> Cholesky factorization of complex hermitian positive definite matrix 953 interface cpotrf 954 955 !> Cholesky factorization of complex hermitian positive definite matrix 956 subroutine cpotrf(uplo, nn, aa, lda, info) 957 import rsp 958 959 !> Upper 'U' or lower 'L' triangle 960 character, intent(in) :: uplo 961 962 !> matrix dimension 963 integer, intent(in) :: nn 964 965 !> Leading dimension of A 966 integer, intent(in) :: lda 967 968 !> matrix A 969 complex(rsp), intent(inout) :: aa(lda, *) 970 971 !> state of routine on return 972 integer, intent(out) :: info 973 end subroutine cpotrf 974 end interface cpotrf 975 976 977 !> Cholesky factorization of double complex hermitian positive definite matrix 978 interface zpotrf 979 980 !> Cholesky factorization of double complex hermitian positive definite matrix 981 subroutine zpotrf(uplo, nn, aa, lda, info) 982 import rdp 983 984 !> Upper 'U' or lower 'L' triangle 985 character, intent(in) :: uplo 986 987 !> matrix dimension 988 integer, intent(in) :: nn 989 990 !> Leading dimension of A 991 integer, intent(in) :: lda 992 993 !> matrix A 994 complex(rdp), intent(inout) :: aa(lda, *) 995 996 !> state of routine on return 997 integer, intent(out) :: info 998 end subroutine zpotrf 999 end interface zpotrf 1000 1001 1002 !> Reduce real symmetric-definite generalized eigenproblem to standard form 1003 interface ssygst 1004 1005 !> Reduce real symmetric-definite generalized eigenproblem to standard form 1006 subroutine ssygst(itype, uplo, nn, aa, lda, bb, ldb, info) 1007 import rsp 1008 1009 !> Specifies the problem type to be solved 1010 integer, intent(in) :: itype 1011 1012 !> Upper 'U' or lower 'L' triangle 1013 character, intent(in) :: uplo 1014 1015 !> matrix dimension 1016 integer, intent(in) :: nn 1017 1018 !> Leading dimension of A 1019 integer, intent(in) :: lda 1020 1021 !> matrix A 1022 real(rsp), intent(inout) :: aa(lda, *) 1023 1024 !> leading dimension of B 1025 integer, intent(in) :: ldb 1026 1027 !> matrix B 1028 real(rsp), intent(in) :: bb(ldb, *) 1029 1030 !> state of routine on return 1031 integer, intent(out) :: info 1032 end subroutine ssygst 1033 end interface ssygst 1034 1035 1036 !> Reduce double precision symmetric-definite generalized eigenproblem to standard form 1037 interface dsygst 1038 1039 !> Reduce double precision symmetric-definite generalized eigenproblem to standard form 1040 subroutine dsygst(itype, uplo, nn, aa, lda, bb, ldb, info) 1041 import rdp 1042 1043 !> Specifies the problem type to be solved 1044 integer, intent(in) :: itype 1045 1046 !> Upper 'U' or lower 'L' triangle 1047 character, intent(in) :: uplo 1048 1049 !> matrix dimension 1050 integer, intent(in) :: nn 1051 1052 !> Leading dimension of A 1053 integer, intent(in) :: lda 1054 1055 !> matrix A 1056 real(rdp), intent(inout) :: aa(lda, *) 1057 1058 !> leading dimension of B 1059 integer, intent(in) :: ldb 1060 1061 !> matrix B 1062 real(rdp), intent(in) :: bb(ldb, *) 1063 1064 !> state of routine on return 1065 integer, intent(out) :: info 1066 end subroutine dsygst 1067 end interface dsygst 1068 1069 1070 !> Reduce complex hermitian-definite generalized eigenproblem to standard form 1071 interface chegst 1072 1073 !> Reduce complex hermitian-definite generalized eigenproblem to standard form 1074 subroutine chegst(itype, uplo, nn, aa, lda, bb, ldb, info) 1075 import rsp 1076 1077 !> Specifies the problem type to be solved 1078 integer, intent(in) :: itype 1079 1080 !> Upper 'U' or lower 'L' triangle 1081 character, intent(in) :: uplo 1082 1083 !> matrix dimension 1084 integer, intent(in) :: nn 1085 1086 !> Leading dimension of A 1087 integer, intent(in) :: lda 1088 1089 !> matrix A 1090 complex(rsp), intent(inout) :: aa(lda, *) 1091 1092 !> leading dimension of B 1093 integer, intent(in) :: ldb 1094 1095 !> matrix B 1096 complex(rsp), intent(in) :: bb(ldb, *) 1097 1098 !> state of routine on return 1099 integer, intent(out) :: info 1100 end subroutine chegst 1101 end interface chegst 1102 1103 1104 !> Reduce double complex hermitian-definite generalized eigenproblem to standard form 1105 interface zhegst 1106 1107 !> Reduce double complex hermitian-definite generalized eigenproblem to standard form 1108 subroutine zhegst(itype, uplo, nn, aa, lda, bb, ldb, info) 1109 import rdp 1110 1111 !> Specifies the problem type to be solved 1112 integer, intent(in) :: itype 1113 1114 !> Upper 'U' or lower 'L' triangle 1115 character, intent(in) :: uplo 1116 1117 !> matrix dimension 1118 integer, intent(in) :: nn 1119 1120 !> Leading dimension of A 1121 integer, intent(in) :: lda 1122 1123 !> matrix A 1124 complex(rdp), intent(inout) :: aa(lda, *) 1125 1126 !> leading dimension of B 1127 integer, intent(in) :: ldb 1128 1129 !> matrix B 1130 complex(rdp), intent(in) :: bb(ldb, *) 1131 1132 !> state of routine on return 1133 integer, intent(out) :: info 1134 end subroutine zhegst 1135 end interface zhegst 1136 1137 1138 !> Real banded symmetric generalised eigensolver 1139 interface ssbgv 1140 1141 !> Real banded symmetric generalised eigensolver 1142 subroutine ssbgv(jobz, uplo, nn, ka, kb, ab, ldab, bb, ldbb, ww, zz, ldz,& 1143 & work, info) 1144 import rsp 1145 1146 !> job type 1147 character, intent(in) :: jobz 1148 1149 !> Upper 'U' or lower 'L' triangle 1150 character, intent(in) :: uplo 1151 1152 !> matrix dimension 1153 integer, intent(in) :: nn 1154 1155 !> number of superdiagonals/subdiagonals for U / L 1156 integer, intent(in) :: ka 1157 1158 !> number of subdiagonals/superdiagonals for U / L 1159 integer, intent(in) :: kb 1160 1161 !> leading dimension of ab 1162 integer, intent(in) :: ldab 1163 1164 !> matrix ab 1165 real(rsp), intent(inout) :: ab(ldab, *) 1166 1167 !> leading dimension of B 1168 integer, intent(in) :: ldbb 1169 1170 !> matrix B 1171 real(rsp), intent(inout) :: bb(ldbb, *) 1172 1173 !> Eigenvalues 1174 real(rsp), intent(out) :: ww(*) 1175 1176 !> leading dimension of Z 1177 integer, intent(in) :: ldz 1178 1179 !> matrix Z 1180 real(rsp), intent(out) :: zz(ldz, *) 1181 1182 !> workspace 1183 real(rsp), intent(inout) :: work(*) 1184 1185 !> state of routine on return 1186 integer, intent(out) :: info 1187 end subroutine ssbgv 1188 end interface ssbgv 1189 1190 1191 !> Double precision banded symmetric generalised eigensolver 1192 interface dsbgv 1193 1194 !> Double precision banded symmetric generalised eigensolver 1195 subroutine dsbgv(jobz, uplo, nn, ka, kb, ab, ldab, bb, ldbb, ww, zz, ldz,& 1196 & work, info) 1197 import rdp 1198 1199 !> job type 1200 character, intent(in) :: jobz 1201 1202 !> Upper 'U' or lower 'L' triangle 1203 character, intent(in) :: uplo 1204 1205 !> matrix dimension 1206 integer, intent(in) :: nn 1207 1208 !> number of superdiagonals/subdiagonals for U / L 1209 integer, intent(in) :: ka 1210 1211 !> number of subdiagonals/superdiagonals for U / L 1212 integer, intent(in) :: kb 1213 1214 !> leading dimension for ab 1215 integer, intent(in) :: ldab 1216 1217 !> matrix ab 1218 real(rdp), intent(inout) :: ab(ldab, *) 1219 1220 !> leading dimension of B 1221 integer, intent(in) :: ldbb 1222 1223 !> matrix B 1224 real(rdp), intent(inout) :: bb(ldbb, *) 1225 1226 !> eigenvalues 1227 real(rdp), intent(out) :: ww(*) 1228 1229 !> leading dimension of Z 1230 integer, intent(in) :: ldz 1231 1232 !> matrix Z 1233 real(rdp), intent(out) :: zz(ldz, *) 1234 1235 !> workspace 1236 real(rdp), intent(inout) :: work(*) 1237 1238 !> state of routine on return 1239 integer, intent(out) :: info 1240 end subroutine dsbgv 1241 end interface dsbgv 1242 1243 1244 !> Complex banded hermitian generalised eigensolver 1245 interface chbgv 1246 1247 !> Complex banded hermitian generalised eigensolver 1248 subroutine chbgv(jobz, uplo, nn, ka, kb, ab, ldab, bb, ldbb, ww, zz, ldz,& 1249 & work, rwork, info) 1250 import rsp 1251 1252 !> job type 1253 character, intent(in) :: jobz 1254 1255 !> Upper 'U' or lower 'L' triangle 1256 character, intent(in) :: uplo 1257 1258 !> matrix dimension 1259 integer, intent(in) :: nn 1260 1261 !> number of superdiagonals/subdiagonals for U / L 1262 integer, intent(in) :: ka 1263 1264 !> number of subdiagonals/superdiagonals for U / L 1265 integer, intent(in) :: kb 1266 1267 !> leading dimension of ab 1268 integer, intent(in) :: ldab 1269 1270 !> matrix ab 1271 complex(rsp), intent(inout) :: ab(ldab, *) 1272 1273 !> leading dimension of B 1274 integer, intent(in) :: ldbb 1275 1276 !> matrix B 1277 complex(rsp), intent(inout) :: bb(ldbb, *) 1278 1279 !> Eigenvalues 1280 real(rsp), intent(out) :: ww(*) 1281 1282 !> leading dimension of Z 1283 integer, intent(in) :: ldz 1284 1285 !> matrix Z 1286 complex(rsp), intent(out) :: zz(ldz, *) 1287 1288 !> workspace 1289 complex(rsp), intent(inout) :: work(*) 1290 1291 !> real workspace 1292 real(rsp), intent(inout) :: rwork(*) 1293 1294 !> state of routine on return 1295 integer, intent(out) :: info 1296 end subroutine chbgv 1297 end interface chbgv 1298 1299 1300 !> Double complex banded hermitian generalised eigensolver 1301 interface zhbgv 1302 1303 !> Double complex banded hermitian generalised eigensolver 1304 subroutine zhbgv(jobz, uplo, nn, ka, kb, ab, ldab, bb, ldbb, ww, zz, ldz,& 1305 & work, rwork, info) 1306 import rdp 1307 1308 !> job type 1309 character, intent(in) :: jobz 1310 1311 !> Upper 'U' or lower 'L' triangle 1312 character, intent(in) :: uplo 1313 1314 !> matrix dimension 1315 integer, intent(in) :: nn 1316 1317 !> number of superdiagonals/subdiagonals for U / L 1318 integer, intent(in) :: ka 1319 1320 !> number of subdiagonals/superdiagonals for U / L 1321 integer, intent(in) :: kb 1322 1323 !> leading dimension of ab 1324 integer, intent(in) :: ldab 1325 1326 !> matrix ab 1327 complex(rdp), intent(inout) :: ab(ldab, *) 1328 1329 !> leading dimension of B 1330 integer, intent(in) :: ldbb 1331 1332 !> matrix B 1333 complex(rdp), intent(inout) :: bb(ldbb, *) 1334 1335 !> eigenvalues 1336 real(rdp), intent(out) :: ww(*) 1337 1338 !> leading dimension of Z 1339 integer, intent(in) :: ldz 1340 1341 !> matrix Z 1342 complex(rdp), intent(out) :: zz(ldz, *) 1343 1344 !> workspace 1345 complex(rdp), intent(inout) :: work(*) 1346 1347 !> real workspace 1348 real(rdp), intent(inout) :: rwork(*) 1349 1350 !> state of routine on return 1351 integer, intent(out) :: info 1352 end subroutine zhbgv 1353 end interface zhbgv 1354 1355 1356 !> Solve overdetermined or underdetermined real linear systems 1357 interface sgesv 1358 1359 !> Solve overdetermined or underdetermined real linear systems 1360 subroutine sgesv(nn, nrhs, aa, lda, ipiv, bb, ldb, info) 1361 import rsp 1362 1363 !> matrix dimension 1364 integer, intent(in) :: nn 1365 1366 !> number of right hand side equations 1367 integer, intent(in) :: nrhs 1368 1369 !> Leading dimension of A 1370 integer, intent(in) :: lda 1371 1372 !> matrix A 1373 real(rsp), intent(inout) :: aa(lda, *) 1374 1375 !> pivot array 1376 integer, intent(out) :: ipiv(*) 1377 1378 !> leading dimension of B 1379 integer, intent(in) :: ldb 1380 1381 !> matrix B 1382 real(rsp), intent(inout) :: bb(ldb, *) 1383 1384 !> state of routine on return 1385 integer, intent(out) :: info 1386 end subroutine sgesv 1387 end interface sgesv 1388 1389 1390 !> Solve overdetermined or underdetermined double precision linear systems 1391 interface dgesv 1392 1393 !> Solve overdetermined or underdetermined double precision linear systems 1394 subroutine dgesv(nn, nrhs, aa, lda, ipiv, bb, ldb, info) 1395 import rdp 1396 1397 !> matrix dimension 1398 integer, intent(in) :: nn 1399 1400 !> number of right hand side equations 1401 integer, intent(in) :: nrhs 1402 1403 !> Leading dimension of A 1404 integer, intent(in) :: lda 1405 1406 !> matrix A 1407 real(rdp), intent(inout) :: aa(lda, *) 1408 1409 !> pivot array 1410 integer, intent(out) :: ipiv(*) 1411 1412 !> leading dimension of B 1413 integer, intent(in) :: ldb 1414 1415 !> matrix B 1416 real(rdp), intent(inout) :: bb(ldb, *) 1417 1418 !> state of routine on return 1419 integer, intent(out) :: info 1420 end subroutine dgesv 1421 end interface dgesv 1422 1423 1424 !> Computes LU factorization of real matrix 1425 interface sgetrf 1426 1427 !> Computes LU factorization of real matrix 1428 subroutine sgetrf(mm, nn, aa, lda, ipiv, info) 1429 import rsp 1430 1431 !> number of rows of the matrix 1432 integer, intent(in) :: mm 1433 1434 !> matrix dimension 1435 integer, intent(in) :: nn 1436 1437 !> Leading dimension of A 1438 integer, intent(in) :: lda 1439 1440 !> matrix A 1441 real(rsp), intent(inout) :: aa(lda, *) 1442 1443 !> pivot array 1444 integer, intent(out) :: ipiv(*) 1445 1446 !> state of routine on return 1447 integer, intent(out) :: info 1448 end subroutine sgetrf 1449 end interface sgetrf 1450 1451 1452 !> Computes LU factorization of double precision matrix 1453 interface dgetrf 1454 1455 !> Computes LU factorization of double precision matrix 1456 subroutine dgetrf(mm, nn, aa, lda, ipiv, info) 1457 import rdp 1458 1459 !> number of rows of the matrix 1460 integer, intent(in) :: mm 1461 1462 !> matrix dimension 1463 integer, intent(in) :: nn 1464 1465 !> Leading dimension of A 1466 integer, intent(in) :: lda 1467 1468 !> matrix A 1469 real(rdp), intent(inout) :: aa(lda, *) 1470 1471 !> pivot array 1472 integer, intent(out) :: ipiv(*) 1473 1474 !> state of routine on return 1475 integer, intent(out) :: info 1476 end subroutine dgetrf 1477 end interface dgetrf 1478 1479 1480 !> Computes LU factorization of complex matrix 1481 interface cgetrf 1482 1483 !> Computes LU factorization of real matrix 1484 subroutine cgetrf(mm, nn, aa, lda, ipiv, info) 1485 import rsp 1486 1487 !> number of rows of the matrix 1488 integer, intent(in) :: mm 1489 1490 !> matrix dimension 1491 integer, intent(in) :: nn 1492 1493 !> Leading dimension of A 1494 integer, intent(in) :: lda 1495 1496 !> matrix A 1497 complex(rsp), intent(inout) :: aa(lda, *) 1498 1499 !> pivot array 1500 integer, intent(out) :: ipiv(*) 1501 1502 !> state of routine on return 1503 integer, intent(out) :: info 1504 end subroutine cgetrf 1505 end interface cgetrf 1506 1507 1508 !> Computes LU factorization of double precision complex matrix 1509 interface zgetrf 1510 1511 !> Computes LU factorization of double precision matrix 1512 subroutine zgetrf(mm, nn, aa, lda, ipiv, info) 1513 import rdp 1514 1515 !> number of rows of the matrix 1516 integer, intent(in) :: mm 1517 1518 !> matrix dimension 1519 integer, intent(in) :: nn 1520 1521 !> Leading dimension of A 1522 integer, intent(in) :: lda 1523 1524 !> matrix A 1525 complex(rdp), intent(inout) :: aa(lda, *) 1526 1527 !> pivot array 1528 integer, intent(out) :: ipiv(*) 1529 1530 !> state of routine on return 1531 integer, intent(out) :: info 1532 end subroutine zgetrf 1533 end interface zgetrf 1534 1535 1536 !> Computes inverse of a real matrix using LU factorisation 1537 interface sgetri 1538 1539 !> Computes inverse of a real matrix using LU factorisation 1540 subroutine sgetri(nn, aa, lda, ipiv, work, lwork, info) 1541 import rsp 1542 1543 !> matrix dimension 1544 integer, intent(in) :: nn 1545 1546 !> Leading dimension of A 1547 integer, intent(in) :: lda 1548 1549 !> matrix A 1550 real(rsp), intent(inout) :: aa(lda, *) 1551 1552 !> pivot array 1553 integer, intent(in) :: ipiv(*) 1554 1555 !> workspace 1556 real(rsp), intent(inout) :: work(*) 1557 1558 !> workspace sizing 1559 integer, intent(in) :: lwork 1560 1561 !> state of routine on return 1562 integer, intent(out) :: info 1563 end subroutine sgetri 1564 end interface sgetri 1565 1566 1567 !> Computes inverse of a double precision matrix using LU factorisation 1568 interface dgetri 1569 1570 !> Computes inverse of a double precision matrix using LU factorisation 1571 subroutine dgetri(nn, aa, lda, ipiv, work, lwork, info) 1572 import rdp 1573 1574 !> matrix dimension 1575 integer, intent(in) :: nn 1576 1577 !> Leading dimension of A 1578 integer, intent(in) :: lda 1579 1580 !> matrix A 1581 real(rdp), intent(inout) :: aa(lda, *) 1582 1583 !> pivot array 1584 integer, intent(in) :: ipiv(*) 1585 1586 !> workspace 1587 real(rdp), intent(inout) :: work(*) 1588 1589 !> workspace sizing 1590 integer, intent(in) :: lwork 1591 1592 !> state of routine on return 1593 integer, intent(out) :: info 1594 end subroutine dgetri 1595 end interface dgetri 1596 1597 1598 !> Factorise a real symmetric matrix as A = U*D*U**T or A = L*D*L**T 1599 interface ssytrf 1600 1601 !> Factorise a real symmetric matrix as A = U*D*U**T or A = L*D*L**T 1602 subroutine ssytrf(uplo, nn, aa, lda, ipiv, work, lwork, info) 1603 import rsp 1604 1605 !> Upper 'U' or lower 'L' triangle 1606 character, intent(in) :: uplo 1607 1608 !> matrix dimension 1609 integer, intent(in) :: nn 1610 1611 !> Leading dimension of A 1612 integer, intent(in) :: lda 1613 1614 !> matrix A 1615 real(rsp), intent(inout) :: aa(lda, *) 1616 1617 !> pivot array 1618 integer, intent(out) :: ipiv(*) 1619 1620 !> workspace 1621 real(rsp), intent(inout) :: work(*) 1622 1623 !> workspace sizing 1624 integer, intent(in) :: lwork 1625 1626 !> state of routine on return 1627 integer, intent(out) :: info 1628 end subroutine ssytrf 1629 end interface ssytrf 1630 1631 1632 !> Factorise a double precision symmetric matrix as A = U*D*U**T or A = L*D*L**T 1633 interface dsytrf 1634 1635 !> Factorise a double precision symmetric matrix as A = U*D*U**T or A = L*D*L**T 1636 subroutine dsytrf(uplo, nn, aa, lda, ipiv, work, lwork, info) 1637 import rdp 1638 1639 !> Upper 'U' or lower 'L' triangle 1640 character, intent(in) :: uplo 1641 1642 !> matrix dimension 1643 integer, intent(in) :: nn 1644 1645 !> Leading dimension of A 1646 integer, intent(in) :: lda 1647 1648 !> matrix A 1649 real(rdp), intent(inout) :: aa(lda, *) 1650 1651 !> pivot array 1652 integer, intent(out) :: ipiv(*) 1653 1654 !> workspace 1655 real(rdp), intent(inout) :: work(*) 1656 1657 !> workspace sizing 1658 integer, intent(in) :: lwork 1659 1660 !> state of routine on return 1661 integer, intent(out) :: info 1662 end subroutine dsytrf 1663 end interface dsytrf 1664 1665 1666 !> Solve a system of linear equations for a real symmetric matrix A*X = B 1667 interface ssytrs 1668 1669 !> Solve a system of linear equations for a real symmetric matrix A*X = B 1670 subroutine ssytrs(uplo, nn, nrhs, aa, lda, ipiv, bb, ldb, info) 1671 import rsp 1672 1673 !> Upper 'U' or lower 'L' triangle 1674 character, intent(in) :: uplo 1675 1676 !> matrix dimension 1677 integer, intent(in) :: nn 1678 1679 !> number of right hand side equations 1680 integer, intent(in) :: nrhs 1681 1682 !> Leading dimension of A 1683 integer, intent(in) :: lda 1684 1685 !> matrix A 1686 real(rsp), intent(in) :: aa(lda, *) 1687 1688 !> pivot array 1689 integer, intent(in) :: ipiv(*) 1690 1691 !> leading dimension of B 1692 integer, intent(in) :: ldb 1693 1694 !> matrix B 1695 real(rsp), intent(inout) :: bb(ldb, *) 1696 1697 !> state of routine on return 1698 integer, intent(out) :: info 1699 end subroutine ssytrs 1700 end interface ssytrs 1701 1702 1703 !> Solve a system of linear equations for a double precision symmetric matrix A*X = B 1704 interface dsytrs 1705 1706 !> Solve a system of linear equations for a double precision symmetric matrix A*X = B 1707 subroutine dsytrs(uplo, nn, nrhs, aa, lda, ipiv, bb, ldb, info) 1708 import rdp 1709 1710 !> Upper 'U' or lower 'L' triangle 1711 character, intent(in) :: uplo 1712 1713 !> matrix dimension 1714 integer, intent(in) :: nn 1715 1716 !> number of right hand side equations 1717 integer, intent(in) :: nrhs 1718 1719 !> Leading dimension of A 1720 integer, intent(in) :: lda 1721 1722 !> matrix A 1723 real(rdp), intent(in) :: aa(lda, *) 1724 1725 !> pivot array 1726 integer, intent(in) :: ipiv(*) 1727 1728 !> leading dimension of B 1729 integer, intent(in) :: ldb 1730 1731 !> matrix B 1732 real(rdp), intent(inout) :: bb(ldb, *) 1733 1734 !> state of routine on return 1735 integer, intent(out) :: info 1736 end subroutine dsytrs 1737 end interface dsytrs 1738 1739 1740 !> Returns a vector of real random numbers from a uniform or normal distribution 1741 interface slarnv 1742 1743 !> Returns a vector of real random numbers from a uniform or normal distribution 1744 subroutine slarnv(idist, iseed, nn, xx) 1745 import rsp 1746 1747 !> distribution choice 1748 integer, intent(in) :: idist 1749 1750 !> generator seed 1751 integer, intent(inout) :: iseed(4) 1752 1753 !> vector dimension 1754 integer, intent(in) :: nn 1755 1756 !> Random values on exit 1757 real(rsp), intent(out) :: xx(*) 1758 end subroutine slarnv 1759 end interface slarnv 1760 1761 1762 !> Returns a vector of double precision random numbers from a uniform or normal distribution 1763 interface dlarnv 1764 1765 !> Returns a vector of double precision random numbers from a uniform or normal distribution 1766 subroutine dlarnv(idist, iseed, nn, xx) 1767 import rdp 1768 1769 !> distribution choice 1770 integer, intent(in) :: idist 1771 1772 !> generator seed 1773 integer, intent(inout) :: iseed(4) 1774 1775 !> vector dimension 1776 integer, intent(in) :: nn 1777 1778 !> Random values on exit 1779 real(rdp), intent(out) :: xx(*) 1780 end subroutine dlarnv 1781 end interface dlarnv 1782 1783 1784 !> Returns a vector of complex random numbers from a uniform or normal distribution 1785 interface clarnv 1786 1787 !> Returns a vector of complex random numbers from a uniform or normal distribution 1788 subroutine clarnv(idist, iseed, nn, xx) 1789 import rsp 1790 1791 !> distribution choice 1792 integer, intent(in) :: idist 1793 1794 !> generator seed 1795 integer, intent(inout) :: iseed(4) 1796 1797 !> vector dimension 1798 integer, intent(in) :: nn 1799 1800 !> Random values on exit 1801 complex(rsp), intent(out) :: xx(*) 1802 end subroutine clarnv 1803 end interface clarnv 1804 1805 1806 !> Returns a vector of double complex random numbers from a uniform or normal distribution 1807 interface zlarnv 1808 1809 !> Returns a vector of double complex random numbers from a uniform or normal distribution 1810 subroutine zlarnv(idist, iseed, nn, xx) 1811 import rdp 1812 1813 !> distribution choice 1814 integer, intent(in) :: idist 1815 1816 !> generator seed 1817 integer, intent(inout) :: iseed(4) 1818 1819 !> vector dimension 1820 integer, intent(in) :: nn 1821 1822 !> Random values on exit 1823 complex(rdp), intent(out) :: xx(*) 1824 end subroutine zlarnv 1825 end interface zlarnv 1826 1827 1828 !> Provides problem-dependent LAPACK routine parameters for the local environment 1829 interface ilaenv 1830 1831 !> Provides problem-dependent LAPACK routine parameters for the local environment 1832 function ilaenv(ispec, name, opts, n1, n2, n3, n4) 1833 1834 !> Specifies the parameter to be returned 1835 integer, intent(in) :: ispec 1836 1837 !> name of alling subroutine 1838 character, intent(in) :: name 1839 1840 !> The character options to the subroutine NAME, concatenated together 1841 character, intent(in) :: opts 1842 1843 !> Problem dimensions for the subroutine NAME 1844 integer, intent(in) :: n1 1845 1846 !> Problem dimensions for the subroutine NAME 1847 integer, intent(in) :: n2 1848 1849 !> Problem dimensions for the subroutine NAME 1850 integer, intent(in) :: n3 1851 1852 !> Problem dimensions for the subroutine NAME 1853 integer, intent(in) :: n4 1854 1855 !> returned parameter 1856 integer :: ilaenv 1857 end function ilaenv 1858 end interface ilaenv 1859 1860 1861 !> Single precision machine parameters 1862 interface slamch 1863 1864 !> Single precision machine parameters 1865 function slamch(cmach) 1866 import rsp 1867 1868 !> name of parameter to return 1869 character, intent(in) :: cmach 1870 1871 !> parameter value 1872 real(rsp) :: slamch 1873 end function slamch 1874 end interface slamch 1875 1876 1877 !> Double precision machine parameters 1878 interface dlamch 1879 1880 !> Double precision machine parameters 1881 function dlamch(cmach) 1882 import rdp 1883 1884 !> name of parameter to return 1885 character, intent(in) :: cmach 1886 1887 !> parameter value 1888 real(rdp) :: dlamch 1889 end function dlamch 1890 end interface dlamch 1891 1892 1893 !> Error handler for the LAPACK routines 1894 interface xerbla 1895 1896 !> Error handler for the LAPACK routines 1897 subroutine xerbla(srname, info) 1898 1899 !> calling subroutine name 1900 character(6), intent(in) :: srname 1901 1902 !> info state of the routine 1903 integer, intent(in) :: info 1904 end subroutine xerbla 1905 end interface xerbla 1906 1907 !> Real singular value decomposition 1908 interface rgesvd 1909 1910 !> Real singular value decomposition 1911 subroutine rgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, info) 1912 import rsp 1913 1914 !> job type for vt 1915 character, intent(in) :: jobvt 1916 1917 !> job type for u 1918 character, intent(in) :: jobu 1919 1920 !> First matrix dimension for A 1921 integer, intent(in) :: m 1922 1923 !> Second matrix dimension for A 1924 integer, intent(in) :: n 1925 1926 !> leading dimension of A 1927 integer, intent(in) :: lda 1928 1929 !> leading dimension of U 1930 integer, intent(in) :: ldu 1931 1932 !> leading dimension of Vt 1933 integer, intent(in) :: ldvt 1934 1935 !> matrix to decompose 1936 real(rsp), intent(inout) :: a(lda,*) 1937 1938 !> singular values on return min(m,n) 1939 real(rsp), intent(out) :: s(*) 1940 1941 !> Left singular vectors 1942 real(rsp), intent(out) :: u(ldu,*) 1943 1944 !> Right singular vectors 1945 real(rsp), intent(out) :: vt(ldvt,*) 1946 1947 !> work space 1948 real(rsp), intent(out) :: work(*) 1949 1950 !> size of real work space 1951 integer, intent(in) :: lwork 1952 1953 !> state of routine on return 1954 integer, intent(in) :: info 1955 1956 end subroutine rgesvd 1957 1958 end interface rgesvd 1959 1960 !> Double real singular value decomposition 1961 interface dgesvd 1962 1963 !> Double real singular value decomposition 1964 subroutine dgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, info) 1965 import rdp 1966 1967 !> job type for vt 1968 character, intent(in) :: jobvt 1969 1970 !> job type for u 1971 character, intent(in) :: jobu 1972 1973 !> First matrix dimension for A 1974 integer, intent(in) :: m 1975 1976 !> Second matrix dimension for A 1977 integer, intent(in) :: n 1978 1979 !> leading dimension of A 1980 integer, intent(in) :: lda 1981 1982 !> leading dimension of U 1983 integer, intent(in) :: ldu 1984 1985 !> leading dimension of Vt 1986 integer, intent(in) :: ldvt 1987 1988 !> matrix to decompose 1989 real(rdp), intent(inout) :: a(lda,*) 1990 1991 !> singular values on return min(m,n) 1992 real(rdp), intent(out) :: s(*) 1993 1994 !> Left singular vectors 1995 real(rdp), intent(out) :: u(ldu,*) 1996 1997 !> Right singular vectors 1998 real(rdp), intent(out) :: vt(ldvt,*) 1999 2000 !> work space 2001 real(rdp), intent(out) :: work(*) 2002 2003 !> size of work space 2004 integer, intent(in) :: lwork 2005 2006 !> state of routine on return 2007 integer, intent(in) :: info 2008 2009 end subroutine dgesvd 2010 2011 end interface dgesvd 2012 2013 !> Complex singular value decomposition 2014 interface cgesvd 2015 2016 !> Complex singular value decomposition 2017 subroutine cgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, rwork, info) 2018 import rsp 2019 2020 !> job type for vt 2021 character, intent(in) :: jobvt 2022 2023 !> job type for u 2024 character, intent(in) :: jobu 2025 2026 !> First matrix dimension for A 2027 integer, intent(in) :: m 2028 2029 !> Second matrix dimension for A 2030 integer, intent(in) :: n 2031 2032 !> leading dimension of A 2033 integer, intent(in) :: lda 2034 2035 !> leading dimension of U 2036 integer, intent(in) :: ldu 2037 2038 !> leading dimension of Vt 2039 integer, intent(in) :: ldvt 2040 2041 !> matrix to decompose 2042 complex(rsp), intent(inout) :: a(lda,*) 2043 2044 !> singular values on return min(m,n) 2045 real(rsp), intent(out) :: s(*) 2046 2047 !> real workspace 2048 real(rsp), intent(out) :: rwork(*) 2049 2050 !> Left singular vectors 2051 complex(rsp), intent(out) :: u(ldu,*) 2052 2053 !> Right singular vectors 2054 complex(rsp), intent(out) :: vt(ldvt,*) 2055 2056 !> complex work space 2057 complex(rsp), intent(out) :: work(*) 2058 2059 !> size of complex work space 2060 integer, intent(in) :: lwork 2061 2062 !> state of routine on return 2063 integer, intent(in) :: info 2064 2065 end subroutine cgesvd 2066 2067 end interface cgesvd 2068 2069 !> Double complex singular value decomposition 2070 interface zgesvd 2071 2072 !> Double complex singular value decomposition 2073 subroutine zgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, rwork, info) 2074 import rdp 2075 2076 !> job type for vt 2077 character, intent(in) :: jobvt 2078 2079 !> job type for u 2080 character, intent(in) :: jobu 2081 2082 !> First matrix dimension for A 2083 integer, intent(in) :: m 2084 2085 !> Second matrix dimension for A 2086 integer, intent(in) :: n 2087 2088 !> leading dimension of A 2089 integer, intent(in) :: lda 2090 2091 !> leading dimension of U 2092 integer, intent(in) :: ldu 2093 2094 !> leading dimension of Vt 2095 integer, intent(in) :: ldvt 2096 2097 !> matrix to decompose 2098 complex(rdp), intent(inout) :: a(lda,*) 2099 2100 !> singular values on return min(m,n) 2101 real(rdp), intent(out) :: s(*) 2102 2103 !> real workspace 2104 real(rdp), intent(out) :: rwork(*) 2105 2106 !> Left singular vectors 2107 complex(rdp), intent(out) :: u(ldu,*) 2108 2109 !> Right singular vectors 2110 complex(rdp), intent(out) :: vt(ldvt,*) 2111 2112 !> complex work space 2113 complex(rdp), intent(out) :: work(*) 2114 2115 !> size of complex work space 2116 integer, intent(in) :: lwork 2117 2118 !> state of routine on return 2119 integer, intent(in) :: info 2120 2121 end subroutine zgesvd 2122 2123 end interface zgesvd 2124 2125end module dftbp_lapack 2126