rotex__arrays Module

Various routines for arrays



Interfaces

public interface append_uniq

  • private subroutine append_uniq_i(arr, new)

    Append unique element "new" to array "arr"

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(inout), allocatable :: arr(:)
    integer, intent(in) :: new
  • private pure module subroutine append_uniq_transition(old, new)

    Append unique element "new" to array "old"

    Arguments

    Type IntentOptional Attributes Name
    type(asymtop_rot_transition_type), intent(inout), allocatable :: old(:)
    type(asymtop_rot_transition_type), intent(in) :: new(:)

public interface append

  • private pure module subroutine append_i(arr, val)

    Append the value val to the array arr

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(inout), allocatable :: arr(:)
    integer, intent(in) :: val
  • private pure module subroutine append_r(arr, val)

    Append the value val to the array arr

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout), allocatable :: arr(:)
    real(kind=dp), intent(in) :: val
  • private pure module subroutine append_rvector(arr, val)

    Append the value val to the array arr

    Arguments

    Type IntentOptional Attributes Name
    type(rvector_type), intent(inout), allocatable :: arr(:)
    real(kind=dp), intent(in) :: val(:)
  • private pure module subroutine append_asymtop_transition(arr, val)

    Append the value val to the array arr

    Arguments

    Type IntentOptional Attributes Name
    type(asymtop_rot_transition_type), intent(inout), allocatable :: arr(:)
    type(asymtop_rot_transition_type), intent(in) :: val
  • private pure module subroutine append_elec_channel(channels, channel)

    Append elec_channel to the array elec_channels

    Arguments

    Type IntentOptional Attributes Name
    type(elec_channel_type), intent(inout), allocatable :: channels(:)
    type(elec_channel_type), intent(in) :: channel
  • private pure module subroutine append_elec_channels(channels, channels2)

    Append channels2 to the array channels

    Arguments

    Type IntentOptional Attributes Name
    type(elec_channel_type), intent(inout), allocatable :: channels(:)
    type(elec_channel_type), intent(in) :: channels2(:)
  • private pure module subroutine append_asymtop_rot_channel(channels, channel)

    Append asymtop_rot_channel to the array asymtop_rot_channels

    Arguments

    Type IntentOptional Attributes Name
    type(asymtop_rot_channel_type), intent(inout), allocatable :: channels(:)
    type(asymtop_rot_channel_type), intent(in) :: channel
  • private pure module subroutine append_asymtop_rot_channel_l(channels, channel)

    Append asymtop_rot_channel to the array asymtop_rot_channels

    Arguments

    Type IntentOptional Attributes Name
    type(asymtop_rot_channel_l_type), intent(inout), allocatable :: channels(:)
    type(asymtop_rot_channel_l_type), intent(in) :: channel

public interface adjoint

  • private pure module function adjoint_i(A) result(res)

    Returns the adjoint of an integer-valued matrix

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: A(:,:)

    Return Value integer, (size(A,2),size(A,1))

  • private pure module function adjoint_r(A) result(res)

    Returns the adjoint of a real-valued matrix

    Arguments

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

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

  • private pure module function adjoint_c(A) result(res)

    Returns the adjoint of a complex-valued matrix

    Arguments

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

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

public interface size_check

  • private pure module subroutine size_check_1d(arr, larr, name)

    Check that the size of the array arr is of length larr

    Arguments

    Type IntentOptional Attributes Name
    class(*), intent(in) :: arr(:)
    integer, intent(in) :: larr
    character(len=*), intent(in) :: name
  • private pure module subroutine size_check_2d(arr, larr, name)

    Check that the size of the array arr is of length larr

    Arguments

    Type IntentOptional Attributes Name
    class(*), intent(in) :: arr(:,:)
    integer, intent(in) :: larr(:)
    character(len=*), intent(in) :: name

public interface norm_frob

  • private pure module function norm_frob_i(A) result(res)

    Returns the Frobenius norm for a matrix A

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: A(:,:)

    Return Value real(kind=dp)

  • private pure module function norm_frob_r(A) result(res)

    Returns the Frobenius norm for a matrix A

    Arguments

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

    Return Value real(kind=dp)

  • private pure module function norm_frob_c(A) result(res)

    Returns the Frobenius norm for a matrix A

    Arguments

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

    Return Value real(kind=dp)

public interface realloc

  • private pure module subroutine realloc_1d_int(arr, n)

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(inout), allocatable :: arr(:)
    integer, intent(in) :: n
  • private pure module subroutine realloc_1d_real(arr, n)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout), allocatable :: arr(:)
    integer, intent(in) :: n
  • private pure module subroutine realloc_1d_cmplx(arr, n)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(inout), allocatable :: arr(:)
    integer, intent(in) :: n
  • private pure module subroutine realloc_1d_elec_channel(arr, n)

    Arguments

    Type IntentOptional Attributes Name
    type(elec_channel_type), intent(inout), allocatable :: arr(:)
    integer, intent(in) :: n
  • private pure module subroutine realloc_2d_real(arr, n, m)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(inout), allocatable :: arr(:,:)
    integer, intent(in) :: n
    integer, intent(in) :: m
  • private pure module subroutine realloc_2d_cmplx(arr, n, m)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(inout), allocatable :: arr(:,:)
    integer, intent(in) :: n
    integer, intent(in) :: m

Functions

public pure function unitary_defect(A) result(rF)

Return the unitary defect with respect to the Frobenius norm

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: A(:,:)

Return Value real(kind=dp)

public pure function is_unitary(A, rtol) result(res)

Determine whether a matrix is unitary w.r.t the Frobenius norm

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: A(:,:)

The matrix

real(kind=dp), intent(in), optional :: rtol

The optional relative tolerance, default 1e-10

Return Value logical

public pure function is_symmetric(A, rtol) result(res)

Determine whether a matrix is symmetric

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: A(:,:)

The matrix

real(kind=dp), intent(in), optional :: rtol

The optional relative tolerance, default 1e-10

Return Value logical

public pure module function eye(n) result(res)

Return an n x n identity matrix

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

Return Value integer, (n,n)

public pure module function uniq(arr) result(res)

Returns the unique elements of arr

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: arr(:)

Return Value integer, allocatable, (:)


Subroutines

public pure module subroutine remove_value(arr, val)

Remove all instances of the value val from the array arr

Arguments

Type IntentOptional Attributes Name
integer, intent(inout), allocatable :: arr(:)
integer, intent(in) :: val

public pure module subroutine sort_index(vals, idx)

Sort the array vals and return the permutation indices

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vals(:)
integer, intent(out) :: idx(:)