Octopus
lapack.F90
Go to the documentation of this file.
1!! Copyright (C) 2009 X. Andrade
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
21! -----------------------------------------------------------------------
23! -----------------------------------------------------------------------
24
25module lapack_oct_m
26 use, intrinsic :: iso_fortran_env
27 implicit none
28
29 public ! only interfaces in this module
30
45 interface lapack_potrf
46 subroutine dpotrf(uplo, n, a, lda, info)
47 use, intrinsic :: iso_fortran_env
48 implicit none
49 character(1), intent(in) :: uplo
50 integer, intent(in) :: n
51 real(real64), intent(inout) :: a
52 integer, intent(in) :: lda
53 integer, intent(out) :: info
54 end subroutine dpotrf
55
56 subroutine zpotrf(uplo, n, a, lda, info)
57 use, intrinsic :: iso_fortran_env
58 implicit none
59 character(1), intent(in) :: uplo
60 integer, intent(in) :: n
61 complex(real64), intent(inout) :: a
62 integer, intent(in) :: lda
63 integer, intent(out) :: info
64 end subroutine zpotrf
65 end interface lapack_potrf
66
67 interface
68 subroutine dpstrf(uplo, n, a, lda, piv, rank, tol, work, info)
69 import real64
70 implicit none
71 character(len=1), intent(in) :: uplo
72 integer, intent(in) :: n
73 real(real64), intent(inout) :: a
74 integer, intent(in) :: lda
75 integer, intent(out) :: piv
76 integer, intent(out) :: rank
77 real(real64), intent(in) :: tol
78 real(real64), intent(inout) :: work
79 integer, intent(out) :: info
80 end subroutine dpstrf
81
82 subroutine zpstrf(uplo, n, a, lda, piv, rank, tol, work, info)
83 import real64
84 implicit none
85 character(len=1), intent(in) :: uplo
86 integer, intent(in) :: n
87 complex(real64), intent(inout) :: a
88 integer, intent(in) :: lda
89 integer, intent(out) :: piv
90 integer, intent(out) :: rank
91 real(real64), intent(in) :: tol
92 real(real64), intent(inout) :: work
93 integer, intent(out) :: info
94 end subroutine zpstrf
95 end interface
96
102 interface lapack_sygv
103 subroutine dsygv(itype, jobz, uplo, n, a, lda, b, ldb, w, work, lwork, info)
104 use, intrinsic :: iso_fortran_env
105 implicit none
106 character(1), intent(in) :: jobz, uplo
107 integer, intent(in) :: itype, n, lda, ldb, lwork
108 real(real64), intent(inout) :: a, b
109 real(real64), intent(out) :: w, work
110 integer, intent(out) :: info
111 end subroutine dsygv
112 end interface lapack_sygv
113
115 interface lapack_sygvd
116 subroutine dsygvd(itype, jobz, uplo, n, a, lda, b, ldb, w, work, lwork, iwork, liwork, info)
117 use, intrinsic :: iso_fortran_env
118 implicit none
119 character(1), intent(in) :: jobz, uplo
120 integer, intent(in) :: itype, n, lda, ldb, lwork, liwork
121 real(real64), intent(inout) :: a, b
122 real(real64), intent(out) :: w, work
123 integer, intent(out) :: iwork, info
124 end subroutine dsygvd
125 end interface lapack_sygvd
126
132 interface lapack_hegv
133 subroutine zhegv(itype, jobz, uplo, n, a, lda, b, ldb, w, work, lwork, rwork, info)
134 use, intrinsic :: iso_fortran_env
135 implicit none
136 character(1), intent(in) :: jobz, uplo
137 integer, intent(in) :: n, itype, lda, ldb, lwork
138 complex(real64), intent(inout) :: a, b
139 real(real64), intent(out) :: w, rwork
140 complex(real64), intent(out) :: work
141 integer, intent(out) :: info
142 end subroutine zhegv
143 end interface lapack_hegv
144
146 interface lapack_hegvd
147 subroutine zhegvd(itype, jobz, uplo, n, a, lda, b, ldb, w, work, lwork, rwork, lrwork, iwork, liwork, info)
148 use, intrinsic :: iso_fortran_env
149 implicit none
150 character(1), intent(in) :: jobz, uplo
151 integer, intent(in) :: n, itype, lda, ldb, lwork, lrwork, liwork
152 complex(real64), intent(inout) :: a, b
153 real(real64), intent(out) :: w, rwork
154 complex(real64), intent(out) :: work
155 integer, intent(out) :: iwork, info
156 end subroutine zhegvd
157 end interface lapack_hegvd
158
175 interface
176 subroutine dgeev(jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr, work, lwork, info)
177 use, intrinsic :: iso_fortran_env
178 implicit none
179 character(1), intent(in) :: jobvl, jobvr
180 integer, intent(in) :: n, lda, ldvl, ldvr, lwork
181 real(real64), intent(inout) :: a
182 real(real64), intent(out) :: wr, wi, vl, vr
183 real(real64), intent(out) :: work
184 integer, intent(out) :: info
185 end subroutine dgeev
186
187 subroutine zgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
188 use, intrinsic :: iso_fortran_env
189 implicit none
190 character(1), intent(in) :: jobvl, jobvr
191 integer, intent(in) :: n, lda, ldvl, ldvr, lwork
192 complex(real64), intent(inout) :: a
193 complex(real64), intent(out) :: w, vl, vr
194 real(real64), intent(out) :: rwork
195 complex(real64), intent(out) :: work
196 integer, intent(out) :: info
197 end subroutine zgeev
198 end interface
199
200 interface lapack_gesvx
201 subroutine dgesvx(fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, &
202 c, b, ldb, x, ldx, rcond, ferr, berr, work, iwork, info)
203 use, intrinsic :: iso_fortran_env
204 implicit none
205 character(1), intent(in) :: fact, trans
206 integer, intent(in) :: n, nrhs, lda, ldaf, ldb, ldx
207 real(real64), intent(inout) :: a, af, r, c, b
208 integer, intent(inout) :: ipiv
209 real(real64), intent(out) :: x, ferr, berr, work
210 real(real64), intent(out) :: rcond
211 character(1), intent(inout) :: equed
212 integer, intent(out) :: iwork
213 integer, intent(out) :: info
214 end subroutine dgesvx
215
216 subroutine zgesvx (fact, trans, n, nrhs, a, lda, af, ldaf, ipiv, equed, r, &
217 c, b, ldb, x, ldx, rcond, ferr, berr, work, rwork, info)
218 use, intrinsic :: iso_fortran_env
219 implicit none
220 character(1), intent(in) :: fact, trans
221 integer, intent(in) :: n, nrhs, lda, ldaf, ldb, ldx
222 complex(real64), intent(inout) :: a, af, b
223 real(real64), intent(inout) :: r, c
224 integer, intent(inout) :: ipiv
225 real(real64), intent(out) :: ferr, berr
226 real(real64), intent(out) :: rcond
227 complex(real64), intent(out) :: x, work
228 character(1), intent(inout) :: equed
229 real(real64), intent(out) :: rwork
230 integer, intent(out) :: info
231 end subroutine zgesvx
232 end interface lapack_gesvx
233
236 interface lapack_syev
237 subroutine dsyev(jobz, uplo, n, a, lda, w, work, lwork, info)
238 use, intrinsic :: iso_fortran_env
239 implicit none
240 character(1), intent(in) :: jobz, uplo
241 integer, intent(in) :: n, lda, lwork
242 real(real64), intent(inout) :: a
243 real(real64), intent(out) :: w, work
244 integer, intent(out) :: info
245 end subroutine dsyev
246 end interface lapack_syev
247
250 interface lapack_heev
251 subroutine zheev(jobz, uplo, n, a, lda, w, work, lwork, rwork, info)
252 use, intrinsic :: iso_fortran_env
253 implicit none
254 character(1), intent(in) :: jobz, uplo
255 integer, intent(in) :: n, lda, lwork
256 complex(real64), intent(inout) :: a
257 real(real64), intent(out) :: w, rwork
258 complex(real64), intent(out) :: work
259 integer, intent(out) :: info
260 end subroutine zheev
261 end interface lapack_heev
262
263 interface
264 subroutine dsyevx(jobz, range, uplo, n, a, lda, &
265 vl, vu, il, iu, abstol, m, w, z, ldz, work, lwork, iwork, ifail, info)
266 use, intrinsic :: iso_fortran_env
267 implicit none
268 integer, intent(in) :: n, lda, il, iu, ldz, lwork
269 character(1), intent(in) :: jobz, range, uplo
270 integer, intent(out) :: m, iwork, ifail, info
271 real(real64), intent(in) :: vl, vu, abstol
272 real(real64), intent(inout) :: a
273 real(real64), intent(out) :: w, z, work
274 end subroutine dsyevx
275
276 subroutine zheevx(jobz, range, uplo, n, a, lda, &
277 vl, vu, il, iu, abstol, m, w, z, ldz, work, lwork, iwork, ifail, info)
278 use, intrinsic :: iso_fortran_env
279 implicit none
280 integer, intent(in) :: n, lda, il, iu, ldz, lwork
281 character(1), intent(in) :: jobz, range, uplo
282 integer, intent(out) :: m, iwork, ifail, info
283 real(real64), intent(in) :: vl, vu, abstol
284 real(real64), intent(out) :: w
285 complex(real64), intent(inout) :: a
286 complex(real64), intent(out) :: z, work
287 end subroutine zheevx
288 end interface
289
294 interface lapack_geqrf
295 subroutine dgeqrf(m, n, a, lda, tau, work, lwork, info)
296 use, intrinsic :: iso_fortran_env
297 implicit none
298 integer, intent(in) :: lda, lwork, m, n
299 real(real64), intent(inout) :: a
300 real(real64), intent(out) :: tau, work
301 integer, intent(out) :: info
302 end subroutine dgeqrf
303
304 subroutine zgeqrf(m, n, a, lda, tau, work, lwork, info)
305 use, intrinsic :: iso_fortran_env
306 implicit none
307 integer, intent(in) :: lda, lwork, m, n
308 complex(real64), intent(inout) :: a
309 complex(real64), intent(out) :: tau, work
310 integer, intent(out) :: info
311 end subroutine zgeqrf
312 end interface lapack_geqrf
313
323 interface lapack_orgqr
324 subroutine dorgqr(m, n, k, a, lda, tau, work, lwork, info)
325 use, intrinsic :: iso_fortran_env
326 implicit none
327 integer, intent(in) :: k, lda, lwork, m, n
328 real(real64), intent(in) :: tau
329 real(real64), intent(inout) :: a
330 real(real64), intent(out) :: work
331 integer, intent(out) :: info
332 end subroutine dorgqr
333
334 subroutine zungqr(m, n, k, a, lda, tau, work, lwork, info)
335 use, intrinsic :: iso_fortran_env
336 implicit none
337 integer, intent(in) :: k, lda, lwork, m, n
338 complex(real64), intent(in) :: tau
339 complex(real64), intent(inout) :: a
340 complex(real64), intent(out) :: work
341 integer, intent(out) :: info
342 end subroutine zungqr
343 end interface lapack_orgqr
344
351 interface lapack_sygvx
352 subroutine dsygvx(itype, jobz, range, uplo, n, a, lda, b, ldb, vl, vu, il, iu, abstol, &
353 m, w, z, ldz, work, lwork, iwork, ifail, info)
354 use, intrinsic :: iso_fortran_env
355 implicit none
356
357 integer, intent(in) :: itype
358 character(len=1), intent(in) :: jobz
359 character(len=1), intent(in) :: range
360 character(len=1), intent(in) :: uplo
361 integer, intent(in) :: n
362 real(real64), intent(inout) :: a
363 integer, intent(in) :: lda
364 real(real64), intent(inout) :: b
365 integer, intent(in) :: ldb
366 real(real64), intent(in) :: vl
367 real(real64), intent(in) :: vu
368 integer, intent(in) :: il
369 integer, intent(in) :: iu
370 real(real64), intent(in) :: abstol
371 integer, intent(out) :: m
372 real(real64), intent(out) :: w
373 real(real64), intent(out) :: z
374 integer, intent(in) :: ldz
375 real(real64), intent(out) :: work
376 integer, intent(in) :: lwork
377 integer, intent(out) :: iwork
378 integer, intent(out) :: ifail
379 integer, intent(out) :: info
380 end subroutine dsygvx
381 end interface lapack_sygvx
382
389 interface lapack_hegvx
390 subroutine zhegvx(itype, jobz, range, uplo, n, a, lda, b, ldb, vl, vu, il, iu, abstol, &
391 m, w, z, ldz, work, lwork, rwork, iwork, ifail, info)
392 use, intrinsic :: iso_fortran_env
393 implicit none
394
395 integer, intent(in) :: itype
396 character(len=1), intent(in) :: jobz
397 character(len=1), intent(in) :: range
398 character(len=1), intent(in) :: uplo
399 integer, intent(in) :: n
400 complex(real64), intent(inout) :: a
401 integer, intent(in) :: lda
402 complex(real64), intent(inout) :: b
403 integer, intent(in) :: ldb
404 real(real64), intent(in) :: vl
405 real(real64), intent(in) :: vu
406 integer, intent(in) :: il
407 integer, intent(in) :: iu
408 real(real64), intent(in) :: abstol
409 integer, intent(out) :: m
410 real(real64), intent(out) :: w
411 complex(real64), intent(out) :: z
412 integer, intent(in) :: ldz
413 complex(real64), intent(out) :: work
414 integer, intent(in) :: lwork
415 real(real64), intent(out) :: rwork
416 integer, intent(out) :: iwork
417 integer, intent(out) :: ifail
418 integer, intent(out) :: info
419 end subroutine zhegvx
420 end interface lapack_hegvx
421
422 interface lapack_gelss
423 subroutine dgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, info)
424 use, intrinsic :: iso_fortran_env
425 implicit none
426 integer, intent(in) :: m
427 integer, intent(in) :: n
428 integer, intent(in) :: nrhs
429 real(real64),intent(inout) :: a
430 integer, intent(in) :: lda
431 real(real64),intent(inout) :: b
432 integer, intent(in) :: ldb
433 real(real64),intent(out) :: s
434 real(real64),intent(in) :: rcond
435 integer, intent(out) :: rank
436 real(real64),intent(out) :: work
437 integer, intent(in) :: lwork
438 integer, intent(out) :: info
439 end subroutine dgelss
440
441 subroutine zgelss(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork, info)
442 use, intrinsic :: iso_fortran_env
443 implicit none
444 integer, intent(in) :: m
445 integer, intent(in) :: n
446 integer, intent(in) :: nrhs
447 complex(real64), intent(inout) :: a
448 integer, intent(in) :: lda
449 complex(real64), intent(inout) :: b
450 integer, intent(in) :: ldb
451 real(real64),intent(out) :: s
452 real(real64),intent(in) :: rcond
453 integer, intent(out) :: rank
454 complex(real64), intent(out) :: work
455 integer, intent(in) :: lwork
456 real(real64),intent(out) :: rwork
457 integer, intent(out) :: info
458 end subroutine zgelss
459 end interface lapack_gelss
460
461 interface lapack_getrf
462 subroutine dgetrf (m, n, a, lda, ipiv, info)
463 use, intrinsic :: iso_fortran_env
464 implicit none
465 integer, intent(in) :: m, n, lda
466 real(real64), intent(inout) :: a
467 integer, intent(out) :: ipiv
468 integer, intent(out) :: info
469 end subroutine dgetrf
470
471 subroutine zgetrf (m, n, a, lda, ipiv, info)
472 use, intrinsic :: iso_fortran_env
473 implicit none
474 integer, intent(in) :: m, n, lda
475 complex(real64), intent(inout) :: a
476 integer, intent(out) :: ipiv
477 integer, intent(out) :: info
478 end subroutine zgetrf
479 end interface lapack_getrf
480
481 interface lapack_getri
482 subroutine dgetri(n, a, lda, ipiv, work, lwork, info)
483 use, intrinsic :: iso_fortran_env
484 implicit none
485 integer, intent(in) :: n, lda, lwork
486 real(real64), intent(inout) :: a
487 integer, intent(in) :: ipiv
488 real(real64), intent(out) :: work
489 integer, intent(out) :: info
490 end subroutine dgetri
491
492 subroutine zgetri(n, a, lda, ipiv, work, lwork, info)
493 use, intrinsic :: iso_fortran_env
494 implicit none
495 integer, intent(in) :: n, lda, lwork
496 complex(real64), intent(inout) :: a
497 integer, intent(in) :: ipiv
498 complex(real64), intent(out) :: work
499 integer, intent(out) :: info
500 end subroutine zgetri
501 end interface lapack_getri
502
503 interface lapack_sytrf
504 subroutine dsytrf(uplo, n, a, lda, ipiv, work, lwork, info)
505 use, intrinsic :: iso_fortran_env
506 implicit none
507 character(1), intent(in) :: uplo
508 integer, intent(in) :: n, lda, lwork
509 real(real64), intent(inout) :: a
510 integer, intent(out) :: ipiv
511 real(real64), intent(out) :: work
512 integer, intent(out) :: info
513 end subroutine dsytrf
514
515 subroutine zsytrf(uplo, n, a, lda, ipiv, work, lwork, info)
516 use, intrinsic :: iso_fortran_env
517 implicit none
518 character(1), intent(in) :: uplo
519 integer, intent(in) :: n, lda, lwork
520 complex(real64), intent(inout) :: a
521 integer, intent(out) :: ipiv
522 complex(real64), intent(out) :: work
523 integer, intent(out) :: info
524 end subroutine zsytrf
525 end interface lapack_sytrf
526
527 interface lapack_sytri
528 subroutine dsytri (uplo, n, a, lda, ipiv, work, info)
529 use, intrinsic :: iso_fortran_env
530 implicit none
531 character(1), intent(in) :: uplo
532 integer, intent(in) :: n, lda
533 real(real64), intent(inout) :: a
534 integer, intent(in) :: ipiv
535 real(real64), intent(out) :: work
536 integer, intent(out) :: info
537 end subroutine dsytri
538
539 subroutine zsytri (uplo, n, a, lda, ipiv, work, info)
540 use, intrinsic :: iso_fortran_env
541 implicit none
542 character(1), intent(in) :: uplo
543 integer, intent(in) :: n, lda
544 complex(real64), intent(inout) :: a
545 integer, intent(in) :: ipiv
546 complex(real64), intent(out) :: work
547 integer, intent(out) :: info
548 end subroutine zsytri
549 end interface lapack_sytri
550
551 interface lapack_stev
552 subroutine dstev (jobz, n, d, e, z, ldz, work, info)
553 use, intrinsic :: iso_fortran_env
554 implicit none
555 character(1), intent(in) :: jobz
556 integer, intent(in) :: n
557 real(real64), intent(inout) :: d, e
558 real(real64), intent(out) :: z
559 integer, intent(in) :: ldz
560 real(real64), intent(out) :: work
561 integer, intent(out) :: info
562 end subroutine dstev
563 end interface lapack_stev
564
565 interface lapack_steqr
566 subroutine zsteqr (compz, n, d, e, z, ldz, work, info)
567 use, intrinsic :: iso_fortran_env
568 implicit none
569 character(1), intent(in) :: compz
570 integer, intent(in) :: n
571 real(real64), intent(inout) :: d, e
572 complex(real64), intent(inout) :: z
573 integer, intent(in) :: ldz
574 real(real64), intent(out) :: work
575 integer, intent(out) :: info
576 end subroutine zsteqr
577 end interface lapack_steqr
578
579
580end module lapack_oct_m
581
582!! Local Variables:
583!! mode: f90
584!! coding: utf-8
585!! End:
Computes for an complex nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or righ...
Definition: lapack.F90:271
Computes a QR factorization of a real matrix A:
Definition: lapack.F90:389
Computes all eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A.
Definition: lapack.F90:345
Computes all the eigenvalues, and optionally, the eigenvectors of a complex generalized Hermitian-def...
Definition: lapack.F90:227
Same as lapack_hegv but using the divide and conquer algorithm.
Definition: lapack.F90:241
Computes selected eigenvalues, and optionally, eigenvectors of a complex generalized Hermitian-defini...
Definition: lapack.F90:484
Generates an real matrix Q with orthonormal columns, which is defined as the first N columns of a pr...
Definition: lapack.F90:418
Computes the Cholesky factorization of a real symmetric positive definite matrix A.
Definition: lapack.F90:140
Computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix A.
Definition: lapack.F90:331
Computes all the eigenvalues, and optionally, the eigenvectors of a real generalized symmetric-defini...
Definition: lapack.F90:197
Same as lapack_sygv but using the divide and conquer algorithm.
Definition: lapack.F90:210
Computes selected eigenvalues, and optionally, eigenvectors of a real generalized symmetric-definite ...
Definition: lapack.F90:446
This module contains interfaces for LAPACK routines.
Definition: lapack.F90:120