eigensystem Module

A basic libary for calculating matrix eigen-decompositions and inverses


Used by

  • module~~eigensystem~~UsedByGraph module~eigensystem eigensystem module~libfida libfida module~libfida->module~eigensystem program~fidasim fidasim program~fidasim->module~libfida

Contents


Variables

TypeVisibilityAttributesNameInitial
integer, public, parameter:: long =kind(int(1))
integer, public, parameter:: float =kind(1.e0)
integer, public, parameter:: double =kind(1.d0)
real(kind=double), public, parameter:: ONE =1.d0
real(kind=double), public, parameter:: TWO =2.d0
real(kind=double), public, parameter:: ZERO =0.d0
real(kind=double), public, parameter:: XMACH_EPS =2.22d-16
integer, public, parameter:: MAXIT =50

Functions

public function comabs(ar, ai)

Calculates absolute value of a complex number a

Arguments

TypeIntentOptionalAttributesName
real(kind=double) :: ar

Real part of a

real(kind=double) :: ai

Imaginary part of a

Return Value real(kind=double)

Absolute value of a

public function outerprod(a, b)

Calculates outer product

Arguments

TypeIntentOptionalAttributesName
real(kind=double), intent(in), dimension(:):: a
real(kind=double), intent(in), dimension(:):: b

Return Value real(kind=double),dimension(size(a),size(b))


Subroutines

public subroutine RSWAP(a, b)

Swaps values a and b

Arguments

TypeIntentOptionalAttributesName
real(kind=double) :: a
real(kind=double) :: b

public subroutine balance(n, mat, scal, low, high)

Balances the matrix so that the rows with zero entries off the diagonal are isolated and the remaining columns and rows are resized to have one norm close to 1.

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n

Dimension of mat

real(kind=double) :: mat(0:n-1,0:n-1)

nxn scaled matrix

real(kind=double) :: scal(0:n-1)

Contains isolated eigenvalue in the positions 0-low and high-n-1 its other components contain the scaling factors for transforming mat

integer, intent(out) :: low
integer, intent(out) :: high

public subroutine balback(n, low, high, scal, eivec)

Reverses the balancing of balance for the eigenvectors

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n

Dimension of matrix

integer, intent(in) :: low

First nonzero row

integer, intent(in) :: high

Last nonzero row

real(kind=double), intent(in) :: scal(0:n-1)

Scaling data from balance

real(kind=double), intent(inout) :: eivec(0:n-1,0:n-1)

public subroutine elmhes(n, low, high, mat, perm)

Transforms the matrix mat to upper Hessenberg form.

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n

Dimension of mat

integer, intent(in) :: low

First nonzero row

integer, intent(in) :: high

Last nonzero row

real(kind=double), intent(inout) :: mat(0:n-1,0:n-1)

is stored in the lower triangle

integer, intent(out) :: perm(0:n-1)

Permutation vector for elmtrans

public subroutine elmtrans(n, low, high, mat, perm, h)

Elmtrans copies the Hessenberg matrix stored in mat to h

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n

Dimension of mat

integer, intent(in) :: low

First nonzero row

integer, intent(in) :: high

Last nonzero row

real(kind=double), intent(in) :: mat(0:n-1,0:n-1)

nxn input matrix

integer, intent(in) :: perm(0:n-1)

Permutation data from elmhes

real(kind=double), intent(out) :: h(0:n-1,0:n-1)

Hessenberg matrix

public subroutine Comdiv(ar, ai, br, bi, cr, ci, rc)

Performs complex division c = a / b

Arguments

TypeIntentOptionalAttributesName
real(kind=double) :: ar

Real part of numerator

real(kind=double) :: ai

Imaginary part of numerator

real(kind=double) :: br

Real part of denominator

real(kind=double) :: bi

Imaginary part of denominator

real(kind=double) :: cr

Real part of quotient

real(kind=double) :: ci

Imaginary part of quotient

integer :: rc

return code

public subroutine hqrvec(n, low, high, h, wr, wi, eivec, rc)

Computes the eigenvectors for the eigenvalues found in hqr2

Read more…

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n
integer, intent(in) :: low
integer, intent(in) :: high
real(kind=double) :: h(0:n-1,0:n-1)
real(kind=double), intent(in) :: wr(0:n-1)
real(kind=double), intent(in) :: wi(0:n-1)
real(kind=double), intent(out) :: eivec(0:n-1,0:n-1)
integer :: rc

public subroutine hqr2(n, low, high, h, wr, wi, eivec, cnt, rc)

Computes the eigenvalues and (if vec = True) the eigenvectors of an n * n upper Hessenberg matrix.

Read more…

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n
integer, intent(in) :: low
integer, intent(in) :: high
real(kind=double), intent(out) :: h(0:n-1,0:n-1)
real(kind=double), intent(out) :: wr(0:n-1)
real(kind=double), intent(out) :: wi(0:n-1)
real(kind=double), intent(out) :: eivec(0:n-1,0:n-1)
integer, intent(out) :: cnt(0:n-1)
integer, intent(out) :: rc

public subroutine eigen(n, matrix, eigvec, eigval)

The subroutine eigen determines all eigenvalues and (if desired) all eigenvectors of a real square n * n matrix via the QR method in the version of Martin, Parlett, Peters, Reinsch and Wilkinson.

Read more…

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: n
real(kind=double), intent(in), dimension(n,n):: matrix
real(kind=double), intent(out), dimension(n,n):: eigvec
real(kind=double), intent(out), dimension(n):: eigval

public subroutine swap(a, b)

Swap arrays a and b

Arguments

TypeIntentOptionalAttributesName
real(kind=double), intent(inout), dimension(:):: a
real(kind=double), intent(inout), dimension(:):: b

public subroutine ludcmp(a, indx, d)

Calculates LU decomposition

Arguments

TypeIntentOptionalAttributesName
real(kind=double), intent(inout), dimension(:,:):: a
integer, intent(out), dimension(:):: indx
real(kind=double), intent(out) :: d

public subroutine lubksb(a, indx, b)

Does LU back substitution

Arguments

TypeIntentOptionalAttributesName
real(kind=double), intent(in), dimension(:,:):: a
integer, intent(in), dimension(:):: indx
real(kind=double), intent(inout), dimension(:):: b

public subroutine matinv(a, b)

Matrix inversion with LU-decomposition

Arguments

TypeIntentOptionalAttributesName
real(kind=double), intent(in), dimension(:,:):: a
real(kind=double), intent(out), dimension(:,:):: b

public subroutine linsolve(a, b, x)

Solve linear equations A * X = B

Arguments

TypeIntentOptionalAttributesName
real(kind=double), intent(in), dimension(:,:):: a
real(kind=double), intent(in), dimension(:):: b
real(kind=double), intent(out), dimension(:):: x