BasicOps

Fortran module BasicOps: October 2016 (dj)

Setting kind of floating point numbers, complex unit and initialization of the seed for the random number generator. Contains as well sorting algorithms.

Authors

      1. Wall

    1. Jaschke

Details

The following public subroutines / functions are defined for real / complex arrays if applicable.

procedure

include.f90

mpi.f90

ascending_hsort

X

descending_hsort

X

findtagindex

X

get_random_number

X

par_finalize

X

par_init

X

prop_error

X

raise_error

X

randomize

X

seed_init

X

BasicOps_f90.seed_init()[source]

fortran-subroutine - March 2018 (dj) Set random seed using either intrinsic method or preparing for LAPACK’s DLARNV.

Arguments

rankINTEGER, OPTIONAL, in

Initialize seed with rank.

qtidINTEGER, OPTIONAL, in

Initialize seed with ID of quantum trajectory.

Source Code

show / hide f90 code
BasicOps_f90.seed_init_dlarnv()[source]

fortran-subroutine - March 2018 (dj) Set random seed for LAPACK’s DLARNV.

Arguments

rankINTEGER, OPTIONAL, in

Initialize seed with rank.

qtidINTEGER, OPTIONAL, in

Initialize seed with ID of quantum trajectory.

Source Code

show / hide f90 code
BasicOps_f90.seed_init_intrinsic()[source]

fortran-subroutine - August 2016 (updated dj) Randomly seed the random number generator using the intrinsic system clock. Optional argument rank takes in the rank of a given processor to ensure no correlation of the random numbers on different processors.

Arguments

rankINTEGER, OPTIONAL, in

For parallel implementations when random number initialization should be different for each process in openmp or mpi or for quantum trajectories (QT). If rank is present, random numbers are reproducable and do not depend on system time!

qtidINTEGER, OPTIONAL, in

Specifies ID for quantum trajectory and allows to get a set of reproducable trajectories for the Lindblad master equation.

Source Code

show / hide f90 code
BasicOps_f90.get_random_number_real()[source]

fortran-subroutine - March 2018 (dj) Generate a single real-valued random number.

Arguments

scREAL, out

On exit, random number generated.

distrINTEGER, OPTIONAL, in

Choose distribution, only used for DLARNV: 1: U(0, 1), 2: U(-1, 1), 3: N(0, 1). Default to U(0, 1).

Source Code

show / hide f90 code
BasicOps_f90.get_random_number_array()[source]

fortran-subroutine - March 2018 (dj) Generate a vector of real-valued random numbers.

Arguments

vecREAL, out

On exit, vector with random number generated.

distrINTEGER, OPTIONAL, in

Choose distribution, only used for DLARNV: 1: U(0, 1), 2: U(-1, 1), 3: N(0, 1). Default to U(0, 1).

Source Code

show / hide f90 code
BasicOps_f90.randomize_real()[source]

fortran-subroutine - Randomize the elements of an array in the range [-1, 1]. March 2016 (update dj)

Arguments

arrREAL(*), out

Fill with random numbers from -1 to 1.

dimINTEGER, in

Dimension of the array arr.

Source Code

show / hide f90 code
BasicOps_f90.randomize_complex()[source]

fortran-subroutine - Randomize the elements of an array in the range [-1-i, 1+i]. March 2016 (update dj)

Arguments

arrCOMPLEX(*), out

Fill with random numbers from -1-i to 1+i.

dimINTEGER, in

Dimension of the array arr.

Source Code

show / hide f90 code
BasicOps_f90.descending_hsort()[source]

fortran-subroutine - ?? (mlw) Sort array in descending order using the heapsort algorithm.

Arguments

arrREAL(*), in

Array to be sorted. Unchanged on exit.

indexoutINTEGER(*), out

Contains the sorted indexing. e.g the biggest element is accessed as arr(indexout(1)).

Source Code

show / hide f90 code
BasicOps_f90.ascending_hsort_without_degeneracy()[source]

fortran-subroutine - ?? (mlw) Sort A in ascending order using the heapsort algorithm

Arguments

arrREAL(*), in

Array to be sorted. Unchanged on exit.

indexoutINTEGER(*), out

Contains the sorted indexing. e.g the smalest element is accessed as arr(indexout(1)).

Source Code

show / hide f90 code
BasicOps_f90.ascending_hsort_with_degeneracy()[source]

fortran-subroutine - September 2017 (dj, updated) Given a hash which is possibly degnerate, construct a hash table “littlehash” of the unique values, and return the number of unique values nunique along with their degeneracies and positions in the full hash table. i.e. the value littlehash(j) occurs for hash(ind(deg(j):deg(j+1))). Assumes littlehash and ind are SIZE(hash) in length and deg is SIZE(hash)+1 in length.

Arguments

hashINTEGER(*), ???

List of degenerated hashes to be sorted.

littlehashINTEGER(*), out

length is SIZE(hash). Containing the list of hashes without degeneracy. Not completly set (see nunique)

indINTEGER(*), out

length is SIZE(hash). i-th entry points to (one of) the i-th biggest value of hash.

nuniqueINTEGER, out

Number of different hashes, therefore littlehash is set from elements 1 to nunique.

degINTEGER(*), out

deg has length SIZE(hash) + 1 The first index of a degenerate i-th hash can be found with ind(deg(i) + 1) up to the last with ind(deg(i+1)) (Other description is most probably wrong, since deg(1) = 0)

Source Code

show / hide f90 code
BasicOps_f90.FindTagIndex_real()[source]

fortran-function - ?? (mlw) Find the index of element tag in the sorted list (or hash table) hash using binary search. If the element is not found then return -1.

Arguments

tagREAL, in

Element to be located in list.

hashREAL(*), in

Sorted list searching for an entry matching tag. Must be sorted ascending.

Source Code

show / hide f90 code
BasicOps_f90.FindTagIndex_int()[source]

fortran-function - ?? (mlw) Find the index of element tag in the sorted list (or hash table) hash using binary search. If the element is not found then return -1.

Arguments

tagINTEGER, in

Element to be located in list.

hashINTEGER(*), in

Sorted list searching for an entry matching tag. Must be sorted ascending.

Source Code

show / hide f90 code
BasicOps_f90.raise_error()[source]

fortran-function - October 2016 (dj) Call this function in case an error occurs. It will either stop the program or propagate the error message through the code.

Arguments

msgCHARACTER(*), in

Print this message in case of an error in order facilitate tracking the error.

statusINTEGER, in

error status to be set.

file_lineCHARACTER(*), in

String containing the file name and the line number where the error is raised.

errstINTEGER, OPTIONAL, in

Status of the error distinguishes between propagating error when errst is present. If not present, stop is raised directly.

Source Code

show / hide f90 code
BasicOps_f90.prop_error()[source]

fortran-function - October 2016 (dj) Handle posting of error messages in regard to the error status from a previous call.

Arguments

msgCHARACTER(*), in

Print this message in case of an error in order facilitate tracking the error.

file_lineCHARACTER(*), in

String containing the file name and the line number where the error is propagated.

errstINTEGER, OPTIONAL, in

Status of the error as set from the last call. If not present, it defaults to the no-error case.

Source Code

show / hide f90 code