Utilities for parallel random number generation and sparse arrays
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(rng_type), | public, | dimension(:), allocatable | :: | rng |
Generate an array of uniformally-distributed random deviates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(out), | dimension(:) | :: | randomu | Array of uniform random deviates |
Generate an array of uniformally-distributed random deviates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(out), | dimension(:) | :: | randomu | Array of uniform random deviates |
Generate an array of normally-distributed random deviates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(out), | dimension(:) | :: | randomn | Array of normal random deviates |
Generate an array of normally-distributed random deviates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(out), | dimension(:) | :: | randomn | Array of normal random deviates |
Procedure for generating a random array index/subscripts
Generate an array of random indices of an 1D array distributed according to cdf
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(in), | dimension(:) | :: | cdf | 1D array of index weights |
|
integer, | intent(out), | dimension(:) | :: | randomi | Random indices |
Generate an array of random indices of an 1D array distributed according to cdf
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | cdf | 1D array of index weights |
|
integer, | intent(out), | dimension(:) | :: | randomi | Random indices |
Procedure for generating a random array index/subscripts
Generate a array of uniformally-distributed random integers in the range [1, n]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | Largest possible value |
||
integer, | intent(out), | dimension(:) | :: | randomi | Array of uniform deviates |
Generate an array of random indices of an 1D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | w | 1D array of index weights |
|
integer, | intent(out), | dimension(:) | :: | randomi | Random indices |
Generate an array of random subscripts of an 2D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:) | :: | w | 2D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate an array of random subscripts of an 3D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:,:) | :: | w | 3D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate an array of random subscripts of an 4D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:,:,:) | :: | w | 4D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate an array of random subscripts of an 5D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:,:,:,:) | :: | w | 5D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate a array of uniformally-distributed random integers in the range [1, n]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
integer, | intent(in) | :: | n | Largest possible value |
||
integer, | intent(out), | dimension(:) | :: | randomi | Array of uniform deviates |
Generate an array of random indices of an 1D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(in), | dimension(:) | :: | w | 1D array of index weights |
|
integer, | intent(out), | dimension(:) | :: | randomi | Random indices |
Generate an array of random subscripts of an 2D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(in), | dimension(:,:), target | :: | w | 2D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate an array of random subscripts of an 3D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(in), | dimension(:,:,:), target | :: | w | 3D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate an array of random subscripts of an 4D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(in), | dimension(:,:,:,:), target | :: | w | 4D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Generate an array of random subscripts of an 5D array distributed according to w
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | r | Random Number Generator |
||
real(kind=Float64), | intent(in), | dimension(:,:,:,:,:), target | :: | w | 5D array of subscript weights |
|
integer, | intent(out), | dimension(:,:) | :: | randomi | A 2D (ndim, :) array of random subscripts |
Creates a sparse array from a dense array
Routine to create a 1D sparse array from a 1D dense array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | A | Dense Array |
|
type(SparseArray), | intent(out) | :: | SA | Sparse Array |
Routine to create a 2D sparse array from a 2D dense array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:) | :: | A | Dense Array |
|
type(SparseArray), | intent(out) | :: | SA | Sparse Array |
Routine to create a 3D sparse array from a 3D dense array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:,:) | :: | A | Dense Array |
|
type(SparseArray), | intent(out) | :: | SA | Sparse Array |
Routine to create a 4D sparse array from a 4D dense array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:,:,:,:) | :: | A | Dense Array |
|
type(SparseArray), | intent(out) | :: | SA | Sparse Array |
Procedure for finding derivatives from an array
Uses 3 point lagrangian method to calculate the derivative of an array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | x | X Values |
|
real(kind=Float64), | intent(in), | dimension(:) | :: | y | Y Values |
|
real(kind=Float64), | intent(out), | dimension(:) | :: | yp | Derivative of Y w.r.t. X |
Uses 3 point lagrangian method to calculate the partial derivative of an array Z w.r.t X and Y
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | x | X Values |
|
real(kind=Float64), | intent(in), | dimension(:) | :: | y | Y Values |
|
real(kind=Float64), | intent(in), | dimension(:,:) | :: | z | Z Values |
|
real(kind=Float64), | intent(out), | dimension(:,:) | :: | zxp | Derivative of Z w.r.t. X |
|
real(kind=Float64), | intent(out), | dimension(:,:) | :: | zyp | Derivative of Z w.r.t. Y |
Uses 3 point lagrangian method to calculate the partial derivative of an array F w.r.t R, Z and Phi
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | r | R Values |
|
real(kind=Float64), | intent(in), | dimension(:) | :: | z | Z Values |
|
real(kind=Float64), | intent(in), | dimension(:) | :: | phi | Phi Values |
|
real(kind=Float64), | intent(in), | dimension(:,:,:) | :: | f | F Values |
|
real(kind=Float64), | intent(out), | dimension(:,:,:) | :: | frp | Derivative of F w.r.t. R |
|
real(kind=Float64), | intent(out), | dimension(:,:,:) | :: | fzp | Derivative of F w.r.t. Z |
|
real(kind=Float64), | intent(out), | dimension(:,:,:) | :: | fphip | Derivative of F w.r.t. Phi |
Random Number Generator Derived Type
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=Int32), | public | :: | seed | ||||
integer(kind=Int32), | public, | dimension(ns) | :: | state |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | nnz | = | 0 | Number of non-zero elements |
|
integer, | public | :: | nd | = | 0 | Number of dimensions |
|
integer, | public, | dimension(:), allocatable | :: | dims | Dimensions of array |
||
integer, | public, | dimension(:), allocatable | :: | inds | Linear index of non-zero elements |
||
real(kind=Float64), | public, | dimension(:), allocatable | :: | vals | Array values |
Calculates the linear index of an array with dimensions dims
and
subcripts subs
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | dimension(:) | :: | dims | Dimension of Array |
|
integer, | intent(in), | dimension(:) | :: | subs | Subscripts to convert |
Linear index
Generates random 32-bit integer seed from /dev/urandom
Seed value
Generate a uniformally-distributed random number in the range [0,1)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | self | Random Number Generator |
Uniform random deviate
Generate a normally-distributed random number with mean 0 and standard deviation 1
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | self | Random Number Generator |
Normal random deviate
Gets value of sparse array SA
at the subscripts subs
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(SparseArray), | intent(in) | :: | SA | Sparse Array |
||
integer, | intent(in), | dimension(:) | :: | subs | Subscripts of Sparse Array |
Value of SA
at subs
Returns time string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | optional | dimension(8) | :: | time_start | Optional start time |
Time string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | dimension(:) | :: | in |
Calculate the subscripts subs
into an array with dimensions dims
given the corresponding linear index ind
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | dimension(:) | :: | dims | Dimensions of array |
|
integer, | intent(in) | :: | ind | Linear index |
||
integer, | intent(out), | dimension(:) | :: | subs | Subscripts corresponding to the linear index |
Procedure to initialize a random number generator with a seed. If seed is negative then random seed is used
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(rng_type), | intent(inout) | :: | self | Random Number Generator |
||
integer(kind=Int32), | intent(in) | :: | seed | Initial Seed Value |
Calculate cumulative sum
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(:) | :: | x | Array to sum |
|
real(kind=Float64), | intent(out), | dimension(:) | :: | cs | Cumulative sum of |