Utility routines.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private, | parameter | :: | max_size_for_insertion_sort | = | 20 |
max size for using insertion sort. |
character(len=*), | private, | parameter | :: | upper | = | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
uppercase characters |
character(len=*), | private, | parameter | :: | lower | = | 'abcdefghijklmnopqrstuvwxyz' |
lowercase characters |
Returns only the unique elements of the vector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | dimension(:) | :: | vec |
a vector of integers |
|
integer, | intent(in) | :: | chunk_size |
chunk size for adding to arrays |
unique elements of ivec
Returns lowercase version of the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
input string |
lowercase version of the string
Add elements to the integer vector in chunks.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(inout), | dimension(:), allocatable | :: | vec | ||
integer, | intent(inout) | :: | n |
counter for last element added to |
||
integer, | intent(in) | :: | chunk_size |
allocate |
||
integer, | intent(in), | optional | :: | val |
the value to add to |
|
logical, | intent(in), | optional | :: | finished |
set to true to return |
Sorts an integer array ivec
in increasing order.
Uses a basic recursive quicksort
(with insertion sort for partitions with 20 elements).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(inout), | dimension(:) | :: | ivec |
Swap two integer values.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(inout) | :: | i1 | |||
integer, | intent(inout) | :: | i2 |