![]() |
(git:d18deda)
|
Collection of simple mathematical functions and subroutines. More...
Data Types | |
interface | det_3x3 |
interface | invert_matrix |
interface | set_diag |
interface | unit_matrix |
Functions/Subroutines | |
real(kind=dp) function, public | pswitch (x, a, b, order) |
Polynomial (5th degree) switching function f(a) = 1 .... f(b) = 0 with f'(a) = f"(a) = f'(b) = f"(b) = 0. | |
logical function, public | abnormal_value (a) |
determines if a value is not normal (e.g. for Inf and Nan) based on IO to work also under optimization. | |
pure real(kind=dp) function, public | angle (a, b) |
Calculation of the angle between the vectors a and b. The angle is returned in radians. | |
elemental real(kind=dp) function, public | binomial (n, k) |
The binomial coefficient n over k for 0 <= k <= n is calculated, otherwise zero is returned. | |
elemental real(kind=dp) function, public | binomial_gen (z, k) |
The generalized binomial coefficient z over k for 0 <= k <= n is calculated. (z) z*(z-1)*...*(z-k+2)*(z-k+1) ( ) = ------------------------— (k) k! | |
pure real(kind=dp) function, public | multinomial (n, k) |
Calculates the multinomial coefficients. | |
pure subroutine, public | build_rotmat (phi, a, rotmat) |
The rotation matrix rotmat which rotates a vector about a rotation axis defined by the vector a is build up. The rotation angle is phi (radians). | |
subroutine, public | diamat_all (a, eigval, dac) |
Diagonalize the symmetric n by n matrix a using the LAPACK library. Only the upper triangle of matrix a is used. Externals (LAPACK 3.0) | |
pure real(kind=dp) function, public | dihedral_angle (ab, bc, cd) |
Returns the dihedral angle, i.e. the angle between the planes defined by the vectors (-ab,bc) and (cd,-bc). The dihedral angle is returned in radians. | |
pure real(kind=dp) function, dimension(min(size(a, 1), size(a, 2))), public | get_diag (a) |
Return the diagonal elements of matrix a as a vector. | |
pure real(kind=dp) function, dimension(3, 3), public | inv_3x3 (a) |
Returns the inverse of the 3 x 3 matrix a. | |
subroutine, public | invmat (a, info) |
returns inverse of matrix using the lapack routines DGETRF and DGETRI | |
subroutine, public | invmat_symm (a, potrf, uplo) |
returns inverse of real symmetric, positive definite matrix | |
subroutine, public | get_pseudo_inverse_svd (a, a_pinverse, rskip, determinant, sval) |
returns the pseudoinverse of a real, square matrix using singular value decomposition | |
subroutine, public | get_pseudo_inverse_diag (a, a_pinverse, rskip) |
returns the pseudoinverse of a real, symmetric and positive definite matrix using diagonalization. | |
pure real(kind=dp) function, dimension(3), public | reflect_vector (a, b) |
Reflection of the vector a through a mirror plane defined by the normal vector b. The reflected vector a is stored in a_mirror. | |
pure real(kind=dp) function, dimension(3), public | rotate_vector (a, phi, b) |
Rotation of the vector a about an rotation axis defined by the vector b. The rotation angle is phi (radians). The rotated vector a is stored in a_rot. | |
subroutine, public | symmetrize_matrix (a, option) |
Symmetrize the matrix a. | |
pure real(kind=dp) function, dimension(3), public | vector_product (a, b) |
Calculation of the vector product c = a x b. | |
elemental integer function, public | gcd (a, b) |
computes the greatest common divisor of two number | |
elemental integer function, public | lcm (a, b) |
computes the least common multiplier of two numbers | |
elemental impure real(dp) function, public | expint (n, x) |
computes the exponential integral En(x) = Int(exp(-x*t)/t^n,t=1..infinity) x>0, n=0,1,.. Note: Ei(-x) = -E1(x) | |
subroutine, public | jacobi (a, d, v) |
Jacobi matrix diagonalization. The eigenvalues are returned in vector d and the eigenvectors are returned in matrix v in ascending order. | |
subroutine, public | diag (n, a, d, v) |
Diagonalize matrix a. The eigenvalues are returned in vector d and the eigenvectors are returned in matrix v. | |
subroutine, public | erfc_cutoff (eps, omg, r_cutoff) |
| |
subroutine, public | diag_complex (matrix, eigenvectors, eigenvalues) |
Diagonalizes a local complex Hermitian matrix using LAPACK. Based on cp_cfm_heevd. | |
subroutine, public | diag_antisym (matrix, evecs, evals) |
Helper routine for diagonalizing anti symmetric matrices. | |
Collection of simple mathematical functions and subroutines.
real(kind=dp) function, public mathlib::pswitch | ( | real(kind=dp) | x, |
real(kind=dp) | a, | ||
real(kind=dp) | b, | ||
integer | order | ||
) |
logical function, public mathlib::abnormal_value | ( | real(kind=dp) | a | ) |
pure real(kind=dp) function, public mathlib::angle | ( | real(kind=dp), dimension(:), intent(in) | a, |
real(kind=dp), dimension(:), intent(in) | b | ||
) |
elemental real(kind=dp) function, public mathlib::binomial | ( | integer, intent(in) | n, |
integer, intent(in) | k | ||
) |
elemental real(kind=dp) function, public mathlib::binomial_gen | ( | real(kind=dp), intent(in) | z, |
integer, intent(in) | k | ||
) |
pure real(kind=dp) function, public mathlib::multinomial | ( | integer, intent(in) | n, |
integer, dimension(:), intent(in) | k | ||
) |
pure subroutine, public mathlib::build_rotmat | ( | real(kind=dp), intent(in) | phi, |
real(kind=dp), dimension(3), intent(in) | a, | ||
real(kind=dp), dimension(3, 3), intent(out) | rotmat | ||
) |
subroutine, public mathlib::diamat_all | ( | real(kind=dp), dimension(:, :), intent(inout) | a, |
real(kind=dp), dimension(:), intent(out) | eigval, | ||
logical, intent(in), optional | dac | ||
) |
Diagonalize the symmetric n by n matrix a using the LAPACK library. Only the upper triangle of matrix a is used. Externals (LAPACK 3.0)
a | ... |
eigval | ... |
dac | ... |
Definition at line 372 of file mathlib.F.
pure real(kind=dp) function, public mathlib::dihedral_angle | ( | real(kind=dp), dimension(3), intent(in) | ab, |
real(kind=dp), dimension(3), intent(in) | bc, | ||
real(kind=dp), dimension(3), intent(in) | cd | ||
) |
Returns the dihedral angle, i.e. the angle between the planes defined by the vectors (-ab,bc) and (cd,-bc). The dihedral angle is returned in radians.
ab | ... |
bc | ... |
cd | ... |
Definition at line 467 of file mathlib.F.
pure real(kind=dp) function, dimension(min(size(a, 1), size(a, 2))), public mathlib::get_diag | ( | real(kind=dp), dimension(:, :), intent(in) | a | ) |
pure real(kind=dp) function, dimension(3, 3), public mathlib::inv_3x3 | ( | real(kind=dp), dimension(3, 3), intent(in) | a | ) |
subroutine, public mathlib::invmat | ( | real(kind=dp), dimension(:, :), intent(inout) | a, |
integer, intent(out) | info | ||
) |
subroutine, public mathlib::invmat_symm | ( | real(kind=dp), dimension(:, :), intent(inout) | a, |
logical, intent(in), optional | potrf, | ||
character(len=1), intent(in), optional | uplo | ||
) |
returns inverse of real symmetric, positive definite matrix
a | matrix |
potrf | if cholesky decomposition of a was already done using dpotrf. If not given, cholesky decomposition of a will be done before inversion. |
uplo | indicating if the upper or lower triangle of a is stored. |
Definition at line 579 of file mathlib.F.
subroutine, public mathlib::get_pseudo_inverse_svd | ( | real(kind=dp), dimension(:, :) | a, |
real(kind=dp), dimension(:, :) | a_pinverse, | ||
real(kind=dp), intent(in) | rskip, | ||
real(kind=dp), intent(out), optional | determinant, | ||
real(kind=dp), dimension(:), intent(inout), optional, pointer | sval | ||
) |
returns the pseudoinverse of a real, square matrix using singular value decomposition
a | matrix a |
a_pinverse | pseudoinverse of matrix a |
rskip | parameter for setting small singular values to zero |
determinant | determinant of matrix a (optional output) |
sval | array holding singular values of matrix a (optional output) |
Definition at line 937 of file mathlib.F.
subroutine, public mathlib::get_pseudo_inverse_diag | ( | real(kind=dp), dimension(:, :) | a, |
real(kind=dp), dimension(:, :) | a_pinverse, | ||
real(kind=dp), intent(in) | rskip | ||
) |
returns the pseudoinverse of a real, symmetric and positive definite matrix using diagonalization.
a | matrix a |
a_pinverse | pseudoinverse of matrix a |
rskip | parameter for setting small eigenvalues to zero |
Definition at line 1018 of file mathlib.F.
pure real(kind=dp) function, dimension(3), public mathlib::reflect_vector | ( | real(kind=dp), dimension(3), intent(in) | a, |
real(kind=dp), dimension(3), intent(in) | b | ||
) |
pure real(kind=dp) function, dimension(3), public mathlib::rotate_vector | ( | real(kind=dp), dimension(3), intent(in) | a, |
real(kind=dp), intent(in) | phi, | ||
real(kind=dp), dimension(3), intent(in) | b | ||
) |
Rotation of the vector a about an rotation axis defined by the vector b. The rotation angle is phi (radians). The rotated vector a is stored in a_rot.
a | ... |
phi | ... |
b | ... |
Definition at line 1123 of file mathlib.F.
subroutine, public mathlib::symmetrize_matrix | ( | real(kind=dp), dimension(:, :), intent(inout) | a, |
character(len=*), intent(in) | option | ||
) |
pure real(kind=dp) function, dimension(3), public mathlib::vector_product | ( | real(kind=dp), dimension(3), intent(in) | a, |
real(kind=dp), dimension(3), intent(in) | b | ||
) |
elemental integer function, public mathlib::gcd | ( | integer, intent(in) | a, |
integer, intent(in) | b | ||
) |
elemental integer function, public mathlib::lcm | ( | integer, intent(in) | a, |
integer, intent(in) | b | ||
) |
elemental impure real(dp) function, public mathlib::expint | ( | integer, intent(in) | n, |
real(dp), intent(in) | x | ||
) |
subroutine, public mathlib::jacobi | ( | real(kind=dp), dimension(:, :), intent(inout) | a, |
real(kind=dp), dimension(:), intent(out) | d, | ||
real(kind=dp), dimension(:, :), intent(out) | v | ||
) |
Jacobi matrix diagonalization. The eigenvalues are returned in vector d and the eigenvectors are returned in matrix v in ascending order.
a | ... |
d | ... |
v | ... |
Definition at line 1467 of file mathlib.F.
subroutine, public mathlib::diag | ( | integer, intent(in) | n, |
real(kind=dp), dimension(:, :), intent(inout) | a, | ||
real(kind=dp), dimension(:), intent(out) | d, | ||
real(kind=dp), dimension(:, :), intent(out) | v | ||
) |
Diagonalize matrix a. The eigenvalues are returned in vector d and the eigenvectors are returned in matrix v.
n | matrix/vector extent (problem size) |
a | matrix to be diagonalised |
d | vector of eigenvalues |
v | matrix of eigenvectors |
Definition at line 1495 of file mathlib.F.
subroutine, public mathlib::erfc_cutoff | ( | real(dp), intent(in) | eps, |
real(dp), intent(in) | omg, | ||
real(dp), intent(out) | r_cutoff | ||
) |
eps | target accuracy!> |
omg | screening parameter |
omg | ... |
r_cutoff | cutoff radius |
Definition at line 1685 of file mathlib.F.
subroutine, public mathlib::diag_complex | ( | complex(kind=dp), dimension(:, :), intent(in) | matrix, |
complex(kind=dp), dimension(:, :), intent(out) | eigenvectors, | ||
real(kind=dp), dimension(:), intent(out) | eigenvalues | ||
) |
subroutine, public mathlib::diag_antisym | ( | real(dp), dimension(:, :) | matrix, |
complex(dp), dimension(:, :) | evecs, | ||
complex(dp), dimension(:) | evals | ||
) |