ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_strASCII Module Reference

This module contains the uncommon and hardly representable ASCII characters as well as procedures for operating on strings that exclusively contain the 128 ASCII characters.
More...

Data Types

interface  getAsciiFromEscaped
 Generate and return the input C-style escaped string where all instances of C-style escape sequences are converted to the corresponding ASCII characters or left intact if they are not convertible.
More...
 
interface  getCharLower
 Generate and return the input character where the uppercase English alphabet is converted to lowercase letter.
More...
 
interface  getCharUpper
 Generate and return the input character where the lowercase English alphabet is converted to uppercase letter.
More...
 
interface  getLocNonSpace
 Generate and return the location of the first occurrence of a non-whitespace character in the input string, from left to right.
Otherwise, return 0 if the input string is all whitespace characters.
More...
 
interface  getLocSpace
 Generate and return the location of the first occurrence of the whitespace character in the input string, from left to right.
Otherwise, return 0 if the input string does not contain a whitespace character.
More...
 
interface  getStrLower
 Generate and return the input string where the uppercase English alphabets are all converted to lowercase letters.
More...
 
interface  getStrQuoted
 Generate and return the input string quoted with double-quotation marks where all instances of double-quotations within the input string are escaped in the Fortran-style.
More...
 
interface  getStrUpper
 Generate and return the input string where the lowercase English alphabets are all converted to uppercase letters.
More...
 
interface  isCharAlpha
 Generate and return .true. if the input (single) character is an uppercase or lowercase English alphabet ALPHA_VEC_SK.
More...
 
interface  isCharAlphaNum
 Generate and return .true. if the input (single) character is a digit or an uppercase or lowercase English alphabet ALPHA_VEC_SK.
More...
 
interface  isCharDigit
 Generate and return .true. if the input character of length 1 is a digit as in DIGIT_VEC_SK.
More...
 
interface  isCharLower
 Generate and return .true. if the input single character contains an lowercase English alphabet ALPHA_LOWER_VEC_SK.
More...
 
interface  isCharUpper
 Generate and return .true. if the input single character contains an uppercase English alphabet ALPHA_UPPER_VEC_SK.
More...
 
interface  isStrAlpha
 Generate and return a logical vector whose elements are .true. if and only if the corresponding characters in the input string belong to the uppercase English alphabet ALPHA_UPPER_VEC_SK.
More...
 
interface  isStrAlphaAll
 Generate and return .true. if the input string is all alphabetic, containing only the English alphabet ALPHA_VEC_SK.
More...
 
interface  isStrAlphaAny
 Generate and return .true. if any characters of the input string are alphabetic, that is, only the English alphabet ALPHA_VEC_SK.
More...
 
interface  isStrAlphaNum
 Generate and return a logical vector whose elements are .true. if and only if the corresponding characters in the input string belong to the uppercase English alphabet ALPHA_UPPER_VEC_SK.
More...
 
interface  isStrAlphaNumAll
 Generate and return .true. if the input string is all alphanumeric, containing only digits or the English alphabet ALPHANUM_VEC_SK.
More...
 
interface  isStrAlphaNumAny
 Generate and return .true. if any characters of the input string are alphanumeric, that is, only digits or the English alphabet ALPHANUM_VEC_SK.
More...
 
interface  isStrComplex
 Generate and return .true. if all characters of the input string collectively represent a complex number.
More...
 
interface  isStrDigit
 Generate and return a vector of logical values of the same size as the length of the input scalar string str, whose elements are .true. if and only if the corresponding character in the input str is numeric (digits as in DIGIT_VEC_SK).
More...
 
interface  isStrDigitAll
 Generate and return .true. if all characters of the input string are numeric (digits as in DIGIT_VEC_SK).
More...
 
interface  isStrDigitAny
 Generate and return .true. if any character of the input string is numeric (digits as in DIGIT_VEC_SK).
More...
 
interface  isStrInteger
 Generate and return .true. if all characters of the input string collectively represent an integer.
More...
 
interface  isStrLower
 Generate and return a logical vector whose elements are .true. if and only if the corresponding characters in the input string belong to the uppercase English alphabet ALPHA_UPPER_VEC_SK.
More...
 
