28 use,
intrinsic :: ieee_exceptions
30 use,
intrinsic :: iso_fortran_env
163 real(real64) function sfmin()
165 real(real64) function dlamch(cmach)
168 character(1),
intent(in) :: cmach
175 subroutine lalg_dgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
176 character(1),
intent(in) :: jobvl, jobvr
177 integer,
intent(in) :: n, lda, ldvl, ldvr, lwork
178 real(real64),
intent(inout) :: a(:, :)
179 complex(real64),
intent(out) :: w(:)
180 real(real64),
intent(out) :: vl(:, :), vr(:, :)
181 real(real64),
intent(out) :: work(:)
182 real(real64),
intent(out) :: rwork(:)
183 integer,
intent(out) :: info
185 real(real64),
allocatable :: wr(:), wi(:)
187 logical :: halting_mode(size(ieee_all))
192 safe_allocate(wr(1:n))
193 safe_allocate(wi(1:n))
199 call ieee_get_halting_mode(ieee_all, halting_mode)
200 call ieee_set_halting_mode(ieee_all, .false.)
202 call dgeev(jobvl, jobvr, n, a(1, 1), lda, wr(1), wi(1), vl(1, 1), ldvl, vr(1, 1), ldvr, work(1), lwork, info)
204 call ieee_set_halting_mode(ieee_all, halting_mode)
206 w(1:n) = cmplx(wr(1:n), wi(1:n), real64)
208 safe_deallocate_a(wr)
209 safe_deallocate_a(wi)
214 subroutine lalg_zgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
215 character(1),
intent(in) :: jobvl, jobvr
216 integer,
intent(in) :: n, lda, ldvl, ldvr, lwork
217 complex(real64),
intent(inout) :: a(:, :)
218 complex(real64),
intent(out) :: w(:)
219 complex(real64),
intent(out) :: vl(:, :), vr(:, :)
220 real(real64),
intent(out) :: rwork(:)
221 complex(real64),
intent(out) :: work(:)
222 integer,
intent(out) :: info
226 call zgeev(jobvl, jobvr, n, a(1, 1), lda, w(1), vl(1, 1), ldvl, vr(1, 1), ldvr, work(1), lwork, rwork(1), info)
248 subroutine zlalg_exp(nn, pp, aa, ex, hermitian)
249 integer,
intent(in) :: nn
250 complex(real64),
intent(in) :: pp
251 complex(real64),
intent(in) :: aa(:, :)
252 complex(real64),
intent(inout) :: ex(:, :)
253 logical,
intent(in) :: hermitian
255 complex(real64),
allocatable :: evectors(:, :), zevalues(:)
256 real(real64),
allocatable :: evalues(:)
262 safe_allocate(evectors(1:nn, 1:nn))
265 safe_allocate(evalues(1:nn))
266 safe_allocate(zevalues(1:nn))
268 evectors(1:nn, 1:nn) = aa(1:nn, 1:nn)
272 zevalues(1:nn) =
exp(pp*evalues(1:nn))
275 ex(1:nn, ii) = zevalues(1:nn)*conjg(evectors(ii, 1:nn))
278 ex(:, :) = matmul(evectors(:, :), ex(:, :))
280 safe_deallocate_a(evalues)
281 safe_deallocate_a(zevalues)
283 safe_allocate(zevalues(1:nn))
285 evectors(1:nn, 1:nn) = aa(1:nn, 1:nn)
289 zevalues(1:nn) =
exp(pp*zevalues(1:nn))
291 ex(1:nn, 1:nn) = evectors(1:nn, 1:nn)
296 evectors(1:nn, ii) = zevalues(1:nn)*evectors(1:nn, ii)
299 ex(:, :) = matmul(ex(:, :), evectors(:, :))
301 safe_deallocate_a(zevalues)
304 safe_deallocate_a(evectors)
326 subroutine zlalg_phi(nn, pp, aa, ex, hermitian)
327 integer,
intent(in) :: nn
328 complex(real64),
intent(in) :: pp
329 complex(real64),
intent(in) :: aa(:, :)
330 complex(real64),
intent(inout) :: ex(:, :)
331 logical,
intent(in) :: hermitian
333 complex(real64),
allocatable :: evectors(:, :), zevalues(:)
334 real(real64),
allocatable :: evalues(:)
340 safe_allocate(evectors(1:nn, 1:nn))
343 safe_allocate(evalues(1:nn))
344 safe_allocate(zevalues(1:nn))
346 evectors(:, :) = aa(:, :)
351 zevalues(ii) = (
exp(pp*evalues(ii)) - m_z1) / (pp*evalues(ii))
355 ex(1:nn, ii) = zevalues(1:nn)*conjg(evectors(ii, 1:nn))
358 ex(:, :) = matmul(evectors(:, :), ex(:, :))
360 safe_deallocate_a(evalues)
361 safe_deallocate_a(zevalues)
363 safe_allocate(zevalues(1:nn))
365 evectors(:, :) = aa(:, :)
370 zevalues(ii) = (
exp(pp*zevalues(ii)) - m_z1) / (pp*zevalues(ii))
373 ex(:, :) = evectors(:, :)
378 evectors(1:nn, ii) = zevalues(1:nn)*evectors(1:nn, ii)
381 ex(:, :) = matmul(ex(:, :), evectors(:, :))
383 safe_deallocate_a(zevalues)
389 complex(real64) function lalg_zdni(eigenvec, alpha, beta)
390 integer,
intent(in) :: alpha, beta
391 complex(real64),
intent(in) :: eigenvec(2)
392 lalg_zdni = conjg(eigenvec(alpha)) * eigenvec(beta)
395 complex(real64) function lalg_zduialpha(eigenvec, mmatrix, alpha, gamma, delta)
396 integer,
intent(in) :: alpha, gamma, delta
397 complex(real64),
intent(in) :: eigenvec(2), mmatrix(2, 2)
401 complex(real64) function lalg_zd2ni(eigenvec, mmatrix, alpha, beta, gamma, delta)
402 integer,
intent(in) :: alpha, beta, gamma, delta
403 complex(real64),
intent(in) :: eigenvec(2), mmatrix(2, 2)
404 lalg_zd2ni = conjg(mmatrix(alpha, delta) * eigenvec(gamma)) * eigenvec(beta) + &
405 conjg(eigenvec(alpha)) * mmatrix(beta, gamma) * eigenvec(delta)
414 integer,
intent(in) :: m, n
415 real(real64),
intent(in) :: sg_values(:)
416 tol = m_epsilon * m * n * maxval(sg_values)
426 integer,
intent(in) :: n
427 real(real64),
intent(in) :: a(1:n, 1:n)
428 real(real64) :: p(1:n, 1:n)
430 real(real64) :: ata(1:n, 1:n)
434 ata = matmul(transpose(a), a)
441#include "complex.F90"
442#include "lalg_adv_lapack_inc.F90"
446#include "lalg_adv_lapack_inc.F90"
Note that lalg_determinant and lalg_inverse are just wrappers over the same routine.
double exp(double __x) __attribute__((__nothrow__
This module contains interfaces for BLACS routines Interfaces are from http:
This module provides the BLACS processor grid.
This module contains interfaces for BLAS routines You should not use these routines directly....
complex(real64) function, public lalg_zd2ni(eigenvec, mmatrix, alpha, beta, gamma, delta)
integer function zmatrix_rank_svd(a, preserve_mat, tol)
Compute the rank of the matrix A using SVD.
subroutine zlowest_geneigensolve(k, n, a, b, e, v, preserve_mat, bof, err_code)
Computes the k lowest eigenvalues and the eigenvectors of a real symmetric or complex Hermitian gener...
complex(real64) function zdeterminant(n, a, preserve_mat)
Invert a real symmetric or complex Hermitian square matrix a.
subroutine zeigensolve_nonh(n, a, e, err_code, side, sort_eigenvectors)
Computes all the eigenvalues and the right (left) eigenvectors of a real or complex (non-Hermitian) e...
subroutine zlinsyssolve(n, nrhs, a, b, x)
compute the solution to a real system of linear equations A*X = B, where A is an N-by-N matrix and X ...
subroutine, public zlalg_exp(nn, pp, aa, ex, hermitian)
pure real(real64) function, public pseudoinverse_default_tolerance(m, n, sg_values)
Computes the default Moore-Penrose pseudoinverse tolerance for zeroing.
subroutine deigensolve_parallel(n, a, e, bof, err_code)
Computes all the eigenvalues and the eigenvectors of a real symmetric or complex Hermitian eigenprobl...
subroutine dgeneigensolve(n, a, b, e, preserve_mat, bof, err_code)
Computes all the eigenvalues and the eigenvectors of a real symmetric or complex Hermitian generalize...
subroutine zlalg_pseudo_inverse(a, threshold)
Invert a matrix with the Moore-Penrose pseudo-inverse.
subroutine zeigensolve(n, a, e, bof, err_code)
Computes all eigenvalues and eigenvectors of a real symmetric or hermitian square matrix A.
subroutine dsingular_value_decomp(m, n, a, u, vt, sg_values, preserve_mat)
Computes the singular value decomposition of a real M x N matrix a.
subroutine deigensolve_nonh(n, a, e, err_code, side, sort_eigenvectors)
Computes all the eigenvalues and the right (left) eigenvectors of a real or complex (non-Hermitian) e...
subroutine deigensolve_tridiagonal(n, a, e, bof, err_code)
Computes all eigenvalues and eigenvectors of a real symmetric tridiagonal matrix. For the Hermitian c...
subroutine zinverse(n, a, method, det, threshold, uplo)
An interface to different method to invert a matrix.
subroutine dqr_factorization(A, jpvt, tau, info, bof)
Compute a QR factorization with column pivoting of matrix A: A*P = Q*R.
real(real64) function sfmin()
Auxiliary function.
subroutine dlinsyssolve(n, nrhs, a, b, x)
compute the solution to a real system of linear equations A*X = B, where A is an N-by-N matrix and X ...
subroutine zsingular_value_decomp(m, n, a, u, vt, sg_values, preserve_mat)
Computes the singular value decomposition of a real M x N matrix a.
subroutine dcholesky(n, a, bof, err_code)
Compute the Cholesky decomposition of real symmetric or complex Hermitian positive definite matrix a,...
subroutine dlalg_matrix_function(n, factor, a, fun_a, fun, hermitian, tridiagonal)
This routine calculates a function of a matrix by using an eigenvalue decomposition.
subroutine deigensolve(n, a, e, bof, err_code)
Computes all eigenvalues and eigenvectors of a real symmetric or hermitian square matrix A.
subroutine dcholesky_pivoted(A, piv, rank, tol, work, UL, bof, info)
Compute the Cholesky factorization with complete pivoting of a real symmetric or complex Hermitian po...
subroutine zeigensolve_tridiagonal(n, a, e, bof, err_code)
Computes all eigenvalues and eigenvectors of a real symmetric tridiagonal matrix. For the Hermitian c...
subroutine zlowest_eigensolve(k, n, a, e, v, preserve_mat)
Computes the k lowest eigenvalues and the eigenvectors of a standard symmetric-definite eigenproblem,...
complex(real64) function, public lalg_zduialpha(eigenvec, mmatrix, alpha, gamma, delta)
subroutine zgeneigensolve(n, a, b, e, preserve_mat, bof, err_code)
Computes all the eigenvalues and the eigenvectors of a real symmetric or complex Hermitian generalize...
subroutine dleast_squares_vec(nn, aa, bb, xx, preserve_mat)
subroutine dlowest_geneigensolve(k, n, a, b, e, v, preserve_mat, bof, err_code)
Computes the k lowest eigenvalues and the eigenvectors of a real symmetric or complex Hermitian gener...
subroutine zcholesky(n, a, bof, err_code)
Compute the Cholesky decomposition of real symmetric or complex Hermitian positive definite matrix a,...
complex(real64) function, public lalg_zdni(eigenvec, alpha, beta)
subroutine zleast_squares_vec(nn, aa, bb, xx, preserve_mat)
real(real64) function, dimension(1:n, 1:n), public lalg_remove_rotation(n, A)
Remove rotation from affine transformation A by computing the polar decomposition and discarding the ...
subroutine lalg_zgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
subroutine, public zlalg_matrix_function(n, factor, a, fun_a, fun, hermitian, tridiagonal)
This routine calculates a function of a matrix by using an eigenvalue decomposition.
subroutine zqr_factorization(A, jpvt, tau, info, bof)
Compute a QR factorization with column pivoting of matrix A: A*P = Q*R.
integer function dmatrix_rank_svd(a, preserve_mat, tol)
Compute the rank of the matrix A using SVD.
subroutine dinverse(n, a, method, det, threshold, uplo)
An interface to different method to invert a matrix.
subroutine zeigensolve_parallel(n, a, e, bof, err_code)
Computes all the eigenvalues and the eigenvectors of a real symmetric or complex Hermitian eigenprobl...
real(real64) function ddeterminant(n, a, preserve_mat)
Invert a real symmetric or complex Hermitian square matrix a.
subroutine lalg_dgeev(jobvl, jobvr, n, a, lda, w, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
subroutine dlowest_eigensolve(k, n, a, e, v, preserve_mat)
Computes the k lowest eigenvalues and the eigenvectors of a standard symmetric-definite eigenproblem,...
subroutine dsvd_inverse(m, n, a, threshold)
Computes the inverse of a real M x N matrix, a, using the SVD decomposition.
subroutine, public zlalg_phi(nn, pp, aa, ex, hermitian)
subroutine zcholesky_pivoted(A, piv, rank, tol, work, UL, bof, info)
Compute the Cholesky factorization with complete pivoting of a real symmetric or complex Hermitian po...
subroutine dlalg_pseudo_inverse(a, threshold)
Invert a matrix with the Moore-Penrose pseudo-inverse.
subroutine zsvd_inverse(m, n, a, threshold)
Computes the inverse of a real M x N matrix, a, using the SVD decomposition.
This module contains interfaces for LAPACK routines.
This module is intended to contain "only mathematical" functions and procedures.
This module contains interfaces for ScaLAPACK routines Interfaces are from http:
This module is intended to contain "only mathematical" functions and procedures.
This module is intended to contain simple general-purpose utility functions and procedures.