matrix_util Module



Interfaces

public interface linspace

  • private pure function linspace_sp(start_val, end_val, n_opt) result(vec)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: start_val
    real(kind=sp), intent(in) :: end_val
    integer, intent(in) :: n_opt

    Return Value real(kind=sp), allocatable, (:)

  • private pure function linspace_dp(start_val, end_val, n_opt) result(vec)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: start_val
    real(kind=dp), intent(in) :: end_val
    integer, intent(in) :: n_opt

    Return Value real(kind=dp), allocatable, (:)

public interface eig

  • private subroutine eig_cmplx(matrix, e_values, e_vectors, t_left_ev)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(in) :: matrix(:,:)
    real(kind=dp), intent(out) :: e_values(size(matrix,1))
    complex(kind=dp), intent(out), optional :: e_vectors(size(matrix,1),size(matrix,1))
    logical, intent(in), optional :: t_left_ev
  • private subroutine eig_real(matrix, e_values, e_vectors, t_left_ev)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: matrix(:,:)
    real(kind=dp), intent(out) :: e_values(size(matrix,1))
    real(kind=dp), intent(out), optional :: e_vectors(size(matrix,1),size(matrix,1))
    logical, intent(in), optional :: t_left_ev

public interface calc_eigenvalues

  • private function calc_eigenvalues_real(matrix) result(e_values)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: matrix(:,:)

    Return Value real(kind=dp), (size(matrix,1))

  • private function calc_eigenvalues_cmplx(matrix) result(e_values)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(in) :: matrix(:,:)

    Return Value real(kind=dp), (size(matrix,1))

public interface norm

  • private pure function norm_real_sp(vec, p) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: vec(:)
    integer, intent(in), optional :: p

    Return Value real(kind=dp)

  • private pure function norm_real_dp(vec, p) result(res)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: vec(:)
    integer, intent(in), optional :: p

    Return Value real(kind=dp)

  • private pure function norm_complex_sp(vec, p) result(res)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=sp), intent(in) :: vec(:)
    integer, intent(in), optional :: p

    Return Value real(kind=dp)

  • private pure function norm_complex_dp(vec, p) result(res)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(in) :: vec(:)
    integer, intent(in), optional :: p

    Return Value real(kind=dp)

public interface is_orthonormal

  • private pure function is_orthonormal_real_sp(M) result(res)

    Check if all < M(:, i) | M(:, j) > = 0

    Note that M does not have to be square.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: M(:,:)

    Return Value logical

  • private pure function is_orthonormal_real_dp(M) result(res)

    Check if all < M(:, i) | M(:, j) > = 0

    Note that M does not have to be square.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: M(:,:)

    Return Value logical

  • private pure function is_orthonormal_complex_sp(M) result(res)

    Check if all < M(:, i) | M(:, j) > = 0

    Note that M does not have to be square.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=sp), intent(in) :: M(:,:)

    Return Value logical

  • private pure function is_orthonormal_complex_dp(M) result(res)

    Check if all < M(:, i) | M(:, j) > = 0

    Note that M does not have to be square.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(in) :: M(:,:)

    Return Value logical


Functions

private function calc_eigenvalues_real(matrix) result(e_values)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)

Return Value real(kind=dp), (size(matrix,1))

private function calc_eigenvalues_cmplx(matrix) result(e_values)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: matrix(:,:)

Return Value real(kind=dp), (size(matrix,1))

public pure function check_symmetric(matrix)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)

Return Value logical

public function det(matrix)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)

Return Value real(kind=dp)

public function blas_matmul(A, B) result(C)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: A(:,:)
real(kind=dp), intent(in) :: B(:,:)

Return Value real(kind=dp), (size(A,1),size(A,2))

private pure function linspace_sp(start_val, end_val, n_opt) result(vec)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: start_val
real(kind=sp), intent(in) :: end_val
integer, intent(in) :: n_opt

Return Value real(kind=sp), allocatable, (:)

private pure function linspace_dp(start_val, end_val, n_opt) result(vec)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: start_val
real(kind=dp), intent(in) :: end_val
integer, intent(in) :: n_opt

Return Value real(kind=dp), allocatable, (:)

public function matrix_exponential(matrix) result(exp_matrix)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)