interface  isStrLowerAll
 Generate and return .true. if the input string contains only lowercase English alphabets ALPHA_LOWER_VEC_SK.
More...
 
interface  isStrLowerAny
 Generate and return .true. if the input string contains at least one lowercase English alphabet ALPHA_LOWER_VEC_SK.
More...
 
interface  isStrNumber
 Generate and return .true. if the input string collectively represents an integer, a real, or a complex number.
More...
 
interface  isStrReal
 Generate and return .true. if all characters of the input string collectively represent a real number.
More...
 
interface  isStrUpper
 Generate and return a logical vector whose elements are .true. if and only if the corresponding characters in the input string belong to the uppercase English alphabet ALPHA_UPPER_VEC_SK.
More...
 
interface  isStrUpperAll
 Generate and return .true. if the input string contains only uppercase English alphabets ALPHA_UPPER_VEC_SK.
More...
 
interface  isStrUpperAny
 Generate and return .true. if the input string contains at least one uppercase English alphabet ALPHA_UPPER_VEC_SK.
More...
 
interface  setAsciiFromEscaped
 Return the input C-style escaped string where all instances of C-style escape sequences are converted to the corresponding ASCII characters or left intact if they are not convertible.
More...
 
interface  setCharLower
 Replace any uppercase English alphabet in the input character with the corresponding lowercase English letter.
More...
 
interface  setCharUpper
 Replace any lowercase English alphabet in the input character with the corresponding uppercase English letter.
More...
 
interface  setStrLower
 Replace all uppercase English alphabets in the input string with the corresponding lowercase English letters.
More...
 
interface  setStrQuoted
 Return the input string quoted with double-quotation marks where all instances of double-quotations within the input string are escaped in the Fortran-style.
More...
 
interface  setStrUpper
 Replace all lowercase English alphabets in the input string with the corresponding uppercase English letters.
More...
 

Variables

character(*, SK), parameter MODULE_NAME = SK_"@pm_strASCII"
 
integer(IK), parameter MAX_ASCII_CODE = 127_IK
 The scalar integer constant of default kind IK representing the maximum standard ASCII code.
More...
 