Return Value real(kind=dp), (size(matrix,1),size(matrix,2))

private function matrix_diag(vector) result(diag)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vector(:)

Return Value real(kind=dp), (size(vector),size(vector))

public function matrix_inverse(matrix) result(inverse)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)

Return Value real(kind=dp), (size(matrix,1),size(matrix,2))

public pure function my_minval(vec, target_state)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vec(:)
integer, intent(in), optional :: target_state

Return Value real(kind=dp)

public pure function my_minloc(vec, target_state)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vec(:)
integer, intent(in), optional :: target_state

Return Value integer

private pure function norm_real_sp(vec, p) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: vec(:)
integer, intent(in), optional :: p

Return Value real(kind=dp)

private pure function norm_real_dp(vec, p) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vec(:)
integer, intent(in), optional :: p

Return Value real(kind=dp)

private pure function norm_complex_sp(vec, p) result(res)

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(in) :: vec(:)
integer, intent(in), optional :: p

Return Value real(kind=dp)

private pure function norm_complex_dp(vec, p) result(res)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: vec(:)
integer, intent(in), optional :: p

Return Value real(kind=dp)

public pure function gram_schmidt(V) result(U)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: V(:,:)

Return Value real(kind=dp), (size(V,1),size(V,2))

private pure function project_canonical_unit_vectors(M) result(P)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: M(:,:)

Return Value real(kind=dp), (size(M,1),size(M,1))

private pure function is_orthonormal_real_sp(M) result(res)

Check if all < M(:, i) | M(:, j) > = 0

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: M(:,:)

Return Value logical

private pure function is_orthonormal_real_dp(M) result(res)

Check if all < M(:, i) | M(:, j) > = 0

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: M(:,:)

Return Value logical

private pure function is_orthonormal_complex_sp(M) result(res)

Check if all < M(:, i) | M(:, j) > = 0

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(in) :: M(:,:)

Return Value logical

private pure function is_orthonormal_complex_dp(M) result(res)

Check if all < M(:, i) | M(:, j) > = 0

Read more…

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: M(:,:)

Return Value logical


Subroutines

public subroutine print_vec(vec, filename, t_index, t_zero)

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: vec(:)
character(len=*), intent(in), optional :: filename
logical, intent(in), optional :: t_index
logical, intent(in), optional :: t_zero

private subroutine eig_real(matrix, e_values, e_vectors, t_left_ev)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)
real(kind=dp), intent(out) :: e_values(size(matrix,1))
real(kind=dp), intent(out), optional :: e_vectors(size(matrix,1),size(matrix,1))
logical, intent(in), optional :: t_left_ev

private subroutine eig_cmplx(matrix, e_values, e_vectors, t_left_ev)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: matrix(:,:)
real(kind=dp), intent(out) :: e_values(size(matrix,1))
complex(kind=dp), intent(out), optional :: e_vectors(size(matrix,1),size(matrix,1))
logical, intent(in), optional :: t_left_ev

public subroutine eig_sym(matrix, e_values, e_vectors)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)
real(kind=dp), intent(out) :: e_values(size(matrix,1))
real(kind=dp), intent(out), optional :: e_vectors(size(matrix,1),size(matrix,2))

public subroutine print_matrix(matrix, iunit)

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: matrix(:,:)
integer, intent(in), optional :: iunit

public subroutine store_hf_coeff(e_values, e_vecs, target_state, hf_coeff, hf_ind, gs_ind)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: e_values(:)
real(kind=dp), intent(in) :: e_vecs(:,:)
integer, intent(in), optional :: target_state
real(kind=dp), intent(out) :: hf_coeff
integer, intent(out) :: hf_ind
integer, intent(out) :: gs_ind

public subroutine find_degeneracies(e_values, ind, pairs)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: e_values(:)
integer, intent(out), allocatable :: ind(:,:)
integer, intent(out), allocatable :: pairs(:,:)

public pure subroutine canonicalize(V, lambda)

This routine canonicalizes the eigenvector matrix V and the corresponding eigenvalues lambda

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: V(:,:)
real(kind=dp), intent(inout) :: lambda(:)

private pure subroutine determine_eigenspaces(lambda, dimensions)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: lambda(:)
integer, intent(out), allocatable :: dimensions(:)