character(1, SK), parameter NUL = achar(0, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Null character.
More...
 
character(1, SK), parameter SOH = achar(1, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Start of Heading.
More...
 
character(1, SK), parameter STX = achar(2, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Start of Text.
More...
 
character(1, SK), parameter ETX = achar(3, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: End of Text.
More...
 
character(1, SK), parameter EOT = achar(4, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: End of Transmission.
More...
 
character(1, SK), parameter ENQ = achar(5, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Enquiry.
More...
 
character(1, SK), parameter ACK = achar(6, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Acknowledgment.
More...
 
character(1, SK), parameter BEL = achar(7, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Bell (ring character).
More...
 
character(1, SK), parameter BS = achar(8, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Back Space.
More...
 
character(1, SK), parameter HT = achar(9, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Horizontal Tab.
More...
 
character(1, SK), parameter LF = achar(10, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Line Feed (new line character).
More...
 
character(1, SK), parameter VT = achar(11, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Vertical Tab.
More...
 
character(1, SK), parameter FF = achar(12, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Form Feed.
More...
 
character(1, SK), parameter CR = achar(13, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Carriage Return.
More...
 
character(1, SK), parameter SO = achar(14, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Shift Out / X-On.
More...
 
character(1, SK), parameter SI = achar(15, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Shift In / X-Off.
More...
 
character(1, SK), parameter DLE = achar(16, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Data Line Escape.
More...
 
character(1, SK), parameter DC1 = achar(17, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 1 (oft. XON).
More...
 
character(1, SK), parameter DC2 = achar(18, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 2.
More...
 
character(1, SK), parameter DC3 = achar(19, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 3 (oft. XOFF).
More...
 
character(1, SK), parameter DC4 = achar(20, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 4.
More...
 
character(1, SK), parameter NAK = achar(21, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Negative Acknowledgement.
More...
 
character(1, SK), parameter SYN = achar(22, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Synchronous Idle.
More...
 
character(1, SK), parameter ETB = achar(23, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: End of Transmit Block.
More...
 
character(1, SK), parameter CAN = achar(24, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Cancel.
More...
 
character(1, SK), parameter EM = achar(25, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: End of Medium.
More...
 
character(1, SK), parameter SUB = achar(26, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Substitute.
More...
 
character(1, SK), parameter ESC = achar(27, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Escape.
More...
 
character(1, SK), parameter FS = achar(28, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: File Separator.
More...
 
character(1, SK), parameter GS = achar(29, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Group Separator.
More...
 
character(1, SK), parameter RS = achar(30, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Record Separator.
More...
 
character(1, SK), parameter US = achar(31, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Unit Separator.
More...
 
character(2, SK), parameter CRLF = CR//LF
 The scalar character constant of default kind SK of length 2 representing ASCII characters Carriage Return and Line Feed that together form the line terminator on Windows systems.
More...
 
character(1, SK), parameter SPC = achar(32, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Space.
More...
 
character(1, SK), parameter DEL = achar(127, SK)
 The scalar character constant of default kind SK of length 1 representing ASCII character: Delete.
More...
 
character(*, SK), parameter ALPHA_UPPER_STR_SK = SK_"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 The constant scalar of type character of default kind SK containing the ASCII uppercase English letters.
More...
 
character(1, SK), dimension(*), parameter ALPHA_UPPER_VEC_SK = [(ALPHA_UPPER_STR_SK(i:i), i = 1, len(ALPHA_UPPER_STR_SK))]
 The constant array of type character of default kind SK containing the uppercase English letters.
More...
 
character(*, SK), parameter ALPHA_LOWER_STR_SK = SK_"abcdefghijklmnopqrstuvwxyz"
 The constant scalar of type character of default kind SK containing the ASCII lowercase English letters.
More...
 
character(1, SK), dimension(*), parameter ALPHA_LOWER_VEC_SK = [(ALPHA_LOWER_STR_SK(i:i), i = 1, len(ALPHA_LOWER_STR_SK))]
 The constant array of type character of default kind SK containing the lowercase English letters.
More...
 
character(*, SK), parameter ALPHA_STR_SK = ALPHA_UPPER_STR_SK//ALPHA_LOWER_STR_SK
 The constant scalar of type character of default kind SK containing the ASCII uppercase and lowercase English letters.
More...
 
character(1, SK), dimension(*), parameter ALPHA_VEC_SK = [ALPHA_UPPER_VEC_SK, ALPHA_LOWER_VEC_SK]
 The constant array of type character of default kind SK containing the ASCII uppercase and lowercase English letters.
More...
 
integer(IK), parameter UPPER_MINUS_LOWER_IK = ichar(SK_"A", kind = IK) - ichar(SK_"a", kind = IK)
 The constant scalar of type integer of default kind IK representing the distance between A and a in the processor collating sequence.
More...
 
character(*, SK), parameter DIGIT_STR_SK = SK_"0123456789"
 The constant scalar of type character of default kind SK containing the English numbers.
More...
 
character(1, SK), dimension(*), parameter DIGIT_VEC_SK = [(DIGIT_STR_SK(i:i), i = 1, len(DIGIT_STR_SK))]
 The constant array of type character of default kind SK containing the English numbers.
More...
 
character(*, SK), parameter ALPHANUM_STR_SK = DIGIT_STR_SK//ALPHA_STR_SK
 The constant scalar of type character of default kind SK containing the English numbers and alphabets.
More...
 
character(1, SK), dimension(*), parameter ALPHANUM_VEC_SK = [DIGIT_VEC_SK, ALPHA_VEC_SK]
 The constant array of type character of default kind SK containing the English numbers and alphabets.
More...
 
character(*, SK), parameter INTEGER_STR_SK = DIGIT_STR_SK//SK_"-+"
 The constant scalar of type character of default kind SK containing characters that might be used for integer number representation.
More...
 
character(1, SK), dimension(*), parameter INTEGER_VEC_SK = [(INTEGER_STR_SK(i:i), i = 1, len(INTEGER_STR_SK))]
 The constant array of type character of default kind SK containing characters that might be used for integer number representation.
More...
 
character(*, SK), parameter REAL_STR_SK = DIGIT_STR_SK//SK_".edED"
 The constant scalar of type character of default kind SK containing characters that might be used for real number representation.
More...
 
character(1, SK), dimension(*), parameter REAL_VEC_SK = [(REAL_STR_SK(i:i), i = 1, len(REAL_STR_SK))]
 The constant array of type character of default kind SK containing characters that might be used for real number representation.
More...
 
character(*, SK), parameter COMPLEX_STR_SK = REAL_STR_SK//SK_"(),"
 The constant scalar of type character of default kind SK containing characters that might be used for complex number representation.
More...
 
character(1, SK), dimension(*), parameter COMPLEX_VEC_SK = [(COMPLEX_STR_SK(i:i), i = 1, len(COMPLEX_STR_SK))]
 The constant array of type character of default kind SK containing characters that might be used for complex number representation.
More...
 

Detailed Description

This module contains the uncommon and hardly representable ASCII characters as well as procedures for operating on strings that exclusively contain the 128 ASCII characters.

ASCII, stands for American Standard Code for Information Interchange.
It is a 7-bit character code where every single bit represents a unique character.
The first 32 characters in the ASCII-table are unprintable control codes and are used to control peripherals such as printers.
ASCII printable characters (character code 32-127) Codes 32-127 are common for all the different variations of the ASCII table, they are called printable characters, represent letters, digits, punctuation marks, and a few miscellaneous symbols.
You will find almost every character on your keyboard. Character 127 represents the command DEL.

See also
pm_distUnif for uniformly-distributed random character generation.
https://www.ascii-code.com/ for information about ASCII characters.
Benchmarks:


Benchmark :: The runtime performance of getStrLower vs. setStrLower

1! Test the performance of `getStrLower()` vs. `setStrLower()`.
2program benchmark
3
4 use pm_bench, only: bench_type
5 use pm_kind, only: IK, LK, RK, SK
6 use pm_distUnif, only: setUnifRand
7 use iso_fortran_env, only: error_unit
8
9 implicit none
10
11 integer(IK) :: i
12 integer(IK) :: isize
13 integer(IK) :: fileUnit
14 integer(IK) , parameter :: NSIZE = 18_IK
15 integer(IK) , parameter :: NBENCH = 2_IK
16 integer(IK) :: arraySize(NSIZE)
17 logical(LK) :: dummy = .true._LK
18 character(:, SK), allocatable :: Array, arrayNew
19 type(bench_type) :: bench(NBENCH)
20 real(RK) :: TimingMean(2) = 0._RK
21
22 bench(1) = bench_type(name = SK_"setStrLower", exec = setStrLower , overhead = setOverhead)
23 bench(2) = bench_type(name = SK_"getStrLower", exec = getStrLower , overhead = setOverhead)
24
25 arraySize = [( 2_IK**isize, isize = 1_IK, NSIZE )]
26
27 write(*,"(*(g0,:,' '))")
28 write(*,"(*(g0,:,' '))") "setStrLower() vs. getStrLower()"
29 write(*,"(*(g0,:,' '))")
30
31 open(newunit = fileUnit, file = "main.out", status = "replace")
32
33 write(fileUnit, "(*(g0,:,','))") "arraySize", (bench(i)%name, i = 1, NBENCH)
34
35 loopOverArraySize: do isize = 1, NSIZE
36
37 write(*,"(*(g0,:,' '))") "Benchmarking with size", arraySize(isize)
38 allocate(character(arraySize(isize)) :: Array, arrayNew)
39 call setUnifRand(Array)
40
41 do i = 1, NBENCH
42 bench(i)%timing = bench(i)%getTiming(minsec = 0.025_RK)
43 TimingMean(i) = TimingMean(i) + bench(i)%timing%mean
44 end do
45
46 do i = NBENCH, 1, -1
47 bench(i)%timing = bench(i)%getTiming(minsec = 0.025_RK)
48 TimingMean(i) = TimingMean(i) + bench(i)%timing%mean
49 end do
50
51 deallocate(Array, arrayNew)
52 write(fileUnit,"(*(g0,:,','))") arraySize(isize), TimingMean/2
53
54 end do loopOverArraySize
55 write(*,"(*(g0,:,' '))") dummy
56 write(*,"(*(g0,:,' '))")
57
58 close(fileUnit)
59
60contains
61
62 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 ! procedure wrappers.
64 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65
66 subroutine setOverhead()
67 call initialize()
68 call finalize()
69 end subroutine
70
71 subroutine initialize()
72 !allocate( character(arraySize(isize)) :: Array )
73 arrayNew = Array
74 end subroutine
75
76 subroutine finalize()
77 dummy = dummy .and. arrayNew(1:1) == "a"
78 !deallocate(Array)
79 end subroutine
80
81 subroutine setStrLower()
82 block
83 use pm_strASCII, only: setStrLower!, setStrUpper
84 call initialize()
85 call setStrLower(arrayNew)
86 !call setStrUpper(arrayNew)
87 !call setStrLower(arrayNew)
88 call finalize()
89 end block
90 end subroutine
91
92 subroutine getStrLower()
93 block
94 use pm_strASCII, only: getStrLower!, getStrUpper
95 call initialize()
96 arrayNew = getStrLower(arrayNew)
97 !arrayNew = getStrUpper(arrayNew)
98 !arrayNew = getStrLower(arrayNew)
99 call finalize()
100 end block
101 end subroutine
102
103end program benchmark
Generate and return an object of type timing_type containing the benchmark timing information and sta...
Definition: pm_bench.F90:574
Return a uniform random scalar or contiguous array of arbitrary rank of randomly uniformly distribute...
Generate and return the input string where the uppercase English alphabets are all converted to lower...
Replace all uppercase English alphabets in the input string with the corresponding lowercase English ...
This module contains abstract interfaces and types that facilitate benchmarking of different procedur...
Definition: pm_bench.F90:41
This module contains classes and procedures for computing various statistical quantities related to t...
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
This module contains the uncommon and hardly representable ASCII characters as well as procedures for...
Definition: pm_strASCII.F90:61
This is the class for creating benchmark and performance-profiling objects.
Definition: pm_bench.F90:386
subroutine bench(sort, arraySize)

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Postprocessing of the benchmark output
1#!/usr/bin/env python
2
3import matplotlib.pyplot as plt
4import pandas as pd
5import numpy as np
6
7fontsize = 14
8
9methods = ["setStrLower", "getStrLower"]
10
11df = pd.read_csv("main.out")
12
13
16
17ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
18ax = plt.subplot()
19
20for method in methods:
21 plt.plot( df["arraySize"].values
22 , df[method].values
23 , linewidth = 2
24 )
25
26plt.xticks(fontsize = fontsize)
27plt.yticks(fontsize = fontsize)
28ax.set_xlabel("Array Size", fontsize = fontsize)
29ax.set_ylabel("Runtime [ seconds ]", fontsize = fontsize)
30ax.set_title("setStrLower() vs. getStrLower()\nLower is better.", fontsize = fontsize)
31ax.set_xscale("log")
32ax.set_yscale("log")
33plt.minorticks_on()
34plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
35ax.tick_params(axis = "y", which = "minor")
36ax.tick_params(axis = "x", which = "minor")
37ax.legend ( methods
38 #, loc='center left'
39 #, bbox_to_anchor=(1, 0.5)
40 , fontsize = fontsize
41 )
42
43plt.tight_layout()
44plt.savefig("benchmark.getStrLower_vs_setStrLower.runtime.png")
45
46
49
50ax = plt.figure(figsize = 1.25 * np.array([6.4,4.6]), dpi = 200)
51ax = plt.subplot()
52
53plt.plot( df["arraySize"].values
54 , np.ones(len(df["arraySize"].values))
55 #, linestyle = "--"
56 #, color = "black"
57 , linewidth = 2
58 )
59plt.plot( df["arraySize"].values
60 , df["getStrLower"].values / df["setStrLower"].values
61 , linewidth = 2
62 )
63
64plt.xticks(fontsize = fontsize)
65plt.yticks(fontsize = fontsize)
66ax.set_xlabel("Array Size", fontsize = fontsize)
67ax.set_ylabel("Runtime compared to setStrLower()", fontsize = fontsize)
68ax.set_title("getStrLower() / setStrLower()\nLower means faster. Lower than 1 means faster than setStrLower().", fontsize = fontsize)
69ax.set_xscale("log")
70#ax.set_yscale("log")
71plt.minorticks_on()
72plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
73ax.tick_params(axis = "y", which = "minor")
74ax.tick_params(axis = "x", which = "minor")
75ax.legend ( methods
76 #, bbox_to_anchor = (1, 0.5)
77 #, loc = "center left"
78 , fontsize = fontsize
79 )
80
81plt.tight_layout()
82plt.savefig("benchmark.getStrLower_vs_setStrLower.runtime.ratio.png")

Visualization of the benchmark output

Benchmark moral
  1. The procedure getStrLower is a function while the procedure setStrLower is a subroutines.
    From the benchmark results, it appears that the functional interface performs less efficiently than the subroutine interface when the input array size is small ( \(<300\)).
    Nevertheless, the difference appears to diminish or even change its course for large string sizes.
  2. The results of this benchmark are equally applicable to the getStrUpper vs. setStrUpper.
Test:
test_pm_strASCII


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Variable Documentation

◆ ACK

character(1, SK), parameter pm_strASCII::ACK = achar(6, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Acknowledgment.

Definition at line 89 of file pm_strASCII.F90.

◆ ALPHA_LOWER_STR_SK

character(*, SK), parameter pm_strASCII::ALPHA_LOWER_STR_SK = SK_"abcdefghijklmnopqrstuvwxyz"

The constant scalar of type character of default kind SK containing the ASCII lowercase English letters.

Definition at line 146 of file pm_strASCII.F90.

◆ ALPHA_LOWER_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::ALPHA_LOWER_VEC_SK = [(ALPHA_LOWER_STR_SK(i:i), i = 1, len(ALPHA_LOWER_STR_SK))]

The constant array of type character of default kind SK containing the lowercase English letters.

Definition at line 150 of file pm_strASCII.F90.

◆ ALPHA_STR_SK

character(*, SK), parameter pm_strASCII::ALPHA_STR_SK = ALPHA_UPPER_STR_SK//ALPHA_LOWER_STR_SK

The constant scalar of type character of default kind SK containing the ASCII uppercase and lowercase English letters.

Definition at line 159 of file pm_strASCII.F90.

◆ ALPHA_UPPER_STR_SK

character(*, SK), parameter pm_strASCII::ALPHA_UPPER_STR_SK = SK_"ABCDEFGHIJKLMNOPQRSTUVWXYZ"

The constant scalar of type character of default kind SK containing the ASCII uppercase English letters.

Definition at line 133 of file pm_strASCII.F90.

◆ ALPHA_UPPER_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::ALPHA_UPPER_VEC_SK = [(ALPHA_UPPER_STR_SK(i:i), i = 1, len(ALPHA_UPPER_STR_SK))]

The constant array of type character of default kind SK containing the uppercase English letters.

Definition at line 137 of file pm_strASCII.F90.

◆ ALPHA_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::ALPHA_VEC_SK = [ALPHA_UPPER_VEC_SK, ALPHA_LOWER_VEC_SK]

The constant array of type character of default kind SK containing the ASCII uppercase and lowercase English letters.

Definition at line 163 of file pm_strASCII.F90.

◆ ALPHANUM_STR_SK

character(*, SK), parameter pm_strASCII::ALPHANUM_STR_SK = DIGIT_STR_SK//ALPHA_STR_SK

The constant scalar of type character of default kind SK containing the English numbers and alphabets.

Definition at line 191 of file pm_strASCII.F90.

◆ ALPHANUM_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::ALPHANUM_VEC_SK = [DIGIT_VEC_SK, ALPHA_VEC_SK]

The constant array of type character of default kind SK containing the English numbers and alphabets.

Definition at line 195 of file pm_strASCII.F90.

◆ BEL

character(1, SK), parameter pm_strASCII::BEL = achar(7, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Bell (ring character).

Definition at line 90 of file pm_strASCII.F90.

◆ BS

character(1, SK), parameter pm_strASCII::BS = achar(8, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Back Space.

Definition at line 91 of file pm_strASCII.F90.

◆ CAN

character(1, SK), parameter pm_strASCII::CAN = achar(24, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Cancel.

Definition at line 107 of file pm_strASCII.F90.

◆ COMPLEX_STR_SK

character(*, SK), parameter pm_strASCII::COMPLEX_STR_SK = REAL_STR_SK//SK_"(),"

The constant scalar of type character of default kind SK containing characters that might be used for complex number representation.

Definition at line 230 of file pm_strASCII.F90.

◆ COMPLEX_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::COMPLEX_VEC_SK = [(COMPLEX_STR_SK(i:i), i = 1, len(COMPLEX_STR_SK))]

The constant array of type character of default kind SK containing characters that might be used for complex number representation.

Definition at line 234 of file pm_strASCII.F90.

◆ CR

character(1, SK), parameter pm_strASCII::CR = achar(13, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Carriage Return.

Definition at line 96 of file pm_strASCII.F90.

◆ CRLF

character(2, SK), parameter pm_strASCII::CRLF = CR//LF

The scalar character constant of default kind SK of length 2 representing ASCII characters Carriage Return and Line Feed that together form the line terminator on Windows systems.

Definition at line 119 of file pm_strASCII.F90.

◆ DC1

character(1, SK), parameter pm_strASCII::DC1 = achar(17, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 1 (oft. XON).

Definition at line 100 of file pm_strASCII.F90.

◆ DC2

character(1, SK), parameter pm_strASCII::DC2 = achar(18, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 2.

Definition at line 101 of file pm_strASCII.F90.

◆ DC3

character(1, SK), parameter pm_strASCII::DC3 = achar(19, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 3 (oft. XOFF).

Definition at line 102 of file pm_strASCII.F90.

◆ DC4

character(1, SK), parameter pm_strASCII::DC4 = achar(20, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Device Control 4.

Definition at line 103 of file pm_strASCII.F90.

◆ DEL

character(1, SK), parameter pm_strASCII::DEL = achar(127, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Delete.

Definition at line 127 of file pm_strASCII.F90.

◆ DIGIT_STR_SK

character(*, SK), parameter pm_strASCII::DIGIT_STR_SK = SK_"0123456789"

The constant scalar of type character of default kind SK containing the English numbers.

Definition at line 178 of file pm_strASCII.F90.

◆ DIGIT_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::DIGIT_VEC_SK = [(DIGIT_STR_SK(i:i), i = 1, len(DIGIT_STR_SK))]

The constant array of type character of default kind SK containing the English numbers.

Definition at line 182 of file pm_strASCII.F90.

◆ DLE

character(1, SK), parameter pm_strASCII::DLE = achar(16, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Data Line Escape.

Definition at line 99 of file pm_strASCII.F90.

◆ EM

character(1, SK), parameter pm_strASCII::EM = achar(25, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: End of Medium.

Definition at line 108 of file pm_strASCII.F90.

◆ ENQ

character(1, SK), parameter pm_strASCII::ENQ = achar(5, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Enquiry.

Definition at line 88 of file pm_strASCII.F90.

◆ EOT

character(1, SK), parameter pm_strASCII::EOT = achar(4, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: End of Transmission.

Definition at line 87 of file pm_strASCII.F90.

◆ ESC

character(1, SK), parameter pm_strASCII::ESC = achar(27, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Escape.

Definition at line 110 of file pm_strASCII.F90.

◆ ETB

character(1, SK), parameter pm_strASCII::ETB = achar(23, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: End of Transmit Block.

Definition at line 106 of file pm_strASCII.F90.

◆ ETX

character(1, SK), parameter pm_strASCII::ETX = achar(3, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: End of Text.

Definition at line 86 of file pm_strASCII.F90.

◆ FF

character(1, SK), parameter pm_strASCII::FF = achar(12, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Form Feed.

Definition at line 95 of file pm_strASCII.F90.

◆ FS

character(1, SK), parameter pm_strASCII::FS = achar(28, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: File Separator.

Definition at line 111 of file pm_strASCII.F90.

◆ GS

character(1, SK), parameter pm_strASCII::GS = achar(29, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Group Separator.

Definition at line 112 of file pm_strASCII.F90.

◆ HT

character(1, SK), parameter pm_strASCII::HT = achar(9, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Horizontal Tab.

Definition at line 92 of file pm_strASCII.F90.

◆ INTEGER_STR_SK

character(*, SK), parameter pm_strASCII::INTEGER_STR_SK = DIGIT_STR_SK//SK_"-+"

The constant scalar of type character of default kind SK containing characters that might be used for integer number representation.

Definition at line 204 of file pm_strASCII.F90.

◆ INTEGER_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::INTEGER_VEC_SK = [(INTEGER_STR_SK(i:i), i = 1, len(INTEGER_STR_SK))]

The constant array of type character of default kind SK containing characters that might be used for integer number representation.

Definition at line 208 of file pm_strASCII.F90.

◆ LF

character(1, SK), parameter pm_strASCII::LF = achar(10, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Line Feed (new line character).

Definition at line 93 of file pm_strASCII.F90.

◆ MAX_ASCII_CODE

integer(IK), parameter pm_strASCII::MAX_ASCII_CODE = 127_IK

The scalar integer constant of default kind IK representing the maximum standard ASCII code.

Definition at line 75 of file pm_strASCII.F90.

◆ MODULE_NAME

character(*, SK), parameter pm_strASCII::MODULE_NAME = SK_"@pm_strASCII"

Definition at line 71 of file pm_strASCII.F90.

◆ NAK

character(1, SK), parameter pm_strASCII::NAK = achar(21, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Negative Acknowledgement.

Definition at line 104 of file pm_strASCII.F90.

◆ NUL

character(1, SK), parameter pm_strASCII::NUL = achar(0, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Null character.

Warning
This is a dangerous character that has a special meaning to C-processors and some Fortran compilers like ifort.
As such, it should never be used in any string unless the consequences are fully understood.

Definition at line 81 of file pm_strASCII.F90.

◆ REAL_STR_SK

character(*, SK), parameter pm_strASCII::REAL_STR_SK = DIGIT_STR_SK//SK_".edED"

The constant scalar of type character of default kind SK containing characters that might be used for real number representation.

Definition at line 217 of file pm_strASCII.F90.

◆ REAL_VEC_SK

character(1, SK), dimension(*), parameter pm_strASCII::REAL_VEC_SK = [(REAL_STR_SK(i:i), i = 1, len(REAL_STR_SK))]

The constant array of type character of default kind SK containing characters that might be used for real number representation.

Definition at line 221 of file pm_strASCII.F90.

◆ RS

character(1, SK), parameter pm_strASCII::RS = achar(30, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Record Separator.

Definition at line 113 of file pm_strASCII.F90.

◆ SI

character(1, SK), parameter pm_strASCII::SI = achar(15, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Shift In / X-Off.

Definition at line 98 of file pm_strASCII.F90.

◆ SO

character(1, SK), parameter pm_strASCII::SO = achar(14, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Shift Out / X-On.

Definition at line 97 of file pm_strASCII.F90.

◆ SOH

character(1, SK), parameter pm_strASCII::SOH = achar(1, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Start of Heading.

Definition at line 84 of file pm_strASCII.F90.

◆ SPC

character(1, SK), parameter pm_strASCII::SPC = achar(32, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Space.

Definition at line 126 of file pm_strASCII.F90.

◆ STX

character(1, SK), parameter pm_strASCII::STX = achar(2, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Start of Text.

Definition at line 85 of file pm_strASCII.F90.

◆ SUB

character(1, SK), parameter pm_strASCII::SUB = achar(26, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Substitute.

Definition at line 109 of file pm_strASCII.F90.

◆ SYN

character(1, SK), parameter pm_strASCII::SYN = achar(22, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Synchronous Idle.

Definition at line 105 of file pm_strASCII.F90.

◆ UPPER_MINUS_LOWER_IK

integer(IK), parameter pm_strASCII::UPPER_MINUS_LOWER_IK = ichar(SK_"A", kind = IK) - ichar(SK_"a", kind = IK)

The constant scalar of type integer of default kind IK representing the distance between A and a in the processor collating sequence.

Definition at line 172 of file pm_strASCII.F90.

◆ US

character(1, SK), parameter pm_strASCII::US = achar(31, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Unit Separator.

Definition at line 114 of file pm_strASCII.F90.

◆ VT

character(1, SK), parameter pm_strASCII::VT = achar(11, SK)

The scalar character constant of default kind SK of length 1 representing ASCII character: Vertical Tab.

Definition at line 94 of file pm_strASCII.F90.