diff --git a/fortls/intrinsic.procedures.markdown.json b/fortls/intrinsic.procedures.markdown.json index 81a9e76e..3e0adcc1 100644 --- a/fortls/intrinsic.procedures.markdown.json +++ b/fortls/intrinsic.procedures.markdown.json @@ -1,5 +1,5 @@ { - "ABS": "## abs\n\n### **Name**\n\n**abs** - \\[NUMERIC\\] Absolute value\n\n### **Synopsis**\n```fortran\n result = abs(a)\n```\n```fortran\n elemental TYPE(kind=KIND) function abs(a)\n\n TYPE(kind=KIND),intent(in) :: a\n```\n### **Characteristics**\n\n- **a** may be any _real_, _integer_, or _complex_ value.\n\n- If **a** is _complex_ the returned value will be a _real_ with the\n same kind as **a**.\n\n Otherwise the returned type and kind is the same as for **a**.\n\n### **Description**\n\n **abs** computes the absolute value of numeric argument **a**.\n\n In mathematics, the absolute value or modulus of a real number **x**,\n denoted **|x|**, is the magnitude of **x** without regard to its sign.\n\n The absolute value of a number may be thought of as its distance from\n zero. So for a complex value the absolute value is a real number\n with magnitude **sqrt(x%re\\*\\*2,x%im\\*\\*2)**, as if the real component\n is the x value and the imaginary value is the y value for the point\n \\.\n\n### **Options**\n\n- **a**\n : The value to compute the absolute value of.\n\n### **Result**\n\n If **a** is of type _integer_ or _real_, the value of the result\n is the absolute value **|a|** and of the same type and kind as the\n input argument.\n\n If **a** is _complex_ with value **(x, y)**, the result is a _real_\n equal to a processor-dependent approximation to\n```fortran\n sqrt(x**2 + y**2)\n```\n computed without undue overflow or underflow (that means the\n computation of the result can overflow the allowed magnitude of the\n real value returned, and that very small values can produce underflows\n if they are squared while calculating the returned value, for example).\n\n That is, if you think of non-complex values as being complex values\n on the x-axis and complex values as being x-y points \n the result of **abs** is the (positive) magnitude of the distance\n of the value from the origin.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_abs\nimplicit none\ninteger,parameter :: dp=kind(0.0d0)\n\ninteger :: i = -1\nreal :: x = -1.0\ncomplex :: z = (-3.0,-4.0)\ndoubleprecision :: rr = -45.78_dp\n\ncharacter(len=*),parameter :: &\n ! some formats\n frmt = '(1x,a15,1x,\" In: \",g0, T51,\" Out: \",g0)', &\n frmtc = '(1x,a15,1x,\" In: (\",g0,\",\",g0,\")\",T51,\" Out: \",g0)', &\n g = '(*(g0,1x))'\n\n ! basic usage\n ! any integer, real, or complex type\n write(*, frmt) 'integer ', i, abs(i)\n write(*, frmt) 'real ', x, abs(x)\n write(*, frmt) 'doubleprecision ', rr, abs(rr)\n write(*, frmtc) 'complex ', z, abs(z)\n\n ! You can take the absolute value of any value whose positive value\n ! is representable with the same type and kind.\n write(*, *) 'abs range test : ', abs(huge(0)), abs(-huge(0))\n write(*, *) 'abs range test : ', abs(huge(0.0)), abs(-huge(0.0))\n write(*, *) 'abs range test : ', abs(tiny(0.0)), abs(-tiny(0.0))\n ! A dusty corner is that abs(-huge(0)-1) of an integer would be\n ! a representable negative value on most machines but result in a\n ! positive value out of range.\n\n ! elemental\n write(*, g) ' abs is elemental:', abs([20, 0, -1, -3, 100])\n\n ! COMPLEX input produces REAL output\n write(*, g)' complex input produces real output', &\n & abs(cmplx(30.0_dp,40.0_dp,kind=dp))\n ! dusty corner: \"kind=dp\" is required or the value returned by\n ! CMPLX() is a default real instead of double precision\n\n ! the returned value for complex input can be thought of as the\n ! distance from the origin <0,0>\n write(*, g) ' distance of (', z, ') from zero is', abs( z )\n write(*, g) ' so beware of overflow with complex values'\n write(*, g) abs(cmplx( huge(0.0), huge(0.0) ))\n write(*, g) ' because the biggest default real is',huge(0.0)\n\nend program demo_abs\n```\nResults:\n```text\n integer In: -1 Out: 1\n real In: -1.000000 Out: 1.000000\n doubleprecision In: -45.78000000000000 Out: 45.78000000000000\n complex In: (-3.000000,-4.000000) Out: 5.000000\n abs range test : 2147483647 2147483647\n abs range test : 3.4028235E+38 3.4028235E+38\n abs range test : 1.1754944E-38 1.1754944E-38\n abs is elemental: 20 0 1 3 100\n complex input produces real output 50.00000000000000\n distance of ( -3.000000 -4.000000 ) from zero is 5.000000\n so beware of overflow with complex values\n Inf\n because the biggest default real is .3402823E+39\n```\n### **Standard**\n\n FORTRAN 77\n\n### **See Also**\n\n[**sign**(3)](#sign)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "ABS": "## abs\n\n### **Name**\n\n**abs** - \\[NUMERIC\\] Absolute value\n\n### **Synopsis**\n```fortran\n result = abs(a)\n```\n```fortran\n elemental TYPE(kind=KIND) function abs(a)\n\n TYPE(kind=KIND),intent(in) :: a\n```\n### **Characteristics**\n\n- **a** may be any _real_, _integer_, or _complex_ value.\n\n- If **a** is _complex_ the returned value will be a _real_ with the\n same kind as **a**.\n\n Otherwise the returned type and kind is the same as for **a**.\n\n### **Description**\n\n **abs** computes the absolute value of numeric argument **a**.\n\n In mathematics, the absolute value or modulus of a real number **x**,\n denoted **|x|**, is the magnitude of **x** without regard to its sign.\n\n The absolute value of a number may be thought of as its distance from\n zero. So for a complex value the absolute value is a real number\n with magnitude **sqrt(x%re\\*\\*2,x%im\\*\\*2)**, as if the real component\n is the x value and the imaginary value is the y value for the point\n \\.\n\n### **Options**\n\n- **a**\n : The value to compute the absolute value of.\n\n### **Result**\n\n If **a** is of type _integer_ or _real_, the value of the result\n is the absolute value **|a|** and of the same type and kind as the\n input argument.\n\n If **a** is _complex_ with value **(x, y)**, the result is a _real_\n equal to a processor-dependent approximation to\n```fortran\n sqrt(x**2 + y**2)\n```\n computed without undue overflow or underflow (that means the\n computation of the result can overflow the allowed magnitude of the\n real value returned, and that very small values can produce underflows\n if they are squared while calculating the returned value, for example).\n\n That is, if you think of non-complex values as being complex values\n on the x-axis and complex values as being x-y points \n the result of **abs** is the (positive) magnitude of the distance\n of the value from the origin.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_abs\nimplicit none\ninteger,parameter :: dp=kind(0.0d0)\n\ninteger :: i = -1\nreal :: x = -1.0\ncomplex :: z = (-3.0,-4.0)\ndoubleprecision :: rr = -45.78_dp\n\ncharacter(len=*),parameter :: &\n ! some formats\n frmt = '(1x,a15,1x,\" In: \",g0, T51,\" Out: \",g0)', &\n frmtc = '(1x,a15,1x,\" In: (\",g0,\",\",g0,\")\",T51,\" Out: \",g0)', &\n g = '(*(g0,1x))'\n\n ! basic usage\n ! any integer, real, or complex type\n write(*, frmt) 'integer ', i, abs(i)\n write(*, frmt) 'real ', x, abs(x)\n write(*, frmt) 'doubleprecision ', rr, abs(rr)\n write(*, frmtc) 'complex ', z, abs(z)\n\n ! You can take the absolute value of any value whose positive value\n ! is representable with the same type and kind.\n write(*, *) 'abs range test : ', abs(huge(0)), abs(-huge(0))\n write(*, *) 'abs range test : ', abs(huge(0.0)), abs(-huge(0.0))\n write(*, *) 'abs range test : ', abs(tiny(0.0)), abs(-tiny(0.0))\n ! A dusty corner is that abs(-huge(0)-1) of an integer would be\n ! a representable negative value on most machines but result in a\n ! positive value out of range.\n\n ! elemental\n write(*, g) ' abs is elemental:', abs([20, 0, -1, -3, 100])\n\n ! COMPLEX input produces REAL output\n write(*, g)' complex input produces real output', &\n & abs(cmplx(30.0_dp,40.0_dp,kind=dp))\n ! dusty corner: \"kind=dp\" is required or the value returned by\n ! CMPLX() is a default real instead of double precision\n\n ! the returned value for complex input can be thought of as the\n ! distance from the origin <0,0>\n write(*, g) ' distance of (', z, ') from zero is', abs( z )\n write(*, g) ' so beware of overflow with complex values'\n !write(*, g) abs(cmplx( huge(0.0), huge(0.0) ))\n write(*, g) ' because the biggest default real is',huge(0.0)\n\nend program demo_abs\n```\nResults:\n```text\n integer In: -1 Out: 1\n real In: -1.000000 Out: 1.000000\n doubleprecision In: -45.78000000000000 Out: 45.78000000000000\n complex In: (-3.000000,-4.000000) Out: 5.000000\n abs range test : 2147483647 2147483647\n abs range test : 3.4028235E+38 3.4028235E+38\n abs range test : 1.1754944E-38 1.1754944E-38\n abs is elemental: 20 0 1 3 100\n complex input produces real output 50.00000000000000\n distance of ( -3.000000 -4.000000 ) from zero is 5.000000\n so beware of overflow with complex values\n Inf\n because the biggest default real is .3402823E+39\n```\n### **Standard**\n\n FORTRAN 77\n\n### **See Also**\n\n[**sign**(3)](#sign)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "ACHAR": "## achar\n\n### **Name**\n\n**achar** - \\[CHARACTER:CONVERSION\\] Returns a character in a specified position in the ASCII collating sequence\n\n### **Synopsis**\n```fortran\n result = achar(i [,kind])\n```\n```fortran\n elemental character(len=1,kind=KIND) function achar(i,KIND)\n\n integer(kind=**),intent(in) :: i\n integer(kind=**),intent(in),optional :: KIND\n```\n### **Characteristics**\n\n- a kind designated as ** may be any supported kind for the type\n\n- The _character_ kind returned is the value of **kind** if present.\n otherwise, a single default _character_ is returned.\n\n### **Description**\n\n **achar** returns the character located at position **i** (commonly\n called the _ADE_ or ASCII Decimal Equivalent) in the ASCII collating\n sequence.\n\n The **achar** function is often used for generating in-band escape\n sequences to control terminal attributes, as it makes it easy to print\n unprintable characters such as escape and tab. For example:\n```fortran\n write(*,'(*(a))')achar(27),'[2J'\n```\n will clear the screen on an ANSI-compatible terminal display,\n\n### **Note**\n\nThe ADEs (ASCII Decimal Equivalents) for ASCII are\n```text\n*-------*-------*-------*-------*-------*-------*-------*-------*\n| 00 nul| 01 soh| 02 stx| 03 etx| 04 eot| 05 enq| 06 ack| 07 bel|\n| 08 bs | 09 ht | 10 nl | 11 vt | 12 np | 13 cr | 14 so | 15 si |\n| 16 dle| 17 dc1| 18 dc2| 19 dc3| 20 dc4| 21 nak| 22 syn| 23 etb|\n| 24 can| 25 em | 26 sub| 27 esc| 28 fs | 29 gs | 30 rs | 31 us |\n| 32 sp | 33 ! | 34 \" | 35 # | 36 $ | 37 % | 38 & | 39 ' |\n| 40 ( | 41 ) | 42 * | 43 + | 44 , | 45 - | 46 . | 47 / |\n| 48 0 | 49 1 | 50 2 | 51 3 | 52 4 | 53 5 | 54 6 | 55 7 |\n| 56 8 | 57 9 | 58 : | 59 ; | 60 < | 61 = | 62 > | 63 ? |\n| 64 @ | 65 A | 66 B | 67 C | 68 D | 69 E | 70 F | 71 G |\n| 72 H | 73 I | 74 J | 75 K | 76 L | 77 M | 78 N | 79 O |\n| 80 P | 81 Q | 82 R | 83 S | 84 T | 85 U | 86 V | 87 W |\n| 88 X | 89 Y | 90 Z | 91 [ | 92 \\ | 93 ] | 94 ^ | 95 _ |\n| 96 ` | 97 a | 98 b | 99 c |100 d |101 e |102 f |103 g |\n|104 h |105 i |106 j |107 k |108 l |109 m |110 n |111 o |\n|112 p |113 q |114 r |115 s |116 t |117 u |118 v |119 w |\n|120 x |121 y |122 z |123 { |124 | |125 } |126 ~ |127 del|\n*-------*-------*-------*-------*-------*-------*-------*-------*\n```\n### **Options**\n\n- **i**\n : the _integer_ value to convert to an ASCII character, in the range\n 0 to 127.\n : **achar** shall have the value C for any character\n C capable of representation as a default character.\n\n- **kind**\n : a _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n Assuming **i** has a value in the range 0 <= I <= 127, the result is the\n character in position **i** of the ASCII collating sequence, provided\n the processor is capable of representing that character in the character\n kind of the result; otherwise, the result is processor dependent.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_achar\nuse,intrinsic::iso_fortran_env,only:int8,int16,int32,int64\nimplicit none\ninteger :: i\n i=65\n write(*,'(\"decimal =\",i0)')i\n write(*,'(\"character =\",a1)')achar(i)\n write(*,'(\"binary =\",b0)')achar(i)\n write(*,'(\"octal =\",o0)')achar(i)\n write(*,'(\"hexadecimal =\",z0)')achar(i)\n\n write(*,'(8(i3,1x,a,1x),/)')(i,achar(i), i=32,126)\n\n write(*,'(a)')upper('Mixed Case')\ncontains\n! a classic use of achar(3) is to convert the case of a string\n\npure elemental function upper(str) result (string)\n!\n!$@(#) upper(3f): function to return a trimmed uppercase-only string\n!\n! input string to convert to all uppercase\ncharacter(*), intent(in) :: str\n! output string that contains no miniscule letters\ncharacter(len(str)) :: string\ninteger :: i, iend\ninteger,parameter :: toupper = iachar('A')-iachar('a')\n iend=len_trim(str)\n ! initialize output string to trimmed input string\n string = str(:iend)\n ! process each letter in the string\n do concurrent (i = 1:iend)\n select case (str(i:i))\n ! located miniscule letter\n case ('a':'z')\n ! change miniscule to majuscule letter\n string(i:i) = achar(iachar(str(i:i))+toupper)\n end select\n enddo\nend function upper\nend program demo_achar\n```\nResults:\n```\n decimal =65\n character =A\n binary =1000001\n octal =101\n hexadecimal =41\n 32 33 ! 34 \" 35 # 36 $ 37 % 38 & 39 '\n\n 40 ( 41 ) 42 * 43 + 44 , 45 - 46 . 47 /\n\n 48 0 49 1 50 2 51 3 52 4 53 5 54 6 55 7\n\n 56 8 57 9 58 : 59 ; 60 < 61 = 62 > 63 ?\n\n 64 @ 65 A 66 B 67 C 68 D 69 E 70 F 71 G\n\n 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O\n\n 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W\n\n 88 X 89 Y 90 Z 91 [ 92 \\ 93 ] 94 ^ 95 _\n\n 96 ` 97 a 98 b 99 c 100 d 101 e 102 f 103 g\n\n 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o\n\n 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w\n\n 120 x 121 y 122 z 123 { 124 | 125 } 126 ~\n MIXED CASE\n```\n### **Standard**\n\nFORTRAN 77. KIND argument added Fortran 2003\n\n### **See Also**\n\n[**char**(3)](#char),\n[**iachar**(3)](#iachar),\n[**ichar**(3)](#ichar)\n\n### **Resources**\n\n- [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code)\n- [M_attr module](https://github.com/urbanjost/M_attr) for controlling ANSI-compatible terminals\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "ACOS": "## acos\n\n### **Name**\n\n**acos** - \\[MATHEMATICS:TRIGONOMETRIC\\] Arccosine (inverse cosine) function\n\n### **Synopsis**\n```fortran\n result = acos(x)\n```\n```fortran\n elemental TYPE(kind=KIND) function acos(x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - **TYPE** may be _real_ or _complex_\n - **KIND** may be any kind supported by the associated type.\n - The returned value will be of the same type and kind as the argument.\n\n### **Description**\n\n**acos** computes the arccosine of **x** (inverse of **cos(x)**).\n\n### **Options**\n\n- **x**\n : The value to compute the arctangent of.\n : If the type is _real_, the value must satisfy |**x**| <= 1.\n\n### **Result**\n\nThe return value is of the same type and kind as **x**. The _real_ part of\nthe result is in radians and lies in the range **0 \\<= acos(x%re) \\<= PI** .\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_acos\nuse, intrinsic :: iso_fortran_env, only : real_kinds,real32,real64,real128\nimplicit none\ncharacter(len=*),parameter :: all='(*(g0,1x))'\nreal(kind=real64) :: x , d2r\n\n ! basics\n x = 0.866_real64\n print all,'acos(',x,') is ', acos(x)\n\n ! acos(-1) should be PI\n print all,'for reference &\n &PI ~= 3.14159265358979323846264338327950288419716939937510'\n write(*,*) acos(-1.0_real64)\n d2r=acos(-1.0_real64)/180.0_real64\n print all,'90 degrees is ', d2r*90.0_real64, ' radians'\n ! elemental\n print all,'elemental',acos([-1.0,-0.5,0.0,0.50,1.0])\n ! complex\n print *,'complex',acos( (-1.0, 0.0) )\n print *,'complex',acos( (-1.0, -1.0) )\n print *,'complex',acos( ( 0.0, -0.0) )\n print *,'complex',acos( ( 1.0, 0.0) )\n\nend program demo_acos\n```\nResults:\n```text\n acos( 0.86599999999999999 ) is 0.52364958093182890\n for reference PI ~= 3.14159265358979323846264338327950288419716939937510\n 3.1415926535897931\n 90 degrees is 1.5707963267948966 radians\n elemental 3.14159274 2.09439516 1.57079637 1.04719758 0.00000000\n complex (3.14159274,-0.00000000)\n complex (2.23703575,1.06127501)\n complex (1.57079637,0.00000000)\n complex (0.00000000,-0.00000000)\n```\n### **Standard**\n\nFORTRAN 77 ; for a _complex_ argument - Fortran 2008\n\n### **See Also**\nInverse function: [**cos**(3)](cos)\n\n### **Resources**\n- [wikipedia: inverse trigonometric functions](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "ACOSH": "## acosh\n\n### **Name**\n\n**acosh** - \\[MATHEMATICS:TRIGONOMETRIC\\] Inverse hyperbolic cosine function\n\n### **Synopsis**\n```fortran\n result = acosh(x)\n```\n```fortran\n elemental TYPE(kind=KIND) function acosh(x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - **TYPE** may be _real_ or _complex_\n - **KIND** may be any kind supported by the associated type.\n - The returned value will be of the same type and kind as the argument.\n\n### **Description**\n\n**acosh** computes the inverse hyperbolic cosine of **x** in radians.\n\n### **Options**\n\n- **x**\n : The value to compute the hyperbolic cosine of\n\n### **Result**\n\nThe result has a value equal to a processor-dependent approximation to\nthe inverse hyperbolic cosine function of X.\n\nIf **x** is _complex_, the imaginary part of the result is in radians\nand lies between\n```fortran\n 0 <= aimag(acosh(x)) <= PI\n```\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_acosh\nuse,intrinsic :: iso_fortran_env, only : dp=>real64,sp=>real32\nimplicit none\nreal(kind=dp), dimension(3) :: x = [ 1.0d0, 2.0d0, 3.0d0 ]\n write (*,*) acosh(x)\nend program demo_acosh\n```\nResults:\n```text\n 0.000000000000000E+000 1.31695789692482 1.76274717403909\n```\n### **Standard**\n\nFortran 2008\n\n### **See Also**\nInverse function: [**cosh**(3)](#cosh)\n\n### **Resources**\n- [Wikipedia:hyperbolic functions](https://en.wikipedia.org/wiki/Hyperbolic_functions)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", @@ -51,12 +51,10 @@ "COSH": "## cosh\n\n### **Name**\n\n**cosh** - \\[MATHEMATICS:TRIGONOMETRIC\\] Hyperbolic cosine function\n\n### **Synopsis**\n```fortran\n result = cosh(x)\n```\n```fortran\n elemental TYPE(kind=KIND) function cosh(x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - **TYPE** may be _real_ or _complex_ of any kind.\n - The returned value will be of the same type and kind as the argument.\n\n### **Description**\n\n**cosh** computes the hyperbolic cosine of **x**.\n\nIf **x** is of type complex its imaginary part is regarded as a value\nin radians.\n\n### **Options**\n\n- **x**\n : the value to compute the hyperbolic cosine of\n\n### **Result**\n\n If **x** is _complex_, the imaginary part of the result is in radians.\n\n If **x** is _real_, the return value has a lower bound of one,\n **cosh(x) \\>= 1**.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_cosh\nuse, intrinsic :: iso_fortran_env, only : &\n & real_kinds, real32, real64, real128\nimplicit none\nreal(kind=real64) :: x = 1.0_real64\n write(*,*)'X=',x,'COSH(X=)',cosh(x)\nend program demo_cosh\n```\nResults:\n```text\n > X= 1.00000000000000 COSH(X=) 1.54308063481524\n```\n### **Standard**\n\nFORTRAN 77 , for a complex argument - Fortran 2008\n\n### **See Also**\n\nInverse function: [**acosh**(3)](#acosh)\n\n### **Resources**\n\n- [Wikipedia:hyperbolic functions](https://en.wikipedia.org/wiki/Hyperbolic_functions)\n\n _fortran-lang intrinsic descriptions_\n", "COUNT": "## count\n\n### **Name**\n\n**count** - \\[ARRAY:REDUCTION\\] Count true values in an array\n\n### **Synopsis**\n```fortran\n result = count(mask [,dim] [,kind] )\n```\n```fortran\n integer(kind=KIND) function count(mask, dim, KIND )\n\n logical(kind=**),intent(in) :: mask(..)\n integer(kind=**),intent(in),optional :: dim\n integer(kind=**),intent(in),optional :: KIND\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n - **mask** is a _logical_ array of any shape and kind.\n - If **dim** is present, the result is an array with the specified rank\n removed.\n - **KIND** is a scalar integer constant expression valid as an _integer_ kind\n - The return value is of default _integer_ type unless **kind** is specified\n to declare the kind of the result.\n\n### **Description**\n\n **count** counts the number of _.true._ elements in a logical\n **mask**, or, if the **dim** argument is supplied, counts the number\n of elements along each row of the array in the **dim** direction. If\n the array has zero size or all of the elements of **mask** are false,\n then the result is **0**.\n\n### **Options**\n\n- **mask**\n : an array to count the number of _.true._ values in\n\n- **dim**\n : specifies to remove this dimension from the result and produce an\n array of counts of _.true._ values along the removed dimension.\n If not present, the result is a scalar count of the true elements in **mask**\n the value must be in the range 1 <= dim <= n, where n is the\n rank(number of dimensions) of **mask**.\n\n The corresponding actual argument shall not be an optional dummy\n argument, a disassociated pointer, or an unallocated allocatable.\n\n- **kind**\n : An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\n The return value is the number of _.true_. values in **mask** if **dim**\n is not present.\n\n If **dim** is present, the result is an array with a rank one less\n than the rank of the input array **mask**, and a size corresponding\n to the shape of **array** with the **dim** dimension removed, with the\n remaining elements containing the number of _.true._ elements along the\n removed dimension.\n\n### **Examples**\n\nSample program:\n\n```fortran\n program demo_count\n implicit none\n character(len=*),parameter :: ints='(*(i2,1x))'\n ! two arrays and a mask all with the same shape\n integer, dimension(2,3) :: a, b\n logical, dimension(2,3) :: mymask\n integer :: i\n integer :: c(2,3,4)\n\n print *,'the numeric arrays we will compare'\n a = reshape( [ 1, 2, 3, 4, 5, 6 ], [ 2, 3 ])\n b = reshape( [ 0, 7, 3, 4, 5, 8 ], [ 2, 3 ])\n c = reshape( [( i,i=1,24)], [ 2, 3 ,4])\n print '(3i3)', a(1,:)\n print '(3i3)', a(2,:)\n print *\n print '(3i3)', b(1,:)\n print '(3i3)', b(2,:)\n !\n ! basic calls\n print *, 'count a few basic things creating a mask from an expression'\n print *, 'count a>b',count(a>b)\n print *, 'count b the numeric arrays we will compare\n > 1 3 5\n > 2 4 6\n >\n > 0 3 5\n > 7 4 8\n > count a few basic things creating a mask from an expression\n > count a>b 1\n > count b count b==a 3\n > check sum = T\n > make a mask identifying unequal elements ...\n > the mask generated from a.ne.b\n > T F F\n > T F T\n > count total and along rows and columns ...\n > number of elements not equal\n > (ie. total true elements in the mask)\n > 3\n > count of elements not equal in each column\n > (ie. total true elements in each column)\n > 2 0 1\n > count of elements not equal in each row\n > (ie. total true elements in each row)\n > 1 2\n > lets try this with c(2,3,4)\n > taking the result of the modulo\n > z=1 z=2 z=3 z=4\n > 1 3 0 || 2 4 1 || 3 0 2 || 4 1 3 |\n > 2 4 1 || 3 0 2 || 4 1 3 || 0 2 4 |\n >\n > would result in the mask ..\n > F F T || F F F || F T F || F F F |\n > F F F || F T F || F F F || T F F |\n >\n > the total number of .true.values is\n > 4\n >\n > counting up along a row and removing rows :( 3 4 )\n > > [ 0, 0, 0, 1 ]\n > > [ 0, 1, 1, 0 ]\n > > [ 1, 0, 0, 0 ]\n >\n > counting up along a column and removing columns :( 2 4 )\n > > [ 1, 0, 1, 0 ]\n > > [ 0, 1, 0, 1 ]\n >\n > counting up along a depth and removing depths :( 2 3 )\n > > [ 0, 1, 1 ]\n > > [ 1, 1, 0 ]\n```\n### **Standard**\n\nFortran 95 , with KIND argument - Fortran 2003\n\n### **See Also**\n\n[**any**(3)](#any),\n[**all**(3)](#all),\n[**sum**(3)](#sum),\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "CO_BROADCAST": "## co_broadcast\n\n### **Name**\n\n**co_broadcast** - \\[COLLECTIVE\\] Copy a value to all images the current set of images\n\n### **Synopsis**\n```fortran\n call co_broadcast(a, source_image [,stat] [,errmsg] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_broadcast** copies the value of argument **a** on the image with image\nindex source_image to all images in the current team. **a** becomes defined\nas if by intrinsic assignment. If the execution was successful and **stat**\nis present, it is assigned the value zero. If the execution failed, **stat**\ngets assigned a nonzero value and, if present, **errmsg** gets assigned a\nvalue describing the occurred error.\n\n### **Options**\n\n- **a**\n : **intent(inout)** argument; shall have the same dynamic type and\n type parameters on all images of the current team. If it is an\n array, it shall have the same shape on all images.\n\n- **source_image**\n : a scalar integer expression. It shall have the same the same value\n on all images and refer to an image of the current team.\n\n- **stat**\n : (optional) a scalar integer variable\n\n- **errmsg**\n : (optional) a scalar character variable\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_co_broadcast\nimplicit none\ninteger :: val(3)\n if (this_image() == 1) then\n val = [1, 5, 3]\n endif\n call co_broadcast (val, source_image=1)\n print *, this_image(), \":\", val\nend program demo_co_broadcast\n```\n### **Standard**\n\nFortran xx\n\n### **See Also**\n\n[**co_max**(3)](#co_max),\n[**co_min**(3)](#co_min),\n[**co_sum**(3)](#co_sum),\n[**co_reduce**(3)](#co_reduce)\n\n _fortran-lang intrinsic descriptions_\n", - "CO_LBOUND": "## co_lbound\n\n### **Name**\n\n**co_lbound** - \\[COLLECTIVE\\] Lower codimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = co_lbound( coarray [,dim] [,kind] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_lbound** returns the lower bounds of a coarray, or a single\nlower cobound along the **dim** codimension.\n\n### **Options**\n\n- **array**\n : Shall be an coarray, of any type.\n\n- **dim**\n : (Optional) Shall be a scalar _integer_.\n\n- **kind**\n : (Optional) An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nThe return value is of type _integer_ and of kind **kind**. If **kind** is absent,\nthe return value is of default integer kind. If **dim** is absent, the\nresult is an array of the lower cobounds of **coarray**. If **dim** is present,\nthe result is a scalar corresponding to the lower cobound of the array\nalong that codimension.\n\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**co_ubound**(3)](#co_ubound),\n[**lbound**(3)](#lbound)\n\n _fortran-lang intrinsic descriptions_\n", "CO_MAX": "## co_max\n\n### **Name**\n\n**co_max** - \\[COLLECTIVE\\] Maximal value on the current set of images\n\n### **Synopsis**\n```fortran\n call co_max(a, result_image [,stat] [,errmsg] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_max** determines element-wise the maximal value of **a** on all\nimages of the current team. If result_image is present, the maximum values\nare returned in **a** on the specified image only and the value of **a**\non the other images become undefined. If result_image is not present,\nthe value is returned on all images. If the execution was successful\nand **stat** is present, it is assigned the value zero. If the execution\nfailed, **stat** gets assigned a nonzero value and, if present, **errmsg**\ngets assigned a value describing the occurred error.\n\n### **Options**\n\n- **a**\n : shall be an integer, real or character variable, which has the same\n type and type parameters on all images of the team.\n\n- **result_image**\n : (optional) a scalar integer expression; if present, it shall have\n the same the same value on all images and refer to an image of the\n current team.\n\n- **stat**\n : (optional) a scalar integer variable\n\n- **errmsg**\n : (optional) a scalar character variable\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_co_max\nimplicit none\ninteger :: val\n val = this_image()\n call co_max(val, result_image=1)\n if (this_image() == 1) then\n write(*,*) \"Maximal value\", val ! prints num_images()\n endif\nend program demo_co_max\n```\n\nResults:\n\n```text\n Maximal value 2\n```\n\n### **Standard**\n\nTS 18508\n\n### **See Also**\n\n[**co_min**(3)](#co_min),\n[**co_sum**(3)](#co_sum),\n[**co_reduce**(3)](#co_reduce),\n[**co_broadcast**(3)](#co_broadcast)\n\n _fortran-lang intrinsic descriptions_\n", "CO_MIN": "## co_min\n\n### **Name**\n\n**co_min** - \\[COLLECTIVE\\] Minimal value on the current set of images\n\n### **Synopsis**\n```fortran\n call co_min(a, result_image [,stat] [,errmsg] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_min** determines element-wise the minimal value of **a** on all\nimages of the current team. If result_image is present, the minimal values\nare returned in **a** on the specified image only and the value of **a**\non the other images become undefined. If result_image is not present,\nthe value is returned on all images. If the execution was successful\nand **stat** is present, it is assigned the value zero. If the execution\nfailed, **stat** gets assigned a nonzero value and, if present, **errmsg**\ngets assigned a value describing the occurred error.\n\n### **Options**\n\n- **a**\n : shall be an integer, real or character variable, which has the same\n type and type parameters on all images of the team.\n\n- **result_image**\n : (optional) a scalar integer expression; if present, it shall have\n the same the same value on all images and refer to an image of the\n current team.\n\n- **stat**\n : (optional) a scalar integer variable\n\n- **errmsg**\n : (optional) a scalar character variable\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_co_min\nimplicit none\ninteger :: val\n val = this_image()\n call co_min(val, result_image=1)\n if (this_image() == 1) then\n write(*,*) \"Minimal value\", val ! prints 1\n endif\nend program demo_co_min\n```\n\n### **Standard**\n\nTS 18508\n\n### **See Also**\n\n[**co_max**(3)](#co_max),\n[**co_sum**(3)](#co_sum),\n[**co_reduce**(3)](#co_reduce),\n[**co_broadcast**(3)](#co_broadcast)\n\n _fortran-lang intrinsic descriptions_\n", "CO_REDUCE": "## co_reduce\n\n### **Name**\n\n**co_reduce** - \\[COLLECTIVE\\] Reduction of values on the current set of images\n\n### **Synopsis**\n```fortran\n call co_reduce(a, operation, result_image [,stat] [,errmsg] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_reduce** determines element-wise the reduction of the value of **a** on\nall images of the current team. The pure function passed as **operation** is\nused to pairwise reduce the values of **a** by passing either the value of **a**\nof different images or the result values of such a reduction as\nargument. If **a** is an array, the reduction is done element wise. If\nresult_image is present, the result values are returned in **a** on the\nspecified image only and the value of **a** on the other images become\nundefined. If result_image is not present, the value is returned on all\nimages. If the execution was successful and **stat** is present, it is\nassigned the value zero. If the execution failed, **stat** gets assigned a\nnonzero value and, if present, **errmsg** gets assigned a value describing\nthe occurred error.\n\n### **Options**\n\n- **a**\n : is an **intent(inout)** argument and shall be nonpolymorphic. If it\n is allocatable, it shall be allocated; if it is a pointer, it shall\n be associated. **a** shall have the same type and type parameters on all\n images of the team; if it is an array, it shall have the same shape\n on all images.\n\n- **operation**\n : pure function with two scalar nonallocatable arguments, which shall\n be nonpolymorphic and have the same type and type parameters as **a**.\n The function shall return a nonallocatable scalar of the same type\n and type parameters as **a**. The function shall be the same on all\n images and with regards to the arguments mathematically commutative\n and associative. Note that OPERATION may not be an elemental unless\n it is an intrinsic function.\n\n- **result_image**\n\n : (optional) a scalar integer expression; if present, it shall\n have the same the same value on all images and refer to an image\n of the current team.\n\n- **stat**\n : (optional) a scalar integer variable\n\n- **errmsg**\n : (optional) a scalar character variable\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_co_reduce\nimplicit none\ninteger :: val\n\n val = this_image()\n call co_reduce(val, myprod, 1)\n if (this_image() == 1) then\n write(*,*) \"Product value\", val ! prints num_images() factorial\n endif\n\ncontains\n\npure function myprod(a, b)\n integer, value :: a, b\n integer :: myprod\n myprod = a * b\nend function myprod\n\nend program demo_co_reduce\n```\n\n### **Note**\n\nWhile the rules permit in principle an intrinsic function, none of the\nintrinsics in the standard fulfill the criteria of having a specific\nfunction, which takes two arguments of the same type and returning that\ntype as a result.\n\n### **Standard**\n\nTS 18508\n\n### **See Also**\n\n[**co_min**(3)](#co_min),\n[**co_max**(3)](#co_max),\n[**co_sum**(3)](#co_sum),\n[**co_broadcast**(3)](#co_broadcast)\n\n _fortran-lang intrinsic descriptions_\n", "CO_SUM": "## co_sum\n\n### **Name**\n\n**co_sum** - \\[COLLECTIVE\\] Sum of values on the current set of images\n\n### **Synopsis**\n```fortran\n call co_sum(a, result_image [,stat] [,errmsg] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_sum** sums up the values of each element of **a** on all images\nof the current team.\n\nIf result_image is present, the summed-up values are returned in **a**\non the specified image only and the value of **a** on the other images\nbecome undefined.\n\nIf result_image is not present, the value is returned on all images. If\nthe execution was successful and **stat** is present, it is assigned the\nvalue zero. If the execution failed, **stat** gets assigned a nonzero\nvalue and, if present, **errmsg** gets assigned a value describing the\noccurred error.\n\n### **Options**\n\n- **a**\n : shall be an integer, real or complex variable, which has the same\n type and type parameters on all images of the team.\n\n- **result_image**\n : (optional) a scalar integer expression; if present, it shall have\n the same the same value on all images and refer to an image of the\n current team.\n\n- **stat**\n : (optional) a scalar integer variable\n\n- **errmsg**\n : (optional) a scalar character variable\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_co_sum\nimplicit none\ninteger :: val\n val = this_image()\n call co_sum(val, result_image=1)\n if (this_image() == 1) then\n ! prints (n**2 + n)/2, with n = num_images()\n write(*,*) \"The sum is \", val\n endif\nend program demo_co_sum\n```\n\nResults:\n\n```text\n The sum is 1\n```\n\n### **Standard**\n\nTS 18508\n\n### **See Also**\n\n[**co_max**(3)](#co_max),\n[**co_min**(3)](#co_min),\n[**co_reduce**(3)](#co_reduce),\n[**co_broadcast**(3)](#co_broadcast)\n\n _fortran-lang intrinsic descriptions_\n", - "CO_UBOUND": "## co_ubound\n\n### **Name**\n\n**co_ubound** - \\[COLLECTIVE\\] Upper codimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = co_ubound(coarray [,dim] [,kind] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**co_ubound** returns the upper cobounds of a coarray, or a single\nupper cobound along the **dim** codimension.\n\n### **Options**\n\n- **array**\n : Shall be an coarray, of any type.\n\n- **dim**\n : (Optional) Shall be a scalar _integer_.\n\n- **kind**\n : (Optional) An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nThe return value is of type _integer_ and of kind **kind**. If **kind** is absent,\nthe return value is of default integer kind. If **dim** is absent, the\nresult is an array of the lower cobounds of **coarray**. If **dim** is present,\nthe result is a scalar corresponding to the lower cobound of the array\nalong that codimension.\n\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**co_lbound**(3)](#co_lbound),\n[**lbound**(3)](#lbound),\n[**ubound**(3)](#ubound)\n\n _fortran-lang intrinsic descriptions_\n", "CPU_TIME": "## cpu_time\n\n### **Name**\n\n**cpu_time** - \\[SYSTEM:TIME\\] Return CPU processor time used in seconds\n\n### **Synopsis**\n```fortran\n call cpu_time(time)\n```\n```fortran\n subroutine cpu_time(time)\n\n real,intent(out) :: time\n```\n### **Characteristics**\n\n - **time** is a _real_ of any kind\n\n### **Description**\n\n **cpu_time** returns a _real_ value representing the elapsed CPU time\n in seconds. This is useful for testing segments of code to determine\n execution time.\n\n If no time source is available, **time** is set to a negative value.\n\n The exact definition of time is left imprecise because of the variability\n in what different processors are able to provide.\n\n Note that **time** may contain a system dependent, arbitrary offset and may\n not start with 0.0. For **cpu_time** the absolute value is meaningless.\n Only differences between subsequent calls, as shown in the example below,\n should be used.\n\n PARALLEL PROCESSING\n\n Whether the value assigned is an approximation to the amount of time used\n by the invoking image, or the amount of time used by the whole program,\n is processor dependent.\n\n A processor for which a single result is inadequate (for example, a\n parallel processor) might choose to provide an additional version for\n which **time** is an array.\n\n### **Result**\n\n- **time**\n : is assigned a processor-dependent approximation to the processor\n time in seconds. If the processor cannot return a meaningful time,\n a processor-dependent negative value is returned.\n\n : The start time is left imprecise because the purpose is to time\n sections of code, as in the example. This might or might not\n include system overhead time.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_cpu_time\nuse, intrinsic :: iso_fortran_env, only : real_kinds,real32,real64,real128\nimplicit none\nreal :: start, finish\nreal(kind=real64) :: startd, finishd\n !\n call cpu_time(start)\n call cpu_time(startd)\n ! put code to time here\n call cpu_time(finish)\n call cpu_time(finishd)\n !\n ! writes processor time taken by the piece of code.\n\n ! the accuracy of the clock and whether it includes system time\n ! as well as user time is processor dependent. Accuracy up to\n ! milliseconds is common but not guaranteed, and may be much\n ! higher or lower\n print '(\"Processor Time = \",f6.3,\" seconds.\")',finish-start\n\n ! see your specific compiler documentation for how to measure\n ! parallel jobs and for the precision of the time returned\n print '(\"Processor Time = \",g0,\" seconds.\")',finish-start\n print '(\"Processor Time = \",g0,\" seconds.\")',finishd-startd\nend program demo_cpu_time\n```\nResults:\n\n The precision of the result, some aspects of what is returned,\n and what if any options there are for parallel applications\n may very from system to system. See compiler-specific for details.\n```text\n Processor Time = 0.000 seconds.\n Processor Time = .4000030E-05 seconds.\n Processor Time = .2000000000000265E-05 seconds.\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**system_clock**(3)](#system_clock),\n[**date_and_time**(3)](#date_and_time)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "CSHIFT": "## cshift\n\n### **Name**\n\n**cshift** - \\[TRANSFORMATIONAL\\] Circular shift elements of an array\n\n### **Synopsis**\n```fortran\n result = cshift(array, shift [,dim])\n```\n```fortran\n type(TYPE, kind=KIND) function cshift(array, shift, dim )\n\n type(TYPE,kind=KIND),intent(in) :: array(..)\n integer(kind=**),intent(in) :: shift\n integer(kind=**),intent(in) :: dim\n```\n### **Characteristics**\n\n - **array** may be any type and rank\n - **shift** an _integer_ scalar if **array** has rank one.\n Otherwise, it shall be scalar or of rank n-1 and of shape [d1, d2,\n ..., dDIM-1, dDIM+1, ..., dn] where [d1, d2, ..., dn] is the shape\n of **array**.\n - **dim** is an _integer_ scalar with a value in the range 1 <= **dim**\n <= n, where n is the rank of **array**.\n If **dim** is absent, it is as if it were present with the value 1.\n - the result will automatically be of the same type, kind and shape as **array**.\n\n NOTE:\n :a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n **cshift** performs a circular shift on elements\n of **array** along the dimension of **dim**. If **dim** is omitted it is\n taken to be **1**. **dim** is a scalar of type _integer_ in the range of\n **1 \\<= dim \\<= n**, where \"n\" is the rank of **array**.\n\n If the rank of\n **array** is one, then all elements of **array** are shifted by **shift**\n places. If rank is greater than one, then all complete rank one sections\n of **array** along the given dimension are shifted. Elements shifted\n out one end of each rank one section are shifted back in the other end.\n\n### **Options**\n\n- **array**\n : An array of any type which is to be shifted\n\n- **shift**\n : the number of positions to circularly shift. A negative value produces\n a right shift, a positive value produces a left shift.\n\n- **dim**\n : the dimension along which to shift a multi-rank **array**. Defaults\n to 1.\n\n### **Result**\n\nReturns an array of same type and rank as the **array** argument.\n\nThe rows of an array of rank two may all be shifted by the same amount\nor by different amounts.\n\n## cshift\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_cshift\nimplicit none\ninteger, dimension(5) :: i1,i2,i3\ninteger, dimension(3,4) :: a, b\n !basics\n i1=[10,20,30,40,50]\n print *,'start with:'\n print '(1x,5i3)', i1\n print *,'shift -2'\n print '(1x,5i3)', cshift(i1,-2)\n print *,'shift +2'\n print '(1x,5i3)', cshift(i1,+2)\n\n print *,'start with a matrix'\n a = reshape( [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], [ 3, 4 ])\n print '(4i3)', a(1,:)\n print '(4i3)', a(2,:)\n print '(4i3)', a(3,:)\n print *,'matrix shifted along rows, each by its own amount [-1,0,1]'\n b = cshift(a, SHIFT=[1, 0, -1], DIM=2)\n print *\n print '(4i3)', b(1,:)\n print '(4i3)', b(2,:)\n print '(4i3)', b(3,:)\nend program demo_cshift\n```\nResults:\n```text\n > start with:\n > 10 20 30 40 50\n > shift -2\n > 40 50 10 20 30\n > shift +2\n > 30 40 50 10 20\n > start with a matrix\n > 1 4 7 10\n > 2 5 8 11\n > 3 6 9 12\n > matrix shifted along rows, each by its own amount\n >\n > 4 7 10 1\n > 2 5 8 11\n > 12 3 6 9\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n - [**eoshift**(3)](#eoshift) - End-off shift elements of an array\n \n - [**sum**(3)](#sum) - sum the elements of an array\n - [**product**(3)](#product) - Product of array elements\n - [**findloc**(3)](#findloc) - Location of first element of ARRAY identified by MASK along dimension DIM having a value\n - [**maxloc**(3)](#maxloc) - Location of the maximum value within an array\n\n _fortran-lang intrinsic descriptions_\n", "C_ASSOCIATED": "## c_associated\n\n### **Name**\n\n**c_associated** - \\[ISO_C_BINDING\\] Status of a C pointer\n\n### **Synopsis**\n```fortran\n result = c_associated(c_prt_1, [c_ptr_2] )\n```\n```fortran\n logical function c_associated(c_prt_1, cptr_2)\n\n TYPE,intent(in) ::c_ptr_1\n TYPE,intent(in),optional ::c_ptr_2\n```\n### **Characteristics**\n\n- **c_ptr_1** is a scalar of the type c_ptr or c_funptr.\n- **c_ptr_2** is a scalar of the same type as c_ptr_1.\n- The return value is of type _logical_\n\n### **Description**\n\n**c_associated** determines the status of the\nC pointer c_ptr_1 or if c_ptr_1 is associated with the target\nc_ptr_2.\n\n### **Options**\n\n- **c_ptr_1**\n : C pointer to test for being a C NULL pointer, or to test if\n pointing to the same association as **c_ptr_2** when present.\n\n- **c_ptr_2**\n : C pointer to test for shared association with **c_ptr_1**\n\n### **Result**\n\nThe return value is of type _logical_; it is _.false_. if either c_ptr_1\nis a C NULL pointer or if c_ptr1 and c_ptr_2 point to different\naddresses.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_c_associated\n\ncontains\n\nsubroutine association_test(a,b)\nuse iso_c_binding, only: c_associated, c_loc, c_ptr\nimplicit none\nreal, pointer :: a\ntype(c_ptr) :: b\n if(c_associated(b, c_loc(a))) &\n stop 'b and a do not point to same target'\nend subroutine association_test\n\nend program demo_c_associated\n```\n\n### **Standard**\n\nFortran 2003\n\n### **See Also**\n\n[**c_loc**(3)](#c_loc),\n[**c_funloc**(3)](#c_funloc),\n**iso_c_binding**(3)\n\n _fortran-lang intrinsic descriptions_\n", @@ -90,7 +88,7 @@ "GET_COMMAND": "## get_command\n\n### **Name**\n\n**get_command** - \\[SYSTEM:COMMAND LINE\\] Get the entire command line invocation\n\n### **Synopsis**\n```fortran\n call get_command([command] [,length] [,status] [,errmsg])\n```\n```fortran\n subroutine get_command( command ,length ,status, errmsg )\n\n character(len=*),intent(out),optional :: command\n integer(kind=**),intent(out),optional :: length\n integer(kind=**),intent(out),optional :: status\n character(len=*),intent(inout),optional :: errmsg\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n meeting the conditions described herein.\n - **command** and **errmsg** are scalar _character_ variables of default kind.\n - **length** and **status** are scalar _integer_ with a decimal exponent\n range of at least four.\n\n### **Description**\n\n**get_command** retrieves the entire command line that was used to\ninvoke the program.\n\nNote that what is typed on the command line is often processed by\na shell. The shell typically processes special characters and white\nspace before passing it to the program. The processing can typically be\nturned off by turning off globbing or quoting the command line arguments\nand/or changing the default field separators, but this should rarely\nbe necessary.\n\n### **Result**\n\n- **command**\n : If **command** is present, the entire command line that was used\n to invoke the program is stored into it. If the command cannot be\n determined, **command** is assigned all blanks.\n\n- **length**\n : If **length** is present, it is assigned the length of the command line.\n It is system-dependent as to whether trailing blanks will be counted.\n : If the command length cannot be determined, a length of 0 is assigned.\n\n- **status**\n : If **status** is present, it is assigned 0 upon success of the\n command, **-1** if **command** is too short to store the command line,\n or a positive value in case of an error.\n\n- **errmsg**\n : It is assigned a processor-dependent explanatory message if the\n command retrieval fails. Otherwise, it is unchanged.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_get_command\nimplicit none\ninteger :: command_line_length\ncharacter(len=:),allocatable :: command_line\n ! get command line length\n call get_command(length=command_line_length)\n ! allocate string big enough to hold command line\n allocate(character(len=command_line_length) :: command_line)\n ! get command line as a string\n call get_command(command=command_line)\n ! trim leading spaces just in case\n command_line=adjustl(command_line)\n write(*,'(\"OUTPUT:\",a)')command_line\nend program demo_get_command\n```\nResults:\n```bash\n # note that shell expansion removes some of the whitespace\n # without quotes\n ./test_get_command arguments on command line to echo\n\n OUTPUT:./test_get_command arguments on command line to echo\n\n # using the bash shell with single quotes\n ./test_get_command 'arguments *><`~[]!{}?\"\\'| '\n\n OUTPUT:./test_get_command arguments *><`~[]!{}?\"'|\n```\n### **Standard**\n\nFortran 2003\n\n### **See Also**\n\n[**get_command_argument**(3)](#get_command_argument),\n[**command_argument_count**(3)](#command_argument_count)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n#\n", "GET_COMMAND_ARGUMENT": "## get_command_argument\n\n### **Name**\n\n**get_command_argument** - \\[SYSTEM:COMMAND LINE\\] Get command line arguments\n\n### **Synopsis**\n```fortran\n call get_command_argument(number [,value] [,length] &\n & [,status] [,errmsg])\n```\n```fortran\n subroutine get_command_argument( number, value, length, &\n & status ,errmsg)\n\n integer(kind=**),intent(in) :: number\n character(len=*),intent(out),optional :: value\n integer(kind=**),intent(out),optional :: length\n integer(kind=**),intent(out),optional :: status\n character(len=*),intent(inout),optional :: errmsg\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n meeting the conditions described herein.\n - **number**, **length**, and **status** are scalar _integer_\n with a decimal exponent range of at least four.\n - **value** and **errmsg** are scalar _character_ variables of default\n kind.\n\n### **Description**\n\n**get_command_argument** retrieves or queries the n-th argument that\nwas passed on the command line to the current program execution.\n\nThere is not anything specifically stated about what an argument is but\nin practice the arguments are strings split on whitespace unless the\narguments are quoted. IFS values (Internal Field Separators) used by\ncommon shells are typically ignored and unquoted whitespace is almost\nalways the separator.\n\nShells have often expanded command arguments and spell characters before\npassing them to the program, so the strings read are often not exactly\nwhat the user typed on the command line.\n\n### **Options**\n\n- **number**\n : is a non-negative number indicating which argument of the current\n program command line is to be retrieved or queried.\n : If **number = 0**, the argument pointed to is set to the name of the\n program (on systems that support this feature).\n : if the processor does not have such a concept as a command name the\n value of command argument 0 is processor dependent.\n : For values from 1 to the number of arguments passed to the program a\n value is returned in an order determined by the processor. Conventionally\n they are returned consecutively as they appear on the command line from\n left to right.\n\n### **Result**\n\n- **value**\n : The **value** argument holds the command line argument.\n If **value** can not hold the argument, it is truncated to fit the\n length of **value**.\n : If there are less than **number** arguments specified at the command\n line or if the argument specified does not exist for other reasons,\n **value** will be filled with blanks.\n\n- **length**\n : The **length** argument contains the length of the n-th command\n line argument. The length of **value** has no effect on this value,\n It is the length required to hold all the significant characters of\n the argument regardless of how much storage is provided by **value**.\n\n- **status**\n : If the argument retrieval fails, **status** is a positive number;\n if **value** contains a truncated command line argument, **status**\n is **-1**; and otherwise the **status** is zero.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_get_command_argument\nimplicit none\ncharacter(len=255) :: progname\ninteger :: count, i, argument_length, istat\ncharacter(len=:),allocatable :: arg\n\n ! command name assuming it is less than 255 characters in length\n call get_command_argument (0, progname, status=istat)\n if (istat == 0) then\n print *, \"The program's name is \" // trim (progname)\n else\n print *, \"Could not get the program's name \" // trim (progname)\n endif\n\n ! get number of arguments\n count = command_argument_count()\n write(*,*)'The number of arguments is ',count\n\n !\n ! allocate string array big enough to hold command line\n ! argument strings and related information\n !\n do i=1,count\n call get_command_argument(number=i,length=argument_length)\n if(allocated(arg))deallocate(arg)\n allocate(character(len=argument_length) :: arg)\n call get_command_argument(i, arg,status=istat)\n ! show the results\n write (*,'(i3.3,1x,i0.5,1x,i0.5,1x,\"[\",a,\"]\")') &\n & i,istat,argument_length,arg\n enddo\n\nend program demo_get_command_argument\n```\nResults:\n```bash\n ./demo_get_command_argument a test 'of getting arguments ' \" leading\"\n```\n```text\n The program's name is ./demo_get_command_argument\n The number of arguments is 4\n001 00000 00001 [a]\n002 00000 00004 [test]\n003 00000 00022 [of getting arguments ]\n004 00000 00008 [ leading]\n```\n### **Standard**\n\nFortran 2003\n\n### **See Also**\n\n[**get_command**(3)](#get_command),\n[**command_argument_count**(3)](#command_argument_count)\n\n_fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n#\n", "GET_ENVIRONMENT_VARIABLE": "## get_environment_variable\n\n### **Name**\n\n**get_environment_variable** - \\[SYSTEM:ENVIRONMENT\\] Get value of an environment variable\n\n### **Synopsis**\n```fortran\n call get_environment_variable(name [,value] [,length] &\n & [,status] [,trim_name] [,errmsg] )\n```\n```fortran\n subroutine character(len=*) get_environment_variable( &\n & name, value, length, status, trim_name, errmsg )\n\n character(len=*),intent(in) :: name\n character(len=*),intent(out),optional :: value\n integer(kind=**),intent(out),optional :: length\n integer(kind=**),intent(out),optional :: status\n logical,intent(out),optional :: trim_name\n character(len=*),intent(inout),optional :: errmsg\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n meeting the conditions described herein.\n - **name**, **value**, and **errmsg** are a scalar _character_ of\n default kind.\n - **length** and **status** are _integer_ scalars with a decimal exponent\n range of at least four.\n - **trim_name** is a scalar of type _logical_ and of default kind.\n\n### **Description**\n\n**get_environment_variable** gets the **value** of the environment\nvariable **name**.\n\nNote that **get_environment_variable** need not be thread-safe. It\nis the responsibility of the user to ensure that the environment is not\nbeing updated concurrently.\n\nIf running in parallel be aware\nIt is processor dependent whether an environment variable that exists\non an image also exists on another image, and if it does exist on both\nimages whether the values are the same or different.\n\n### **Options**\n\n- **name**\n : The name of the environment variable to query.\n The interpretation of case is processor dependent.\n\n### **Result**\n\n- **value**\n : The value of the environment variable being queried. If **value**\n is not large enough to hold the data, it is truncated. If the variable\n **name** is not set or has no value, or the processor does not support\n environment variables **value** will be filled with blanks.\n\n- **length**\n : Argument **length** contains the length needed for storing the\n environment variable **name**. It is zero if the environment variable\n is not set.\n\n- **status**\n : **status** is **-1** if **value** is present but too short for the\n environment variable; it is **1** if the environment variable does\n not exist and **2** if the processor does not support environment\n variables; in all other cases **status** is zero.\n\n- **trim_name**\n : If **trim_name** is present with the value _.false._, the trailing\n blanks in **name** are significant; otherwise they are not part of\n the environment variable name.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_getenv\nimplicit none\ncharacter(len=:),allocatable :: homedir\ncharacter(len=:),allocatable :: var\n\n var='HOME'\n homedir=get_env(var)\n write (*,'(a,\"=\"\"\",a,\"\"\"\")')var,homedir\n\ncontains\n\nfunction get_env(name,default) result(value)\n! a function that makes calling get_environment_variable(3) simple\nimplicit none\ncharacter(len=*),intent(in) :: name\ncharacter(len=*),intent(in),optional :: default\ncharacter(len=:),allocatable :: value\ninteger :: howbig\ninteger :: stat\ninteger :: length\n length=0\n value=''\n if(name.ne.'')then\n call get_environment_variable( name, &\n & length=howbig,status=stat,trim_name=.true.)\n select case (stat)\n case (1)\n print *, name, \" is not defined in the environment. Strange...\"\n value=''\n case (2)\n print *, &\n \"This processor does not support environment variables. Boooh!\"\n value=''\n case default\n ! make string of sufficient size to hold value\n if(allocated(value))deallocate(value)\n allocate(character(len=max(howbig,1)) :: value)\n ! get value\n call get_environment_variable( &\n & name,value,status=stat,trim_name=.true.)\n if(stat.ne.0)value=''\n end select\n endif\n if(value.eq.''.and.present(default))value=default\nend function get_env\n\nend program demo_getenv\n```\nTypical Results:\n```text\n HOME=\"/home/urbanjs\"\n```\n### **Standard**\n\nFortran 2003\n\n### **See also**\n\n[**get_command_argument**(3)](#get_command_argument),\n[**get_command**(3)](#get_command)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n#\n", - "HUGE": "## huge\n\n### **Name**\n\n**huge** - \\[NUMERIC MODEL\\] Largest number of a type and kind\n\n### **Synopsis**\n```fortran\n result = huge(x)\n```\n```fortran\n TYPE(kind=KIND) function huge(x)\n\n TYPE(kind=KIND),intent(in) :: x(..)\n```\n### **Characteristics**\n\n - **x** may be any _real_ or _integer_ scalar or array and any kind.\n - The result will be a scalar of the same type and kind as the input **x**\n\n### **Description**\n\n **huge** returns the largest number that is not an overflow\n for the kind and type of **x**.\n\n### **Options**\n\n- **x**\n : **x** is an arbitrary value which is used merely to determine what\n _kind_ and _type_ of scalar is being queried. It need not be defined,\n as only its characteristics are used.\n\n### **Result**\n\n The result is the largest value supported by the specified type\n and kind.\n\n Note the result is as the same kind as the input to ensure the returned\n value does not overflow. Any assignment of the result to a variable\n should take this into consideration.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_huge\nimplicit none\ncharacter(len=*),parameter :: f='(i2,1x,2(i11,1x),f14.0:,1x,l1,1x,a)'\ninteger :: i,j,k,biggest\nreal :: v, w\n ! basic\n print *, huge(0), huge(0.0), huge(0.0d0)\n print *, tiny(0.0), tiny(0.0d0)\n\n ! advanced\n biggest=huge(0)\n ! be careful of overflow when using integers in computation\n do i=1,14\n j=6**i ! Danger, Danger\n w=6**i ! Danger, Danger\n v=6.0**i\n k=v ! Danger, Danger\n if(v.gt.biggest)then\n write(*,f) i, j, k, v, v.eq.w, 'wrong j and k and w'\n else\n write(*,f) i, j, k, v, v.eq.w\n endif\n enddo\nend program demo_huge\n```\nResults:\n```\n 2147483647 3.4028235E+38 1.797693134862316E+308\n 1.1754944E-38 2.225073858507201E-308\n\n 1 6 6 6. T\n 2 36 36 36. T\n 3 216 216 216. T\n 4 1296 1296 1296. T\n 5 7776 7776 7776. T\n 6 46656 46656 46656. T\n 7 279936 279936 279936. T\n 8 1679616 1679616 1679616. T\n 9 10077696 10077696 10077696. T\n 10 60466176 60466176 60466176. T\n 11 362797056 362797056 362797056. T\n 12 -2118184960 -2147483648 2176782336. F wrong for j and k and w\n 13 175792128 -2147483648 13060694016. F wrong for j and k and w\n 14 1054752768 -2147483648 78364164096. F wrong for j and k and w\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**digits**(3)](#digits),\n[**epsilon**(3)](#epsilon),\n[**exponent**(3)](#exponent),\n[**fraction**(3)](#fraction),\n[**maxexponent**(3)](#maxexponent),\n[**minexponent**(3)](#minexponent),\n[**nearest**(3)](#nearest),\n[**precision**(3)](#precision),\n[**radix**(3)](#radix),\n[**range**(3)](#range),\n[**rrspacing**(3)](#rrspacing),\n[**scale**(3)](#scale),\n[**set_exponent**(3)](#set_exponent),\n[**spacing**(3)](#spacing),\n[**tiny**(3)](#tiny)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "HUGE": "## huge\n\n### **Name**\n\n**huge** - \\[NUMERIC MODEL\\] Largest number of a type and kind\n\n### **Synopsis**\n```fortran\n result = huge(x)\n```\n```fortran\n TYPE(kind=KIND) function huge(x)\n\n TYPE(kind=KIND),intent(in) :: x(..)\n```\n### **Characteristics**\n\n - **x** may be any _real_ or _integer_ scalar or array and any kind.\n - The result will be a scalar of the same type and kind as the input **x**\n\n### **Description**\n\n **huge** returns the largest number that is not an overflow\n for the kind and type of **x**.\n\n### **Options**\n\n- **x**\n : **x** is an arbitrary value which is used merely to determine what\n _kind_ and _type_ of scalar is being queried. It need not be defined,\n as only its characteristics are used.\n\n### **Result**\n\n The result is the largest value supported by the specified type\n and kind.\n\n Note the result is as the same kind as the input to ensure the returned\n value does not overflow. Any assignment of the result to a variable\n should take this into consideration.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_huge\nimplicit none\ncharacter(len=*),parameter :: f='(i2,1x,2(i11,1x),f14.0:,1x,l1,1x,a)'\ninteger :: i,j,k,biggest\nreal :: v, w\n ! basic\n print *, huge(0), huge(0.0), huge(0.0d0)\n print *, tiny(0.0), tiny(0.0d0)\n\n sum=0.0d0\n ! note subtracting one because counter is the end value+1 on exit\n do i=0,huge(0)-1\n sum=sum+i\n enddo\n write(*,*)'sum=',sum\n\n ! advanced\n biggest=huge(0)\n ! be careful of overflow when using integers in computation\n do i=1,14\n j=6**i ! Danger, Danger\n w=6**i ! Danger, Danger\n v=6.0**i\n k=v ! Danger, Danger\n\n if(v.gt.biggest)then\n write(*,f) i, j, k, v, v.eq.w, 'wrong j and k and w'\n else\n write(*,f) i, j, k, v, v.eq.w\n endif\n\n enddo\nend program demo_huge\n```\nResults:\n```\n 2147483647 3.4028235E+38 1.797693134862316E+308\n 1.1754944E-38 2.225073858507201E-308\n\n 1 6 6 6. T\n 2 36 36 36. T\n 3 216 216 216. T\n 4 1296 1296 1296. T\n 5 7776 7776 7776. T\n 6 46656 46656 46656. T\n 7 279936 279936 279936. T\n 8 1679616 1679616 1679616. T\n 9 10077696 10077696 10077696. T\n 10 60466176 60466176 60466176. T\n 11 362797056 362797056 362797056. T\n 12 -2118184960 -2147483648 2176782336. F wrong for j and k and w\n 13 175792128 -2147483648 13060694016. F wrong for j and k and w\n 14 1054752768 -2147483648 78364164096. F wrong for j and k and w\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**digits**(3)](#digits),\n[**epsilon**(3)](#epsilon),\n[**exponent**(3)](#exponent),\n[**fraction**(3)](#fraction),\n[**maxexponent**(3)](#maxexponent),\n[**minexponent**(3)](#minexponent),\n[**nearest**(3)](#nearest),\n[**precision**(3)](#precision),\n[**radix**(3)](#radix),\n[**range**(3)](#range),\n[**rrspacing**(3)](#rrspacing),\n[**scale**(3)](#scale),\n[**set_exponent**(3)](#set_exponent),\n[**spacing**(3)](#spacing),\n[**tiny**(3)](#tiny)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "HYPOT": "## hypot\n\n### **Name**\n\n**hypot** - \\[MATHEMATICS\\] Returns the Euclidean distance - the distance between a point and the origin.\n\n### **Synopsis**\n```fortran\n result = hypot(x, y)\n```\n```fortran\n elemental real(kind=KIND) function hypot(x,y)\n\n real(kind=KIND),intent(in) :: x\n real(kind=KIND),intent(in) :: y\n```\n### **Characteristics**\n\n - **x,y** and the result shall all be _real_ and of the same **kind**.\n\n### **Description**\n\n**hypot** is referred to as the Euclidean distance function. It is\nequal to\n```fortran\nsqrt(x**2+y**2)\n```\nwithout undue underflow or overflow.\n\nIn mathematics, the _Euclidean distance_ between two points in Euclidean\nspace is the length of a line segment between two points.\n\n**hypot(x,y)** returns the distance between the point **** and\nthe origin.\n\n### **Options**\n\n- **x**\n: The type shall be _real_.\n\n- **y**\n : The type and kind type parameter shall be the same as **x**.\n\n### **Result**\n\nThe return value has the same type and kind type parameter as **x**.\n\nThe result is the positive magnitude of the distance of the point\n**** from the origin **<0.0,0.0>** .\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_hypot\nuse, intrinsic :: iso_fortran_env, only : &\n & real_kinds, real32, real64, real128\nimplicit none\nreal(kind=real32) :: x, y\nreal(kind=real32),allocatable :: xs(:), ys(:)\ninteger :: i\ncharacter(len=*),parameter :: f='(a,/,SP,*(3x,g0,1x,g0:,/))'\n\n x = 1.e0_real32\n y = 0.5e0_real32\n\n write(*,*)\n write(*,'(*(g0))')'point <',x,',',y,'> is ',hypot(x,y)\n write(*,'(*(g0))')'units away from the origin'\n write(*,*)\n\n ! elemental\n xs=[ x, x**2, x*10.0, x*15.0, -x**2 ]\n ys=[ y, y**2, -y*20.0, y**2, -y**2 ]\n\n write(*,f)\"the points\",(xs(i),ys(i),i=1,size(xs))\n write(*,f)\"have distances from the origin of \",hypot(xs,ys)\n write(*,f)\"the closest is\",minval(hypot(xs,ys))\n\nend program demo_hypot\n```\n\nResults:\n\n```text\n point <1.00000000,0.500000000> is 1.11803401\n units away from the origin\n\n the points\n +1.00000000 +0.500000000\n +1.00000000 +0.250000000\n +10.0000000 -10.0000000\n +15.0000000 +0.250000000\n -1.00000000 -0.250000000\n have distances from the origin of\n +1.11803401 +1.03077638\n +14.1421356 +15.0020828\n +1.03077638\n the closest is\n +1.03077638\n```\n### **Standard**\n\nFortran 2008\n\n### **See also**\n\n[****(3)](#)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "IACHAR": "## iachar\n\n### **Name**\n\n**iachar** - \\[CHARACTER:CONVERSION\\] Return integer ASCII code of a character\n\n### **Synopsis**\n```fortran\n result = iachar(c [,kind])\n```\n```fortran\n elemental integer(kind=KIND) function iachar(c,kind)\n\n character(len=1),intent(in) :: c\n integer(kind=**),intent(in),optional :: KIND\n```\n### **Characteristics**\n\n - **c** is a single character\n - The return value is of type _integer_ and of kind **KIND**. If **KIND**\n is absent, the return value is of default integer kind.\n\n NOTE:\n : a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n **iachar** returns the code for the ASCII character in the first\n character position of C.\n\n### **Options**\n\n- **c**\n : A character to determine the ASCII code of.\n : A common extension is to allow strings but all but the first character\n is then ignored.\n\n- **kind**\n : A constant initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\n the result is the position of the character **c** in the ASCII\n collating sequence. It is nonnegative and less than or equal to 127.\n\n By ASCII, it is meant that **c** is in the collating sequence defined\n by the codes specified in ISO/IEC 646:1991 (International Reference\n Version).\n\n The value of the result is processor dependent if **c** is not in the\n ASCII collating sequence.\n\n The results are consistent with the **lge**(3), **lgt**(3), **lle**(3),\n and **llt**(3) comparison functions. For example, if **lle(C, D)**\n is true, **iachar(C) <= iachar (D)** is true where **C** and **D**\n are any two characters representable by the processor.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_iachar\nimplicit none\n ! basic usage\n ! just does a string one character long\n write(*,*)iachar('A')\n ! elemental: can do an array of letters\n write(*,*)iachar(['A','Z','a','z'])\n\n ! convert all characters to lowercase\n write(*,'(a)')lower('abcdefg ABCDEFG')\ncontains\n!\npure elemental function lower(str) result (string)\n! Changes a string to lowercase\ncharacter(*), intent(In) :: str\ncharacter(len(str)) :: string\ninteger :: i\n string = str\n ! step thru each letter in the string in specified range\n do i = 1, len(str)\n select case (str(i:i))\n case ('A':'Z') ! change letter to miniscule\n string(i:i) = char(iachar(str(i:i))+32)\n case default\n end select\n end do\nend function lower\n!\nend program demo_iachar\n```\nResults:\n```text\n 65\n 65 90 97 122\n abcdefg abcdefg\n```\n### **Standard**\n\n Fortran 95 , with KIND argument - Fortran 2003\n\n### **See Also**\n\n[**achar**(3)](#achar),\n[**char**(3)](#char),\n[**ichar**(3)](#ichar)\n\n See [**ichar**(3)](#ichar) in particular for a discussion of converting\n between numerical values and formatted string representations.\n\n Functions that perform operations on character strings, return lengths\n of arguments, and search for certain arguments:\n\n- **Elemental:**\n [**adjustl**(3)](#adjustl), [**adjustr**(3)](#adjustr), [**index**(3)](#index),\n [**scan**(3)](#scan), [**verify**(3)](#verify)\n\n- **Nonelemental:**\n [**len_trim**(3)](#len_trim),\n [**len**(3)](#len),\n [**repeat**(3)](#repeat), [**trim**(3)](#trim)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "IALL": "## iall\n\n### **Name**\n\n**iall** - \\[BIT:LOGICAL\\] Bitwise and of array elements\n\n### **Synopsis**\n```fortran\n result = iall(array [,mask]) | iall(array ,dim [,mask])\n```\n```fortran\n integer(kind=KIND) function iall(array,dim,mask)\n\n integer(kind=KIND),intent(in) :: array(*)\n integer(kind=**),intent(in),optional :: dim\n logical(kind=**),intent(in),optional :: mask(*)\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n - **array** must be an _integer_ array\n - **mask** is a _logical_ array that conforms to **array** of any\n _logical_ kind.\n - **dim** may be of any _integer_ kind.\n - The result will by of the same type and kind as **array**.\n\n### **Description**\n\n **iall** reduces with a bitwise _and_ the elements of **array** along\n dimension **dim** if the corresponding element in **mask** is _.true._.\n\n### **Options**\n\n- **array**\n : Shall be an array of type _integer_\n\n- **dim**\n : (Optional) shall be a scalar of type _integer_ with a value in the\n range from **1 to n**, where **n** equals the rank of **array**.\n\n- **mask**\n : (Optional) shall be of type _logical_ and either be a scalar or an\n array of the same shape as **array**.\n\n### **Result**\n\n The result is of the same type as **array**.\n\n If **dim** is absent, a scalar with the bitwise _all_ of all elements in\n **array** is returned. Otherwise, an array of rank **n-1**, where **n**\n equals the rank of **array**, and a shape similar to that of **array**\n with dimension **dim** dropped is returned.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_iall\nuse, intrinsic :: iso_fortran_env, only : integer_kinds, &\n & int8, int16, int32, int64\nimplicit none\ninteger(kind=int8) :: a(2)\n\n a(1) = int(b'00100100')\n a(2) = int(b'01101010')\n\n print '(b8.8)', iall(a)\n\nend program demo_iall\n```\nResults:\n```text\n > 00100000\n```\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**iany**(3)](#iany),\n[**iparity**(3)](#iparity),\n[**iand**(3)](#iand)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", @@ -112,7 +110,8 @@ "IS_IOSTAT_END": "## is_iostat_end\n\n### **Name**\n\n**is_iostat_end** - \\[STATE:INQUIRY\\] Test for end-of-file value\n\n### **Synopsis**\n```fortran\n result = is_iostat_end(i)\n```\n```fortran\n elemental logical function is_iostat_end(i)\n\n integer,intent(in) :: i\n```\n### **Characteristics**\n\n - **i** is _integer_ of any kind\n - the return value is a default _logical_\n\n### **Description**\n\n**is_iostat_end** tests whether a variable (assumed returned as a status\nfrom an I/O statement) has the \"end of file\" I/O status value.\n\nThe function is equivalent to comparing the variable with the\n**iostat_end** parameter of the intrinsic module **iso_fortran_env**.\n\n### **Options**\n\n- **i**\n : An _integer_ status value to test if indicating end of file.\n\n### **Result**\n\nreturns _.true._ if and only if**i** has the value\nwhich indicates an end of file condition for **iostat=** specifiers, and is\n_.false._ otherwise.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_iostat\nimplicit none\nreal :: value\ninteger :: ios\ncharacter(len=256) :: message\n write(*,*)'Begin entering numeric values, one per line'\n do\n read(*,*,iostat=ios,iomsg=message)value\n if(ios.eq.0)then\n write(*,*)'VALUE=',value\n elseif( is_iostat_end(ios) ) then\n stop 'end of file. Goodbye!'\n else\n write(*,*)'ERROR:',ios,trim(message)\n exit\n endif\n !\n enddo\nend program demo_iostat\n```\n### **Standard**\n\nFortran 2003\n\n### **See also**\n\n[****(3)](#)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "IS_IOSTAT_EOR": "## is_iostat_eor\n\n### **Name**\n\n**is_iostat_eor** - \\[STATE:INQUIRY\\] Test for end-of-record value\n\n### **Synopsis**\n```fortran\n result = is_iostat_eor(i)\n```\n```fortran\n elemental integer function is_iostat_eor(i)\n\n integer(kind=KIND),intent(in) :: i\n```\n### **Characteristics**\n\n - **i** is _integer_ of any kind\n - the return value is a default _logical_\n\n### **Description**\n\n **is_iostat_eor** tests whether a variable has the value of the\n I/O status \"end of record\". The function is equivalent to comparing\n the variable with the **iostat_eor** parameter of the intrinsic module\n **iso_fortran_env**.\n\n### **Options**\n\n- **i**\n : The value to test as indicating \"end of record\".\n\n### **Result**\n\n Returns _.true._ if and only if **i** has the value which indicates\n an end-of-record condition for iostat= specifiers, and is _.false._\n otherwise.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_is_iostat_eor\nuse iso_fortran_env, only : iostat_eor\nimplicit none\ninteger :: inums(5), lun, ios\n\n ! create a test file to read from\n open(newunit=lun, form='formatted',status='scratch')\n write(lun, '(a)') '10 20 30'\n write(lun, '(a)') '40 50 60 70'\n write(lun, '(a)') '80 90'\n write(lun, '(a)') '100'\n rewind(lun)\n\n do\n read(lun, *, iostat=ios) inums\n write(*,*)'iostat=',ios\n if(is_iostat_eor(ios)) then\n stop 'end of record'\n elseif(is_iostat_end(ios)) then\n print *,'end of file'\n exit\n elseif(ios.ne.0)then\n print *,'I/O error',ios\n exit\n endif\n enddo\n\n close(lun,iostat=ios,status='delete')\n\nend program demo_is_iostat_eor\n```\nResults:\n```text\n > iostat= 0\n > iostat= -1\n > end of file\n```\n### **Standard**\n\nFortran 2003\n\n### **See also**\n\n[****(3)](#)\n\n _fortran-lang intrinsic descriptions_\n", "KIND": "## kind\n\n### **Name**\n\n**kind** - \\[KIND:INQUIRY\\] Query kind of an entity\n\n### **Synopsis**\n```fortran\n result = kind(x)\n```\n```fortran\n integer function kind(x)\n\n type(TYPE,kind=**),intent(in) :: x(..)\n```\n### **Characteristics**\n - **x** may be of any intrinsic type. It may be a scalar or an array.\n - the result is a default _integer_ scalar\n\n### **Description**\n\n **kind(x)**(3) returns the kind value of the entity **x**.\n\n### **Options**\n\n- **x**\n : Value to query the kind of.\n\n### **Result**\n\n The return value indicates the kind of the argument **x**.\n\n Note that kinds are processor-dependent.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_kind\nimplicit none\ninteger,parameter :: dc = kind(' ')\ninteger,parameter :: dl = kind(.true.)\n\n print *, \"The default character kind is \", dc\n print *, \"The default logical kind is \", dl\n\nend program demo_kind\n```\nResults:\n```text\n The default character kind is 1\n The default logical kind is 4\n```\n### **Standard**\n\nFortran 95\n\n### **See also**\n\n- [**allocated**(3)](#allocated) - Status of an allocatable entity\n- [**is_contiguous**(3)](#is_contiguous) - test if object is contiguous\n- [**lbound**(3)](#lbound) - Lower dimension bounds of an array\n- [**rank**(3)](#rank) - Rank of a data object\n- [**shape**(3)](#shape) - Determine the shape of an array\n- [**size**(3)](#size) - Determine the size of an array\n- [**ubound**(3)](#ubound) - Upper dimension bounds of an array\n- [**bit_size**(3)](#bit_size) - Bit size inquiry function\n- [**storage_size**(3)](#storage_size) - Storage size in bits\n- [**kind**](#kind) - Kind of an entity\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", - "LBOUND": "## lbound\n\n### **Name**\n\n**lbound** - \\[ARRAY:INQUIRY\\] Lower dimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = lbound(array [,dim] [,kind] )\n```\n```fortran\n elemental TYPE(kind=KIND) function lbound(array,dim,kind)\n\n TYPE(kind=KIND),intent(in) :: array(..)\n integer(kind=**),intent(in),optional :: dim\n integer(kind=**),intent(in),optional :: kind\n```\n### **Characteristics**\n\n- **array** shall be assumed-rank or an array, of any type.\n It cannot be an unallocated allocatable array or a pointer that is not associated.\n\n- **dim** shall be a scalar _integer_.\n The corresponding actual argument shall not be an optional dummy\n argument, a disassociated pointer, or an unallocated allocatable.\n\n- **kind** an _integer_ initialization expression indicating the kind\n parameter of the result.\n\n- The return value is of type _integer_ and of kind **kind**. If **kind**\n is absent, the return value is of default integer kind.\n The result is scalar if **dim** is present; otherwise, the result is\n an array of rank one and size n, where n is the rank of **array**.\n\n- a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n **result**(3) returns the lower bounds of an array, or a single lower\n bound along the **dim** dimension.\n\n### **Options**\n\n- **array**\n : Shall be an array, of any type.\n\n- **dim**\n : Shall be a scalar _integer_.\n If **dim** is absent, the result is an array of the upper bounds of\n **array**.\n\n- **kind**\n : An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nIf **dim** is absent,\nthe result is an array of the lower bounds of **array**.\n\nIf **dim** is\npresent, the result is a scalar corresponding to the lower bound of the\narray along that dimension. If **array** is an expression rather than\na whole array or array structure component, or if it has a zero extent\nalong the relevant dimension, the lower bound is taken to be 1.\n\n NOTE1\n\n If **array** is assumed-rank and has rank zero, **dim** cannot be\n present since it cannot satisfy the requirement **1 <= dim <= 0**.\n\n### **Examples**\n\nNote that in my opinion this function should not be used on assumed-size\narrays or in any function without an explicit interface. Errors can\noccur if there is no interface defined.\n\nSample program\n```fortran\n! program demo_lbound\nmodule m_bounds\nimplicit none\n contains\n subroutine msub(arr)\n !!integer,intent(in) :: arr(*) ! cannot be assumed-size array\n integer,intent(in) :: arr(:)\n write(*,*)'MSUB: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n end subroutine msub\n end module m_bounds\n\n program demo_lbound\n use m_bounds, only : msub\n implicit none\n interface\n subroutine esub(arr)\n integer,intent(in) :: arr(:)\n end subroutine esub\n end interface\n integer :: arr(-10:10)\n write(*,*)'MAIN: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n call csub()\n call msub(arr)\n call esub(arr)\n contains\nsubroutine csub\n write(*,*)'CSUB: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine csub\nend\n\n subroutine esub(arr)\n implicit none\n integer,intent(in) :: arr(:)\n ! WARNING: IF CALLED WITHOUT AN EXPLICIT INTERFACE\n ! THIS WILL GIVE UNDEFINED ANSWERS (like 0,0,0)\n write(*,*)'ESUB: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n end subroutine esub\n\n!end program demo_lbound\n```\nResults:\n```\n MAIN: LOWER= -10 UPPER= 10 SIZE= 21\n CSUB: LOWER= -10 UPPER= 10 SIZE= 21\n MSUB: LOWER= 1 UPPER= 21 SIZE= 21\n ESUB: LOWER= 1 UPPER= 21 SIZE= 21\n```\n### **Standard**\n\nFortran 95 , with KIND argument - Fortran 2003\n\n### **See Also**\n\n#### Array inquiry:\n\n- [**size**(3)](#size) - Determine the size of an array\n- [**rank**(3)](#rank) - Rank of a data object\n- [**shape**(3)](#shape) - Determine the shape of an array\n- [**ubound**(3)](#ubound) - Upper dimension bounds of an array\n\n[**co\\_ubound**(3)](#co_ubound),\n[**co\\_lbound**(3)](co_lbound)\n\n#### State Inquiry:\n\n- [**allocated**(3)](#allocated) - Status of an allocatable entity\n- [**is_contiguous**(3)](#is_contiguous) - Test if object is contiguous\n\n#### Kind Inquiry:\n\n- [**kind**(3)](#kind) - Kind of an entity\n\n#### Bit Inquiry:\n\n- [**storage_size**(3)](#storage_size) - Storage size in bits\n- [**bit_size**(3)](#bit_size) - Bit size inquiry function\n- [**btest**(3)](#btest) - Tests a bit of an _integer_ value.\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "LBOUND": "## lbound\n\n### **Name**\n\n**lbound** - \\[ARRAY:INQUIRY\\] Lower dimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = lbound(array [,dim] [,kind] )\n```\n```fortran\n elemental TYPE(kind=KIND) function lbound(array,dim,kind)\n\n TYPE(kind=KIND),intent(in) :: array(..)\n integer(kind=**),intent(in),optional :: dim\n integer(kind=**),intent(in),optional :: kind\n```\n### **Characteristics**\n\n- **array** shall be assumed-rank or an array, of any type.\n It cannot be an unallocated allocatable array or a pointer that is not associated.\n\n- **dim** shall be a scalar _integer_.\n The corresponding actual argument shall not be an optional dummy\n argument, a disassociated pointer, or an unallocated allocatable.\n\n- **kind** an _integer_ initialization expression indicating the kind\n parameter of the result.\n\n- The return value is of type _integer_ and of kind **kind**. If **kind**\n is absent, the return value is of default integer kind.\n The result is scalar if **dim** is present; otherwise, the result is\n an array of rank one and size n, where n is the rank of **array**.\n\n- a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n **result**(3) returns the lower bounds of an array, or a single lower\n bound along the **dim** dimension.\n\n### **Options**\n\n- **array**\n : Shall be an array, of any type.\n\n- **dim**\n : Shall be a scalar _integer_.\n If **dim** is absent, the result is an array of the upper bounds of\n **array**.\n\n- **kind**\n : An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nIf **dim** is absent,\nthe result is an array of the lower bounds of **array**.\n\nIf **dim** is\npresent, the result is a scalar corresponding to the lower bound of the\narray along that dimension. If **array** is an expression rather than\na whole array or array structure component, or if it has a zero extent\nalong the relevant dimension, the lower bound is taken to be 1.\n\n NOTE1\n\n If **array** is assumed-rank and has rank zero, **dim** cannot be\n present since it cannot satisfy the requirement **1 <= dim <= 0**.\n\n### **Examples**\n\nNote that in my opinion this function should not be used on assumed-size\narrays or in any function without an explicit interface. Errors can\noccur if there is no interface defined.\n\nSample program\n```fortran\n! program demo_lbound\nmodule m_bounds\nimplicit none\n contains\n subroutine msub(arr)\n !!integer,intent(in) :: arr(*) ! cannot be assumed-size array\n integer,intent(in) :: arr(:)\n write(*,*)'MSUB: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n end subroutine msub\n end module m_bounds\n\n program demo_lbound\n use m_bounds, only : msub\n implicit none\n interface\n subroutine esub(arr)\n integer,intent(in) :: arr(:)\n end subroutine esub\n end interface\n integer :: arr(-10:10)\n write(*,*)'MAIN: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n call csub()\n call msub(arr)\n call esub(arr)\n contains\nsubroutine csub\n write(*,*)'CSUB: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine csub\nend\n\n subroutine esub(arr)\n implicit none\n integer,intent(in) :: arr(:)\n ! WARNING: IF CALLED WITHOUT AN EXPLICIT INTERFACE\n ! THIS WILL GIVE UNDEFINED ANSWERS (like 0,0,0)\n write(*,*)'ESUB: LOWER=',lbound(arr), &\n & 'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n end subroutine esub\n\n!end program demo_lbound\n```\nResults:\n```\n MAIN: LOWER= -10 UPPER= 10 SIZE= 21\n CSUB: LOWER= -10 UPPER= 10 SIZE= 21\n MSUB: LOWER= 1 UPPER= 21 SIZE= 21\n ESUB: LOWER= 1 UPPER= 21 SIZE= 21\n```\n### **Standard**\n\nFortran 95 , with KIND argument - Fortran 2003\n\n### **See Also**\n\n#### Array inquiry:\n\n- [**size**(3)](#size) - Determine the size of an array\n- [**rank**(3)](#rank) - Rank of a data object\n- [**shape**(3)](#shape) - Determine the shape of an array\n- [**ubound**(3)](#ubound) - Upper dimension bounds of an array\n\n[**co\\_ubound**(3)](#ucobound),\n[**co\\_lbound**(3)](lcobound)\n\n#### State Inquiry:\n\n- [**allocated**(3)](#allocated) - Status of an allocatable entity\n- [**is_contiguous**(3)](#is_contiguous) - Test if object is contiguous\n\n#### Kind Inquiry:\n\n- [**kind**(3)](#kind) - Kind of an entity\n\n#### Bit Inquiry:\n\n- [**storage_size**(3)](#storage_size) - Storage size in bits\n- [**bit_size**(3)](#bit_size) - Bit size inquiry function\n- [**btest**(3)](#btest) - Tests a bit of an _integer_ value.\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "LCOBOUND": "## lcobound\n\n### **Name**\n\n**lcobound** - \\[COLLECTIVE\\] Lower codimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = lcobound( coarray [,dim] [,kind] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**lcobound** returns the lower bounds of a coarray, or a single\nlower cobound along the **dim** codimension.\n\n### **Options**\n\n- **array**\n : Shall be an coarray, of any type.\n\n- **dim**\n : (Optional) Shall be a scalar _integer_.\n\n- **kind**\n : (Optional) An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nThe return value is of type _integer_ and of kind **kind**. If **kind** is absent,\nthe return value is of default integer kind. If **dim** is absent, the\nresult is an array of the lower cobounds of **coarray**. If **dim** is present,\nthe result is a scalar corresponding to the lower cobound of the array\nalong that codimension.\n\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**ucobound**(3)](#ucobound),\n[**lbound**(3)](#lbound)\n\n _fortran-lang intrinsic descriptions_\n", "LEADZ": "## leadz\n\n### **Name**\n\n**leadz** - \\[BIT:COUNT\\] Number of leading zero bits of an integer\n\n### **Synopsis**\n```fortran\n result = leadz(i)\n```\n```fortran\n elemental integer function leadz(i)\n\n integer(kind=**),intent(in) :: i\n```\n### **Characteristics**\n\n- **i** may be an _integer_ of any kind.\n- the return value is a default integer type.\n\n### **Description**\n\n **leadz** returns the number of leading zero bits of an integer.\n\n### **Options**\n\n- **i**\n : _integer_ to count the leading zero bits of.\n\n### **Result**\n\n The number of leading zero bits, taking into account the kind of the\n input value. If all the bits of **i** are zero, the result value is\n **bit_size(i)**.\n\n The result may also be thought of as **bit_size(i)-1-k** where **k**\n is the position of the leftmost 1 bit in the input **i**. Positions\n are from 0 to bit-size(), with 0 at the right-most bit.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_leadz\nimplicit none\ninteger :: value, i\ncharacter(len=80) :: f\n\n ! make a format statement for writing a value as a bit string\n write(f,'(\"(b\",i0,\".\",i0,\")\")')bit_size(value),bit_size(value)\n\n ! show output for various integer values\n value=0\n do i=-150, 150, 50\n value=i\n write (*,'(\"LEADING ZERO BITS=\",i3)',advance='no') leadz(value)\n write (*,'(\" OF VALUE \")',advance='no')\n write(*,f,advance='no') value\n write(*,'(*(1x,g0))') \"AKA\",value\n enddo\n ! Notes:\n ! for two's-complements programming environments a negative non-zero\n ! integer value will always start with a 1 and a positive value with 0\n ! as the first bit is the sign bit. Such platforms are very common.\nend program demo_leadz\n```\nResults:\n```text\n LEADING ZERO BITS= 0 OF VALUE 11111111111111111111111101101010 AKA -150\n LEADING ZERO BITS= 0 OF VALUE 11111111111111111111111110011100 AKA -100\n LEADING ZERO BITS= 0 OF VALUE 11111111111111111111111111001110 AKA -50\n LEADING ZERO BITS= 32 OF VALUE 00000000000000000000000000000000 AKA 0\n LEADING ZERO BITS= 26 OF VALUE 00000000000000000000000000110010 AKA 50\n LEADING ZERO BITS= 25 OF VALUE 00000000000000000000000001100100 AKA 100\n LEADING ZERO BITS= 24 OF VALUE 00000000000000000000000010010110 AKA 150\n```\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**bit_size**(3)](#bit_size),\n[**popcnt**(3)](#popcnt),\n[**poppar**(3)](#poppar),\n[**trailz**(3)](#trailz)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "LEN": "## len\n\n### **Name**\n\n**len** - \\[CHARACTER\\] Length of a character entity\n\n### **Synopsis**\n```fortran\n result = len(string [,kind])\n```\n```fortran\n integer(kind=KIND) function len(string,KIND)\n\n character(len=*),intent(in) :: string(..)\n integer,optional,intent(in) :: KIND\n```\n### **Characteristics**\n\n - **string** is a scalar or array _character_ variable\n - **KIND** is a scalar integer constant expression.\n - the returned value is the same integer kind as the **kind**\n argument, or of the default integer kind if **kind** is not specified.\n\n### **Description**\n\n **len** returns the length of a _character_ string.\n\n If **string** is an array, the length of a single element of **string**\n is returned, as all elements of an array are the same length.\n\n Note that **string** need not be defined when this intrinsic is invoked,\n as only the length (not the content) of **string** is needed.\n\n### **Options**\n\n- **string**\n : A scalar or array string to return the length of.\n If it is an unallocated allocatable variable or a pointer that is\n not associated, its length type parameter shall not be deferred.\n\n- **kind**\n : A constant indicating the _kind_ parameter of the result.\n\n### **Result**\n\n The result has a value equal to the number of characters in STRING\n if it is scalar or in an element of STRING if it is an array.\n\n### **Examples**\n\nSample program\n\n```fortran\nprogram demo_len\nimplicit none\n\n! fixed length\ncharacter(len=40) :: string\n! allocatable length\ncharacter(len=:),allocatable :: astring\ncharacter(len=:),allocatable :: many_strings(:)\ninteger :: ii\n ! BASIC USAGE\n ii=len(string)\n write(*,*)'length =',ii\n\n ! ALLOCATABLE VARIABLE LENGTH CAN CHANGE\n ! the allocatable string length will be the length of RHS expression\n astring=' How long is this allocatable string? '\n write(*,*)astring, ' LEN=', len(astring)\n ! print underline\n write(*,*) repeat('=',len(astring))\n ! assign new value to astring and length changes\n astring='New allocatable string'\n write(*,*)astring, ' LEN=', len(astring)\n ! print underline\n write(*,*) repeat('=',len(astring))\n\n ! THE STRING LENGTH WILL BE CONSTANT FOR A FIXED-LENGTH VARIABLE\n string=' How long is this fixed string? '\n write(*,*)string,' LEN=',len(string)\n string='New fixed string '\n write(*,*)string,' LEN=',len(string)\n\n ! ALL STRINGS IN AN ARRAY ARE THE SAME LENGTH\n ! a scalar is returned for an array, as all values in a Fortran\n ! character array must be of the same length.\n many_strings = [ character(len=7) :: 'Tom', 'Dick', 'Harry' ]\n write(*,*)'length of ALL elements of array=',len(many_strings)\n\n ! NAME%LEN IS ESSENTIALLY THE SAME AS LEN(NAME)\n ! you can also query the length (and other attributes) of a string\n ! using a \"type parameter inquiry\" (available since fortran 2018)\n write(*,*)'length from type parameter inquiry=',string%len\n ! %len is equivalent to a call to LEN() except the kind of the integer\n ! value returned is always of default kind.\n\n ! LOOK AT HOW A PASSED STRING CAN BE USED ...\n call passed(' how long? ')\n\ncontains\n\n subroutine passed(str)\n character(len=*),intent(in) :: str\n ! the length of str can be used in the definitions of variables\n ! you can query the length of the passed variable\n write(*,*)'length of passed value is ', LEN(str)\n end subroutine passed\n\nend program demo_len\n```\nResults:\n```text\n > length = 40\n > How long is this allocatable string? LEN= 38\n > ======================================\n > New allocatable string LEN= 22\n > ======================\n > How long is this fixed string? LEN= 40\n > New fixed string LEN= 40\n > length of ALL elements of array= 7\n > length from type parameter inquiry= 40\n > length of passed value is 11\n```\n### **Standard**\n\nFORTRAN 77 ; with **kind** argument - Fortran 2003\n\n### **See Also**\n\nlen_trim(3), adjustr(3), trim(3), and adjustl(3) are related routines that\nallow you to deal with leading and trailing blanks.\n\nFunctions that perform operations on character strings, return lengths\nof arguments, and search for certain arguments:\n\n- **Elemental:**\n [**adjustl**(3)](#adjustl),\n [**adjustr**(3)](#adjustr),\n [**index**(3)](#index),\n [**scan**(3)](#scan),\n [**verify**(3)](#verify)\n\n- **Nonelemental:**\n [**len_trim**(3)](#len_trim),\n [**len**](#len),\n [**repeat**(3)](#repeat),\n [**trim**(3)](#trim)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "LEN_TRIM": "## len_trim\n\n### **Name**\n\n**len_trim** - \\[CHARACTER:WHITESPACE\\] Character length without trailing blank characters\n\n### **Synopsis**\n```fortran\n result = len_trim(string [,kind])\n```\n```fortran\n elemental integer(kind=KIND) function len_trim(string,KIND)\n\n character(len=*),intent(in) :: string\n integer(kind=KIND),intent(in),optional :: KIND\n```\n### **Characteristics**\n\n - **string** is of type _character_\n - **kind** is a scalar integer constant expression specifying the kind\n of the returned value.\n - The return value is of type _integer_ and of kind **KIND**. If **KIND**\n is absent, the return value is of default _integer_ kind.\n\n### **Description**\n\n **len_trim** returns the length of a character string, ignoring\n any trailing blanks.\n\n### **Options**\n\n- **string**\n : The input string whose length is to be measured.\n\n- **kind**\n : Indicates the kind parameter of the result.\n\n### **Result**\n\n The result equals the number of characters remaining\n after any trailing blanks in **string** are removed.\n\n If the input argument is of zero length or all blanks\n the result is zero.\n\n### **Examples**\n\nSample program\n```fortran\nprogram demo_len_trim\nimplicit none\ncharacter(len=:),allocatable :: string\ninteger :: i\n! basic usage\n string=\" how long is this string? \"\n write(*,*) string\n write(*,*)'UNTRIMMED LENGTH=',len(string)\n write(*,*)'TRIMMED LENGTH=',len_trim(string)\n\n ! print string, then print substring of string\n string='xxxxx '\n write(*,*)string,string,string\n i=len_trim(string)\n write(*,*)string(:i),string(:i),string(:i)\n !\n ! elemental example\n ELE:block\n ! an array of strings may be used\n character(len=:),allocatable :: tablet(:)\n tablet=[character(len=256) :: &\n & ' how long is this string? ',&\n & 'and this one?']\n write(*,*)'UNTRIMMED LENGTH= ',len(tablet)\n write(*,*)'TRIMMED LENGTH= ',len_trim(tablet)\n write(*,*)'SUM TRIMMED LENGTH=',sum(len_trim(tablet))\n endblock ELE\n !\nend program demo_len_trim\n```\nResults:\n```text\n how long is this string?\n UNTRIMMED LENGTH= 30\n TRIMMED LENGTH= 25\n xxxxx xxxxx xxxxx\n xxxxxxxxxxxxxxx\n UNTRIMMED LENGTH= 256\n TRIMMED LENGTH= 25 13\n SUM TRIMMED LENGTH= 38\n```\n### **Standard**\n\nFortran 95 . **kind** argument added with Fortran 2003.\n\n### **See Also**\n\nFunctions that perform operations on character strings, return lengths\nof arguments, and search for certain arguments:\n\n- **Elemental:**\n [**adjustl**(3)](#adjustl),\n [**adjustr**(3)](#adjustr),\n [**index**(3)](#index),\n [**scan**(3)](#scan),\n [**verify**(3)](#verify)\n\n- **Nonelemental:**\n [**repeat**(3)](#repeat),\n [**len**(3)](#len),\n [**trim**(3)](#trim)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", @@ -147,7 +146,7 @@ "NORM2": "## norm2\n\n### **Name**\n\n**norm2** - \\[MATHEMATICS\\] Euclidean vector norm\n\n### **Synopsis**\n```fortran\n result = norm2(array, [dim])\n```\n```fortran\n real(kind=KIND) function norm2(array, dim)\n\n real(kind=KIND),intent(in) :: array(..)\n integer(kind=**),intent(in),optional :: dim\n```\n### **Characteristics**\n\n - **array** shall be an array of type _real_.\n - **dim** shall be a scalar of type _integer_\n - The result is of the same type as **array**.\n\n### **Description**\n\n **norm2** calculates the Euclidean vector norm (L_2 norm or\n generalized L norm) of **array** along dimension **dim**.\n\n### **Options**\n\n- **array**\n : the array of input values for the L_2 norm computations\n\n- **dim**\n : a value in the range from **1** to **rank(array)**.\n\n### **Result**\n\n If **dim** is absent, a scalar with the square root of the sum of squares\n of the elements of **array** is returned.\n\n Otherwise, an array of rank **n-1**, where **n** equals the rank of\n **array**, and a shape similar to that of **array** with dimension DIM\n dropped is returned.\n\n Case (i): The result of NORM2 (X) has a value equal to a\n processor-dependent approximation to the generalized\n L norm of X, which is the square root of the sum of\n the squares of the elements of X. If X has size zero,\n the result has the value zero.\n\n Case (ii): The result of NORM2 (X, DIM=DIM) has a value equal\n to that of NORM2 (X) if X has rank one. Otherwise,\n the resulting array is reduced in rank with dimension\n **dim** removed, and each remaining elment is the\n result of NORM2(X) for the values along dimension\n **dim**.\n\n It is recommended that the processor compute the result without undue\n overflow or underflow.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_norm2\nimplicit none\ninteger :: i\nreal :: x(2,3) = reshape([ &\n 1, 2, 3, &\n 4, 5, 6 &\n ],shape(x),order=[2,1])\n\n write(*,*) 'input in row-column order'\n write(*,*) 'x='\n write(*,'(4x,3f4.0)')transpose(x)\n write(*,*)\n write(*,*) 'norm2(x)=',norm2(x)\n write(*,*) 'which is equivalent to'\n write(*,*) 'sqrt(sum(x**2))=',sqrt(sum(x**2))\n write(*,*)\n write(*,*) 'for reference the array squared is'\n write(*,*) 'x**2='\n write(*,'(4x,3f4.0)')transpose(x**2)\n write(*,*)\n write(*,*) 'norm2(x,dim=1)=',norm2(x,dim=1)\n write(*,*) 'norm2(x,dim=2)=',norm2(x,dim=2)\n write(*,*) '(sqrt(sum(x(:,i)**2)),i=1,3)=',(sqrt(sum(x(:,i)**2)),i=1,3)\n write(*,*) '(sqrt(sum(x(i,:)**2)),i=1,2)=',(sqrt(sum(x(i,:)**2)),i=1,2)\n\nend program demo_norm2\n```\nResults:\n```text\n > input in row-column order\n > x=\n > 1. 2. 3.\n > 4. 5. 6.\n >\n > norm2(x)= 9.539392\n > which is equivalent to\n > sqrt(sum(x**2))= 9.539392\n >\n > for reference the array squared is\n > x**2=\n > 1. 4. 9.\n > 16. 25. 36.\n >\n > norm2(x,dim=1)= 4.123106 5.385165 6.708204\n > norm2(x,dim=2)= 3.741657 8.774964\n > (sqrt(sum(x(:,i)**2)),i=1,3)= 4.123106 5.385165 6.708204\n > (sqrt(sum(x(i,:)**2)),i=1,2)= 3.741657 8.774964\n```\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**product**(3)](#product),\n[**sum**(3)](#sum),\n[**hypot**(3)](#hypot)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "NOT": "## not\n\n### **Name**\n\n**not** - \\[BIT:LOGICAL\\] Logical negation; flips all bits in an integer\n\n### **Synopsis**\n```fortran\n result = not(i)\n```\n```fortran\n elemental integer(kind=KIND) function not(i)\n\n integer(kind=KIND), intent(in) :: i\n```\n### **Characteristics**\n\n- **i** may be an _integer_ of any valid kind\n- The returned _integer_ is of the same kind as the argument **i**.\n\n### **Description**\n\n **not** returns the bitwise Boolean inverse of **i**. This is also\n known as the \"Bitwise complement\" or \"Logical negation\" of the value.\n\n If an input bit is a one, that position is a zero on output. Conversely\n any input bit that is zero is a one on output.\n\n### **Options**\n\n- **i**\n : The value to flip the bits of.\n\n### **Result**\n\n The result has the value obtained by complementing **i** bit-by-bit\n according to the following truth table:\n\n > I | NOT(I)\n > ----#----------\n > 1 | 0\n > 0 | 1\n\n That is, every input bit is flipped.\n\n### **Examples**\n\nSample program\n\n```fortran\nprogram demo_not\nimplicit none\ninteger :: i\n ! basics\n i=-13741\n print *,'the input value',i,'represented in bits is'\n write(*,'(1x,b32.32,1x,i0)') i, i\n i=not(i)\n print *,'on output it is',i\n write(*,'(1x,b32.32,1x,i0)') i, i\n print *, \" on a two's complement machine flip the bits and add 1\"\n print *, \" to get the value with the sign changed, for example.\"\n print *, 1234, not(1234)+1\n print *, -1234, not(-1234)+1\n print *, \" of course 'x=-x' works just fine and more generally.\"\nend program demo_not\n```\nResults:\n```text\n the input value -13741 represented in bits is\n 11111111111111111100101001010011 -13741\n on output it is 13740\n 00000000000000000011010110101100 13740\n on a two's complement machine flip the bits and add 1\n to get the value with the sign changed, for example.\n 1234 -1234\n -1234 1234\n of course 'x=-x' works just fine and more generally.\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**iand**(3)](#iand),\n[**ior**(3)](#ior),\n[**ieor**(3)](#ieor),\n[**ibits**(3)](#ibits),\n[**ibset**(3)](#ibset),\n\n[**ibclr**(3)](#ibclr)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "NULL": "## null\n\n### **Name**\n\n**null** - \\[TRANSFORMATIONAL\\] Function that returns a disassociated pointer\n\n### **Synopsis**\n```fortran\n ptr => null( [mold] )\n```\n```fortran\n function null(mold)\n\n type(TYPE(kind=**)),pointer,optional :: mold\n```\n### **Characteristics**\n\n- **mold** is a pointer of any association status and of any type.\n- The result is a disassociated pointer or an unallocated allocatable entity.\n\n### **Description**\n\n **null** returns a disassociated pointer.\n\n If **mold** is present, a disassociated pointer of the same type is\n returned, otherwise the type is determined by context.\n\n In _Fortran 95_, **mold** is optional. Please note that _Fortran 2003_\n includes cases where it is required.\n\n### **Options**\n\n- **mold**\n : a pointer of any association status and of any\n type.\n\n### **Result**\n\n A disassociated pointer or an unallocated allocatable entity.\n\n### **Examples**\n\nSample program:\n\n```fortran\n!program demo_null\nmodule showit\nimplicit none\nprivate\ncharacter(len=*),parameter :: g='(*(g0,1x))'\npublic gen\n! a generic interface that only differs in the\n! type of the pointer the second argument is\ninterface gen\n module procedure s1\n module procedure s2\nend interface\n\ncontains\n\nsubroutine s1 (j, pi)\n integer j\n integer, pointer :: pi\n if(associated(pi))then\n write(*,g)'Two integers in S1:,',j,'and',pi\n else\n write(*,g)'One integer in S1:,',j\n endif\nend subroutine s1\n\nsubroutine s2 (k, pr)\n integer k\n real, pointer :: pr\n if(associated(pr))then\n write(*,g)'integer and real in S2:,',k,'and',pr\n else\n write(*,g)'One integer in S2:,',k\n endif\nend subroutine s2\n\nend module showit\n\nprogram demo_null\nuse showit, only : gen\n\nreal,target :: x = 200.0\ninteger,target :: i = 100\n\nreal, pointer :: real_ptr\ninteger, pointer :: integer_ptr\n\n! so how do we call S1() or S2() with a disassociated pointer?\n\n! the answer is the null() function with a mold value\n\n! since s1() and s2() both have a first integer\n! argument the NULL() pointer must be associated\n! to a real or integer type via the mold option\n! so the following can distinguish whether s1(1)\n! or s2() is called, even though the pointers are\n! not associated or defined\n\ncall gen (1, null (real_ptr) ) ! invokes s2\ncall gen (2, null (integer_ptr) ) ! invokes s1\nreal_ptr => x\ninteger_ptr => i\ncall gen (3, real_ptr ) ! invokes s2\ncall gen (4, integer_ptr ) ! invokes s1\n\nend program demo_null\n```\nResults:\n```text\n One integer in S2:, 1\n One integer in S1:, 2\n integer and real in S2:, 3 and 200.000000\n Two integers in S1:, 4 and 100\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**associated**(3)](#associated)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", - "NUM_IMAGES": "## num_images\n\n### **Name**\n\n**num_images** - \\[COLLECTIVE\\] Number of images\n\n### **Synopsis**\n```fortran\n result = num_images([team|team_number])\n```\n```fortran\n integer function num_images (team)\n\n type(TEAM_TYPE),intent(in),optional :: team\n integer(kind=KIND),intent(in),optional :: team_number\n```\n### **Characteristics**\n\n - use of **team** and **team_number** is mutually exclusive\n - **team** is is a scalar of of type **TEAM_TYPE** from the intrinsic module ISO_FORTRAN_ENV.\n - **team_number** is an _integer_ scalar.\n - the result is a default _integer_ scalar.\n\n### **Description**\n\n**num_images** Returns the number of images.\n\n### **Options**\n\n- **team**\n : shall be a scalar of type TEAM_TYPE from the intrinsic module\n ISO_FORTRAN_ENV, with a value that identifies the current or an\n ancestor team.\n\n- **team_number**\n : identifies the initial team or a team whose parent is the same as\n that of the current team.\n\n### **Result**\n\n The number of images in the specified team, or in the current team if\n no team is specified.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_num_images\nimplicit none\ninteger :: value[*]\nreal :: p[*]\ninteger :: i\n\n value = this_image()\n sync all\n if (this_image() == 1) then\n do i = 1, num_images()\n write(*,'(2(a,i0))') 'value[', i, '] is ', value[i]\n end do\n endif\n\n ! The following code uses image 1 to read data and\n ! broadcast it to other images.\n if (this_image()==1) then\n p=1234.5678\n do i = 2, num_images()\n p[i] = p\n end do\n end if\n sync all\n\nend program demo_num_images\n```\n### **Standard**\n\nFortran 2008 . With DISTANCE or FAILED argument, TS 18508\n\n### **See Also**\n\n[**this_image**(3)](#this_image),\n[**image_index**(3)](#this_index)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "NUM_IMAGES": "## num_images\n\n### **Name**\n\n**num_images** - \\[COLLECTIVE\\] Number of images\n\n### **Synopsis**\n```fortran\n result = num_images([team|team_number])\n```\n```fortran\n integer function num_images (team)\n\n type(TEAM_TYPE),intent(in),optional :: team\n integer(kind=KIND),intent(in),optional :: team_number\n```\n### **Characteristics**\n\n - use of **team** and **team_number** is mutually exclusive\n - **team** is a scalar of type **TEAM_TYPE** from the intrinsic module ISO_FORTRAN_ENV.\n - **team_number** is an _integer_ scalar.\n - the result is a default _integer_ scalar.\n\n### **Description**\n\n**num_images** Returns the number of images.\n\n### **Options**\n\n- **team**\n : shall be a scalar of type TEAM_TYPE from the intrinsic module\n ISO_FORTRAN_ENV, with a value that identifies the current or an\n ancestor team.\n\n- **team_number**\n : identifies the initial team or a team whose parent is the same as\n that of the current team.\n\n### **Result**\n\n The number of images in the specified team, or in the current team if\n no team is specified.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_num_images\nimplicit none\ninteger :: value[*]\nreal :: p[*]\ninteger :: i\n\n value = this_image()\n sync all\n if (this_image() == 1) then\n do i = 1, num_images()\n write(*,'(2(a,i0))') 'value[', i, '] is ', value[i]\n end do\n endif\n\n ! The following code uses image 1 to read data and\n ! broadcast it to other images.\n if (this_image()==1) then\n p=1234.5678\n do i = 2, num_images()\n p[i] = p\n end do\n end if\n sync all\n\nend program demo_num_images\n```\n### **Standard**\n\nFortran 2008 . With DISTANCE or FAILED argument, TS 18508\n\n### **See Also**\n\n[**this_image**(3)](#this_image),\n[**image_index**(3)](#this_index)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "OUT_OF_RANGE": "## out_of_range\n\n### **Name**\n\n**out_of_range** - \\[TYPE:NUMERIC\\] Whether a value cannot be converted safely.\n\n### **Synopsis**\n```fortran\n result = out_of_range (x, mold [, round])\n```\n```fortran\n elemental logical function(x, mold, round)\n\n TYPE,kind=KIND),intent(in) :: x\n TYPE,kind=KIND),intent(in) :: mold\n logical,intent(in),optional :: round\n```\n### **Characteristics**\n\n - **x** is of type _integer_ or _real_.\n - **mold** is an _integer_ or _real_ scalar.\n - **round** is a _logical_ scalar.\n - the result is a default _logical_.\n\n### **Description**\n\n **out_of_range** determines whether a value **x** can be converted\n safely to a _real_ or _integer_ variable the same type and kind\n as **mold**.\n\n For example, if **int8** is the kind value for an 8-bit binary integer\n type, **out_of_range(-128.5, 0_int8)** will have the value false and\n **out_of_range(-128.5, 0_int8, .true.)** will have the value _.true._\n because the value will be truncated when converted to an _integer_\n and -128 is a representable value on a two's complement machine in\n eight bits even though +128 is not.\n\n### **Options**\n - **x**\n : a scalar to be tested for whether\n it can be stored in a variable of the type and kind of **mold**\n\n - **mold**\n and kind are queried to determine the characteristics of what\n needs to be fit into.\n\n - **round**\n : flag whether to round the value of **xx** before validating it as\n an integer value like **mold**.\n\n **round** can only be present if **x** is of type\n _real_ and **mold** is of type _integer_.\n\n### **Result**\n\nFrom the standard:\n\n Case (i): If **mold** is of type integer, and **round** is absent or\n present with the value false, the result is true\n if and only if the value of X is an IEEE infinity or\n NaN, or if the integer with largest magnitude that lies\n between zero and X inclusive is not representable by\n objects with the type and kind of **mold**.\n\n Case (ii): If **mold** is of type integer, and **round** is present with\n the value true, the result is true if and only\n if the value of X is an IEEE infinity or NaN, or\n if the integer nearest X, or the integer of greater\n magnitude if two integers are equally near to X, is not\n representable by objects with the type and kind of **mold**.\n\n Case (iii): Otherwise, the result is true if and only if the value\n of X is an IEEE infinity or NaN that is not\n supported by objects of the type and kind of **mold**,\n or if X is a finite number and the result of rounding\n the value of X (according to the IEEE rounding mode if\n appropriate) to the extended model for the kind of **mold**\n has magnitude larger than that of the largest finite\n number with the same sign as X that is representable\n by objects with the type and kind of **mold**.\n\n NOTE\n\n **mold** is required to be a scalar because the only information\n taken from it is its type and kind. Allowing an array **mold** would\n require that it be conformable with **x**. **round** is scalar because\n allowing an array rounding mode would have severe performance\n difficulties on many processors.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_out_of_range\nuse, intrinsic :: iso_fortran_env, only : int8, int16, int32, int64\nuse, intrinsic :: iso_fortran_env, only : real32, real64, real128\nimplicit none\ninteger :: i\ninteger(kind=int8) :: i8, j8\n\n ! compilers are not required to produce an error on out of range.\n ! here storing the default integers into 1-byte integers\n ! incorrectly can have unexpected results\n do i=127,130\n i8=i\n j8=-i\n ! OUT_OF_RANGE(3f) can let you check if the value will fit\n write(*,*)i8,j8,' might have expected',i,-i, &\n & out_of_range( i,i8), &\n & out_of_range(-i,i8)\n enddo\n write(*,*) 'RANGE IS ',-1-huge(0_int8),'TO',huge(0_int8)\n ! the real -128.5 is truncated to -128 and is in range\n write(*,*) out_of_range ( -128.5, 0_int8) ! false\n\n ! the real -128.5 is rounded to -129 and is not in range\n write(*,*) out_of_range ( -128.5, 0_int8, .true.) ! true\n\nend program demo_out_of_range\n```\nResults:\n```text\n > 127 -127 might have expected 127 -127 F F\n > -128 -128 might have expected 128 -128 T F\n > -127 127 might have expected 129 -129 T T\n > -126 126 might have expected 130 -130 T T\n > RANGE IS -128 TO 127\n > F\n > T\n```\n### **Standard**\n\n FORTRAN 2018\n\n### **See also**\n\n- [**aimag**(3)](#aimag) - Imaginary part of complex number\n- [**cmplx**(3)](#cmplx) - Convert values to a complex type\n- [**dble**(3)](#dble) - Double conversion function\n- [**int**(3)](#int) - Truncate towards zero and convert to integer\n- [**nint**(3)](#nint) - Nearest whole number\n- [**real**(3)](#real) - Convert to real type\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "PACK": "## pack\n\n### **Name**\n\n**pack** - \\[ARRAY:CONSTRUCTION\\] Pack an array into an array of rank one\n\n### **Synopsis**\n```fortran\n result = pack( array, mask [,vector] )\n```\n```fortran\n TYPE(kind=KIND) function pack(array,mask,vector)\n\n TYPE(kind=KIND),option(in) :: array(..)\n logical :: mask(..)\n TYPE(kind=KIND),option(in),optional :: vector(*)\n```\n### **Characteristics**\n\n - **array** is an array of any type\n - **mask** a _logical_ scalar as well as an array conformable with **array**.\n - **vector** is of the same kind and type as **array** and of rank one\n - the returned value is of the same kind and type as **array**\n\n### **Description**\n\n **pack** stores the elements of **array** in an array of rank one.\n\n The beginning of the resulting array is made up of elements whose\n **mask** equals _.true._. Afterwards, remaining positions are filled with elements\n taken from **vector**\n\n### **Options**\n\n- **array**\n : The data from this array is used to fill the resulting vector\n\n- **mask**\n : the _logical_ mask must be the same size as **array** or,\n alternatively, it may be a _logical_ scalar.\n\n- **vector**\n : an array of the same type as **array** and of rank\n one. If present, the number of elements in **vector** shall be equal to\n or greater than the number of true elements in **mask**. If **mask** is\n scalar, the number of elements in **vector** shall be equal to or\n greater than the number of elements in **array**.\n\n**vector** shall have at least as many elements as there are in **array**.\n\n### **Result**\n\nThe result is an array of rank one and the same type as that of **array**.\nIf **vector** is present, the result size is that of **vector**, the number of\n_.true._ values in **mask** otherwise.\n\nIf **mask** is scalar with the value _.true._, in which case the result\nsize is the size of **array**.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_pack\nimplicit none\ninteger, allocatable :: m(:)\ncharacter(len=10) :: c(4)\n\n ! gathering nonzero elements from an array:\n m = [ 1, 0, 0, 0, 5, 0 ]\n write(*, fmt=\"(*(i0, ' '))\") pack(m, m /= 0)\n\n ! Gathering nonzero elements from an array and appending elements\n ! from VECTOR till the size of the mask array (or array size if the\n ! mask is scalar):\n m = [ 1, 0, 0, 2 ]\n write(*, fmt=\"(*(i0, ' '))\") pack(m, m /= 0, [ 0, 0, 3, 4 ])\n write(*, fmt=\"(*(i0, ' '))\") pack(m, m /= 0 )\n\n ! select strings whose second character is \"a\"\n c = [ character(len=10) :: 'ape', 'bat', 'cat', 'dog']\n write(*, fmt=\"(*(g0, ' '))\") pack(c, c(:)(2:2) == 'a' )\n\nend program demo_pack\n```\nResults:\n```text\n > 1 5\n > 1 2 3 4\n > 1 2\n > bat cat\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**merge**(3)](#merge),\n[**spread**(3)](#spread),\n[**unpack**(3)](#unpack)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "PARITY": "## parity\n\n### **Name**\n\n**parity** - \\[ARRAY:REDUCTION\\] Array reduction by .NEQV. operation\n\n### **Synopsis**\n```fortran\n result = parity( mask [,dim] )\n```\n```fortran\n logical(kind=KIND) function parity(mask, dim)\n\n type(logical(kind=KIND)),intent(in) :: mask(..)\n type(integer(kind=**)),intent(in),optional :: dim\n```\n### **Characteristics**\n\n - **mask** is a _logical_ array\n - **dim** is an integer scalar\n - the result is of type _logical_ with the same kind type parameter as **mask**.\n It is a scalar if **dim** does not appear; otherwise it is the rank and shape\n of **mask** with the dimension specified by **dim** removed.\n - a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n**parity** calculates the parity array (i.e. the reduction using .neqv.) of\n**mask** along dimension **dim** if **dim** is present and not 1. Otherwise, it\nreturns the parity of the entire **mask** array as a scalar.\n\n### **Options**\n\n - **mask**\n : Shall be an array of type _logical_.\n\n - **dim**\n : (Optional) shall be a scalar of type _integer_ with a value in the\n range from _1 to n_, where _n_ equals the rank of **mask**.\n\n### **Result**\n\n The result is of the same type as **mask**.\n\n If **dim** is absent, a scalar with the parity of all elements in **mask**\n is returned: _.true._ if an odd number of elements are _.true._\n and _.false._ otherwise.\n\n If MASK has rank one, PARITY (MASK, DIM) is equal to PARITY (MASK). Otherwise, the\n result is an array of parity values with dimension **dim** dropped.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_parity\nimplicit none\nlogical, parameter :: T=.true., F=.false.\nlogical :: x(3,4)\n ! basics\n print *, parity([T,F])\n print *, parity([T,F,F])\n print *, parity([T,F,F,T])\n print *, parity([T,F,F,T,T])\n x(1,:)=[T,T,T,T]\n x(2,:)=[T,T,T,T]\n x(3,:)=[T,T,T,T]\n print *, parity(x)\n print *, parity(x,dim=1)\n print *, parity(x,dim=2)\nend program demo_parity\n```\nResults:\n```text\n > T\n > T\n > F\n > T\n > F\n > T T T T\n > F F F\n```\n### **Standard**\n\nFortran 2008\n\n### **See also**\n\n - [**all**(3)](#all) - Determines if all the values are true\n - [**any**(3)](#any) - Determines if any of the values in the logical array are _.true._\n - [**count**(3)](#count) - Count true values in an array\n - [**sum**(3)](#sum) - Sum the elements of an array\n - [**maxval**(3)](#maxval) - Determines the maximum value in an array or row\n - [**minval**(3)](#minval) - Minimum value of an array\n - [**product**(3)](#product) - Product of array elements\n - [**reduce**(3)](#reduce) - General array reduction\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", @@ -157,6 +156,7 @@ "PRESENT": "## present\n\n### **Name**\n\n**present** - [STATE:INQUIRY\\] Determine whether an optional dummy argument\nis specified\n\n### **Synopsis**\n```fortran\n result = present(a)\n```\n```fortran\n logical function present (a)\n\n type(TYPE(kind=KIND)) :: a(..)\n```\n### **Characteristics**\n\n- **a** May be of any type and may be a pointer, scalar or array value,\n or a dummy procedure.\n\n### **Description**\n\n **present** can be used in a procedure to determine if an optional\n dummy argument was present on the current call to the procedure.\n\n **a** shall be the name of an optional dummy argument that is accessible\n in the subprogram in which the **present** function reference\n appears. There are no other requirements on **a**.\n\n Note when an argument is not present when the current procedure is\n invoked, you may only pass it as an optional argument to another\n procedure or pass it as an argument to **present**.\n\n### **Options**\n\n- **a**\n : the name of an optional dummy argument accessible within the current\n subroutine or function.\n\n### **Result**\n\n Returns _.true._ if the optional argument **a** is present (was passed\n on the call to the procedure) , or _.false._ otherwise.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_present\nimplicit none\ninteger :: answer\n ! argument to func() is not present\n answer=func()\n write(*,*) answer\n ! argument to func() is present\n answer=func(1492)\n write(*,*) answer\ncontains\n!\ninteger function func(x)\n! the optional characteristic on this definition allows this variable\n! to not be specified on a call; and also allows it to subsequently\n! be passed to PRESENT(3):\ninteger, intent(in), optional :: x\ninteger :: x_local\n !\n ! basic\n if(present(x))then\n ! if present, you can use x like any other variable.\n x_local=x\n else\n ! if not, you cannot define or reference x except to\n ! pass it as an optional parameter to another procedure\n ! or in a call to present(3f)\n x_local=0\n endif\n !\n func=x_local**2\n !\n ! passing the argument on to other procedures\n ! so something like this is a bad idea because x is used\n ! as the first argument to merge(3f) when it might not be\n ! present\n ! xlocal=merge(x,0,present(x)) ! NO!!\n !\n ! We can pass it to another procedure if another\n ! procedure declares the argument as optional as well,\n ! or we have tested that X is present\n call tattle('optional argument x',x)\n if(present(x))call not_optional(x)\nend function\n!\nsubroutine tattle(label,arg)\ncharacter(len=*),intent(in) :: label\ninteger,intent(in),optional :: arg\n if(present(arg))then\n write(*,*)label,' is present'\n else\n write(*,*)label,' is not present'\n endif\nend subroutine tattle\n!\nsubroutine not_optional(arg)\ninteger,intent(in) :: arg\n write(*,*)'already tested X is defined',arg\nend subroutine not_optional\n!\nend program demo_present\n```\nResults:\n```text\n optional argument x is not present\n 0\n optional argument x is present\n already tested X is defined 1492\n 2226064\n```\n### **Standard**\n\nFortran 95\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "PRODUCT": "## product\n\n### **Name**\n\n**product** - \\[ARRAY:REDUCTION\\] Product of array elements\n\n### **Synopsis**\n```fortran\n result = product(array [,dim] [,mask])\n```\n```fortran\n NUMERIC function product(array, dim, mask)\n\n NUMERIC,intent(in) :: array(..)\n integer(kind=**),intent(in),optional :: dim\n logical(kind=**),intent(in),optional :: mask(..)\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n - **NUMERIC** is any numeric type and kind.\n\n### **Description**\n\n**product** multiplies together all the selected elements of **array**,\nor along dimension **dim** if the corresponding element in **mask**\nis _.true._.\n\nIf **dim** is absent, a scalar with the product of all elements in **array** is\nreturned. (Note a zero-sized **array** returns **1**).\n\nWhen **dim** is present, If the masked array has a dimension of one\n(ie. is a vector) the result is a scalar. Otherwise, an array of rank\n**n-1**, where **n** equals the rank of **array**, and a shape similar\nto that of **array** with dimension **dim** dropped is returned.\n\n### **Options**\n\n- **array**\n : Shall be an array of type _integer_, _real_ or _complex_.\n\n- **dim**\n : shall be a scalar of type _integer_ with a value in the\n range from **1 to n**, where **n** equals the rank of **array**.\n\n- **mask**\n : shall be of type _logical_ and either be a scalar or an\n array of the same shape as **array**.\n\n### **Result**\n\nThe result is of the same type as **array**.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_product\nimplicit none\ncharacter(len=*),parameter :: all='(*(g0,1x))' ! a handy format\ncharacter(len=1),parameter :: nl=new_line('a')\n\nNO_DIM: block\n! If DIM is not specified, the result is the product of all the\n! selected array elements.\ninteger :: i,n, p1, p2\ninteger,allocatable :: array(:)\n ! all elements are selected by default\n do n=1,10\n print all, 'factorial of ',n,' is ', product([(real(i),i=1,n)])\n enddo\n\n ! using a mask\n array=[10,12,13,15,20,25,30]\n p1=product(array, mask=mod(array, 2)==1) ! only odd elements\n p2=product(array, mask=mod(array, 2)/=1) ! only even elements\n print all, nl,'product of all elements',product(array) ! all elements\n print all, ' odd * even =',nl,p1,'*',p2,'=',p1*p2\n\n ! NOTE: If ARRAY is a zero-sized array, the result is equal to one\n print all\n print all, 'zero-sized array=>',product([integer :: ])\n ! NOTE: If nothing in the mask is true, this also results in a null\n ! array\n print all, 'all elements have a false mask=>', &\n & product(array,mask=.false.)\n\nendblock NO_DIM\n\nWITH_DIM: block\ninteger :: rect(2,3)\ninteger :: box(2,3,4)\n\n! lets fill a few arrays\n rect = reshape([ &\n 1, 2, 3, &\n 4, 5, 6 &\n ],shape(rect),order=[2,1])\n call print_matrix_int('rect',rect)\n\n! Find the product of each column in RECT.\n print all, 'product of columns=',product(rect, dim = 1)\n\n! Find the product of each row in RECT.\n print all, 'product of rows=',product(rect, dim = 2)\n\n! now lets try a box\n box(:,:,1)=rect\n box(:,:,2)=rect*(+10)\n box(:,:,3)=rect*(-10)\n box(:,:,4)=rect*2\n ! lets look at the values\n call print_matrix_int('box 1',box(:,:,1))\n call print_matrix_int('box 2',box(:,:,2))\n call print_matrix_int('box 3',box(:,:,3))\n call print_matrix_int('box 4',box(:,:,4))\n\n ! remember without dim= even a box produces a scalar\n print all, 'no dim gives a scalar',product(real(box))\n\n ! only one plane has negative values, so note all the \"1\" values\n ! for vectors with no elements\n call print_matrix_int('negative values', &\n & product(box,mask=box < 0,dim=1))\n\n! If DIM is specified and ARRAY has rank greater than one, the\n! result is a new array in which dimension DIM has been eliminated.\n\n ! pick a dimension to multiply though\n call print_matrix_int('dim=1',product(box,dim=1))\n\n call print_matrix_int('dim=2',product(box,dim=2))\n\n call print_matrix_int('dim=3',product(box,dim=3))\n\nendblock WITH_DIM\n\ncontains\n\n subroutine print_matrix_int(title,arr)\n implicit none\n\n !@(#) print small 2d integer arrays in row-column format\n\n character(len=*),intent(in) :: title\n integer,intent(in) :: arr(:,:)\n integer :: i\n character(len=:),allocatable :: biggest\n\n print all\n print all, trim(title),':(',shape(arr),')' ! print title\n biggest=' ' ! make buffer to write integer into\n ! find how many characters to use for integers\n write(biggest,'(i0)')ceiling(log10(real(maxval(abs(arr)))))+2\n ! use this format to write a row\n biggest='(\" > [\",*(i'//trim(biggest)//':,\",\"))'\n ! print one row of array at a time\n do i=1,size(arr,dim=1)\n write(*,fmt=biggest,advance='no')arr(i,:)\n write(*,'(\" ]\")')\n enddo\n\n end subroutine print_matrix_int\n\nend program demo_product\n```\n\nResults:\n\n```text\nfactorial of 1 is 1.000000\nfactorial of 2 is 2.000000\nfactorial of 3 is 6.000000\nfactorial of 4 is 24.00000\nfactorial of 5 is 120.0000\nfactorial of 6 is 720.0000\nfactorial of 7 is 5040.000\nfactorial of 8 is 40320.00\nfactorial of 9 is 362880.0\nfactorial of 10 is 3628800.\n\n product of all elements 351000000\n odd * even =\n 4875 * 72000 = 351000000\n\nzero-sized array=> 1\nall elements have a false mask=> 1\n\nrect :( 2 3 )\n > [ 1, 2, 3 ]\n > [ 4, 5, 6 ]\nproduct of columns= 4 10 18\nproduct of rows= 6 120\n\nbox 1 :( 2 3 )\n > [ 1, 2, 3 ]\n > [ 4, 5, 6 ]\n\nbox 2 :( 2 3 )\n > [ 10, 20, 30 ]\n > [ 40, 50, 60 ]\n\nbox 3 :( 2 3 )\n > [ -10, -20, -30 ]\n > [ -40, -50, -60 ]\n\nbox 4 :( 2 3 )\n > [ 2, 4, 6 ]\n > [ 8, 10, 12 ]\nno dim gives a scalar .1719927E+26\n\nnegative values :( 3 4 )\n > [ 1, 1, 400, 1 ]\n > [ 1, 1, 1000, 1 ]\n > [ 1, 1, 1800, 1 ]\n\ndim=1 :( 3 4 )\n > [ 4, 400, 400, 16 ]\n > [ 10, 1000, 1000, 40 ]\n > [ 18, 1800, 1800, 72 ]\n\ndim=2 :( 2 4 )\n > [ 6, 6000, -6000, 48 ]\n > [ 120, 120000, -120000, 960 ]\n\ndim=3 :( 2 3 )\n > [ -200, -3200, -16200 ]\n > [ -51200, -125000, -259200 ]\n```\n\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**sum**(3)](#sum), note that an element by element multiplication is done\ndirectly using the star character.\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "RADIX": "## radix\n\n### **Name**\n\n**radix** - \\[NUMERIC MODEL\\] Base of a numeric model\n\n### **Synopsis**\n```fortran\n result = radix(x)\n```\n```fortran\n integer function radix(x)\n\n TYPE(kind=**),intent(in) :: x(..)\n```\n### **Characteristics**\n\n - **x** may be scalar or an array of any _real_ or _integer_ type.\n - the result is a default integer scalar.\n\n### **Description**\n\n **radix** returns the base of the internal model representing the\n numeric entity **x**.\n\n In a positional numeral system, the radix or base is the number of\n unique digits, including the digit zero, used to represent numbers.\n\n This function helps to represent the internal computing model\n generically, but will be 2 (representing a binary machine) for any\n common platform for all the numeric types.\n\n### **Options**\n\n- **x**\n : used to identify the type of number to query.\n\n### **Result**\n\n The returned value indicates what base is internally used to represent\n the type of numeric value **x** represents.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_radix\nimplicit none\n print *, \"The radix for the default integer kind is\", radix(0)\n print *, \"The radix for the default real kind is\", radix(0.0)\n print *, \"The radix for the doubleprecision real kind is\", radix(0.0d0)\nend program demo_radix\n```\nResults:\n```text\n > The radix for the default integer kind is 2\n > The radix for the default real kind is 2\n > The radix for the doubleprecision real kind is 2\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**digits**(3)](#digits),\n[**epsilon**(3)](#epsilon),\n[**exponent**(3)](#exponent),\n[**fraction**(3)](#fraction),\n[**huge**(3)](#huge),\n[**maxexponent**(3)](#maxexponent),\n[**minexponent**(3)](#minexponent),\n[**nearest**(3)](#nearest),\n[**precision**(3)](#precision),\n[**range**(3)](#range),\n[**rrspacing**(3)](#rrspacing),\n[**scale**(3)](#scale),\n[**set_exponent**(3)](#set_exponent),\n[**spacing**(3)](#spacing),\n[**tiny**(3)](#tiny)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "RANDOM_INIT": "## random_init\n\n### **Name**\n\n**random_init** - \\[MATHEMATICS:RANDOM\\] Initializes the state of\nthe pseudorandom number generator\n\n### **Synopsis**\n```fortran\n call random_init(repeatable, image_distinct)\n\n logical,intent(in) :: repeatable\n logical,intent(in) :: image_distinct\n```\n### **Characteristics**\n\n- **harvest** and **image_distinct** are logical scalars\n\n### Description\n\nInitializes the state of the pseudorandom number generator used by \n**random_number**.\n\n### **Options**\n\n**repeatable**\n: If it is **.true.**, the seed is set to a processor-dependent\nvalue that is the same each time **random_init** is called from the\nsame image. The term \"same image\" means a single instance of program\nexecution. The sequence of random numbers is different for repeated\nexecution of the program. \n\nIf it is **.false.**, the seed is set to a processor-dependent value.\n\n**image_distinct**\n: If is `.true.`, the seed is set to a processor-dependent value that\nis distinct from the seed set by a call to **random_init**in another\nimage. If it is **.false.**, the seed is set value that does depend\nwhich image called **random_init**.\n\n## **Standard**\n\nFortran 2018\n\n## **Example**\n```fortran\nprogram demo_random_seed\nimplicit none\nreal x(3), y(3)\n call random_init(.true., .true.)\n call random_number(x)\n call random_init(.true., .true.)\n call random_number(y)\n ! x and y should be the same sequence\n if ( any(x /= y) ) stop \"x(:) and y(:) are not all equal\"\nend program demo_random_seed\n```\n## **See also**\n\n[random_number](#random_number),\n[random_seed](random_seed)\n\n _fortran-lang intrinsic descriptions\n", "RANDOM_NUMBER": "## random_number\n\n### **Name**\n\n**random_number** - \\[MATHEMATICS:RANDOM\\] Pseudo-random number\n\n### **Synopsis**\n```fortran\n call random_number(harvest)\n```\n```fortran\n subroutine random_number(harvest)\n\n real,intent(out) :: harvest(..)\n```\n### **Characteristics**\n\n- **harvest** and the result are default _real_ variables\n\n### **Description**\n\n**random_number** returns a single pseudorandom number or an array of\npseudorandom numbers from the uniform distribution over the range\n0 \\<= x \\< 1.\n\n### **Options**\n\n- **harvest**\n : Shall be a scalar or an array of type _real_.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_random_number\nuse, intrinsic :: iso_fortran_env, only : dp=>real64\nimplicit none\ninteger, allocatable :: seed(:)\ninteger :: n\ninteger :: first,last\ninteger :: i\ninteger :: rand_int\ninteger,allocatable :: count(:)\nreal(kind=dp) :: rand_val\n call random_seed(size = n)\n allocate(seed(n))\n call random_seed(get=seed)\n first=1\n last=10\n allocate(count(last-first+1))\n ! To have a discrete uniform distribution on the integers\n ! [first, first+1, ..., last-1, last] carve the continuous\n ! distribution up into last+1-first equal sized chunks,\n ! mapping each chunk to an integer.\n !\n ! One way is:\n ! call random_number(rand_val)\n ! choose one from last-first+1 integers\n ! rand_int = first + FLOOR((last+1-first)*rand_val)\n count=0\n ! generate a lot of random integers from 1 to 10 and count them.\n ! with a large number of values you should get about the same\n ! number of each value\n do i=1,100000000\n call random_number(rand_val)\n rand_int=first+floor((last+1-first)*rand_val)\n if(rand_int.ge.first.and.rand_int.le.last)then\n count(rand_int)=count(rand_int)+1\n else\n write(*,*)rand_int,' is out of range'\n endif\n enddo\n write(*,'(i0,1x,i0)')(i,count(i),i=1,size(count))\nend program demo_random_number\n```\nResults:\n```\n 1 10003588\n 2 10000104\n 3 10000169\n 4 9997996\n 5 9995349\n 6 10001304\n 7 10001909\n 8 9999133\n 9 10000252\n 10 10000196\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**random_seed**(3)](#random_seed)\n\n _fortran-lang intrinsic descriptions_\n", "RANDOM_SEED": "## random_seed\n\n### **Name**\n\n**random_seed** - \\[MATHEMATICS:RANDOM\\] Initialize a pseudo-random number sequence\n\n### **Synopsis**\n```fortran\n call random_seed( [size] [,put] [,get] )\n```\n```fortran\n subroutine random_seed( size, put, get )\n\n integer,intent(out),optional :: size\n integer,intent(in),optional :: put(*)\n integer,intent(out),optional :: get(*)\n```\n### **Characteristics**\n - **size** a scalar default _integer_\n - **put** a rank-one default _integer_ array\n - **get** a rank-one default _integer_ array\n - the result\n\n### **Description**\n\n**random_seed** restarts or queries the state of the pseudorandom\nnumber generator used by random_number.\n\nIf random_seed is called without arguments, it is seeded with random\ndata retrieved from the operating system.\n\n### **Options**\n\n- **size**\n : specifies the minimum size of the arrays used with the **put**\n and **get** arguments.\n\n- **put**\n : the size of the array must be larger than or equal to the number\n returned by the **size** argument.\n\n- **get**\n : It is **intent(out)** and the size of the array must be larger than\n or equal to the number returned by the **size** argument.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_random_seed\nimplicit none\ninteger, allocatable :: seed(:)\ninteger :: n\n\n call random_seed(size = n)\n allocate(seed(n))\n call random_seed(get=seed)\n write (*, *) seed\n\nend program demo_random_seed\n```\nResults:\n```text\n -674862499 -1750483360 -183136071 -317862567 682500039\n 349459 344020729 -1725483289\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**random_number**(3)](#random_number)\n\n _fortran-lang intrinsic descriptions_\n", "RANGE": "## range\n\n### **Name**\n\n**range** - \\[NUMERIC MODEL\\] Decimal exponent range of a numeric kind\n\n### **Synopsis**\n```fortran\n result = range(x)\n```\n```fortran\n integer function range (x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - **x** may be of type _integer_, _real_, or _complex_. It may be a scalar or an array.\n - **KIND** is any kind supported by the type of **x**\n - the result is a default _integer_ scalar\n\n### **Description**\n\n **range** returns the decimal exponent range in the model of the\n type of **x**.\n\n Since **x** is only used to determine the type and kind being\n interrogated, the value need not be defined.\n\n### **Options**\n\n- **x**\n : the value whose type and kind are used for the query\n\n### **Result**\n\n Case (i)\n : For an integer argument, the result has the value\n```fortran\n int (log10 (huge(x)))\n```\n Case (ii)\n : For a real argument, the result has the value\n```fortran\n int(min (log10 (huge(x)), -log10(tiny(x) )))\n ```\n Case (iii)\n : For a complex argument, the result has the value\n```fortran\n range(real(x))\n```\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_range\nuse,intrinsic :: iso_fortran_env, only : dp=>real64,sp=>real32\nimplicit none\nreal(kind=sp) :: x(2)\ncomplex(kind=dp) :: y\n print *, precision(x), range(x)\n print *, precision(y), range(y)\nend program demo_range\n```\nResults:\n```text\n > 6 37\n > 15 307\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**digits**(3)](#digits),\n[**epsilon**(3)](#epsilon),\n[**exponent**(3)](#exponent),\n[**fraction**(3)](#fraction),\n[**huge**(3)](#huge),\n[**maxexponent**(3)](#maxexponent),\n[**minexponent**(3)](#minexponent),\n[**nearest**(3)](#nearest),\n[**precision**(3)](#precision),\n[**radix**(3)](#radix),\n[**rrspacing**(3)](#rrspacing),\n[**scale**(3)](#scale),\n[**set_exponent**(3)](#set_exponent),\n[**spacing**(3)](#spacing),\n[**tiny**(3)](#tiny)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", @@ -186,7 +186,7 @@ "SQRT": "## sqrt\n\n### **Name**\n\n**sqrt** - \\[MATHEMATICS\\] Square-root function\n\n### **Synopsis**\n```fortran\n result = sqrt(x)\n```\n```fortran\n elemental TYPE(kind=KIND) function sqrt(x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - **TYPE** may be _real_ or _complex_.\n - **KIND** may be any kind valid for the declared type.\n - the result has the same characteristics as **x**.\n\n### **Description**\n\n **sqrt** computes the principal square root of **x**.\n\n The number whose square root is being considered is known as the\n _radicand_.\n\n In mathematics, a square root of a radicand **x** is a number **y**\n such that **y\\*y = x**.\n\n Every nonnegative radicand **x** has two square roots of the same unique\n magnitude, one positive and one negative. The nonnegative square root\n is called the principal square root.\n\n The principal square root of 9 is 3, for example, even though (-3)\\*(-3)\n is also 9.\n\n Square roots of negative numbers are a special case of complex numbers,\n where with **complex** input the components of the _radicand_ need\n not be positive in order to have a valid square root.\n\n### **Options**\n\n- **x**\n : The radicand to find the principal square root of.\n If **x** is _real_ its value must be greater than or equal to zero.\n\n### **Result**\n\n The principal square root of **x** is returned.\n\n For a _complex_ result the real part is greater than or equal to zero.\n\n When the real part of the result is zero, the imaginary part has the\n same sign as the imaginary part of **x**.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_sqrt\nuse, intrinsic :: iso_fortran_env, only : real_kinds, &\n & real32, real64, real128\nimplicit none\nreal(kind=real64) :: x, x2\ncomplex :: z, z2\n\n ! basics\n x = 2.0_real64\n ! complex\n z = (1.0, 2.0)\n write(*,*)'input values ',x,z\n\n x2 = sqrt(x)\n z2 = sqrt(z)\n write(*,*)'output values ',x2,z2\n\n ! elemental\n write(*,*)'elemental',sqrt([64.0,121.0,30.0])\n\n ! alternatives\n x2 = x**0.5\n z2 = z**0.5\n write(*,*)'alternatively',x2,z2\n\nend program demo_sqrt\n```\nResults:\n```text\n input values 2.00000000000000 (1.000000,2.000000)\n output values 1.41421356237310 (1.272020,0.7861513)\n elemental 8.000000 11.00000 5.477226\n alternatively 1.41421356237310 (1.272020,0.7861513)\n```\n### **Standard**\n\nFORTRAN 77\n\n### **See also**\n\n[**exp**(3)](#exp),\n[**log**(3)](#log),\n[**log10**(3)](#log10)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "STORAGE_SIZE": "\n## storage_size\n\n### **Name**\n\n**storage_size** - \\[BIT:INQUIRY\\] Storage size in bits\n\n### **Synopsis**\n```fortran\n result = storage_size(a [,KIND] )\n```\n```fortran\n integer(kind=KIND) storage_size(a,KIND)\n\n type(TYPE(kind=**)) :: a\n integer,intent(in),optional :: KIND\n```\n### **Characteristics**\n - a kind designated as ** may be any supported kind for the type\n\n - **a** may be of any type and kind. If it is polymorphic it shall not\n be an undefined pointer. If it is unlimited polymorphic or has any\n deferred type parameters, it shall not be an unallocated allocatable\n variable or a disassociated or undefined pointer.\n\n - The kind type parameter of the returned value is that specified by\n the value of **kind**; otherwise, the kind type parameter is that of\n default integer type.\n\n - The result is an _integer_ scalar of default kind unless **kind** is\n specified, in which case it has the kind specified by **kind**.\n\n### **Description**\n\n**storage_size** returns the storage size of argument **a** in bits.\n\n### **Options**\n\n- **a**\n : The entity to determine the storage size of\n\n- **kind**\n : a scalar integer constant expression that defines the kind of the\n output value.\n\n### **Result**\n\n The result value is the size expressed in bits for an element of an\n array that has the dynamic type and type parameters of **a**.\n\n If the type and type parameters are such that storage association\n applies, the result is consistent with the named constants\n defined in the intrinsic module ISO_FORTRAN_ENV.\n\n NOTE1\n\n An array element might take \"type\" more bits to store than an isolated\n scalar, since any hardware-imposed alignment requirements for array\n elements might not apply to a simple scalar variable.\n\n NOTE2\n\n This is intended to be the size in memory that an object takes when it\n is stored; this might differ from the size it takes during expression\n handling (which might be the native register size) or when stored in a\n file. If an object is never stored in memory but only in a register,\n this function nonetheless returns the size it would take if it were\n stored in memory.\n\n### **Examples**\n\nSample program\n```fortran\nprogram demo_storage_size\nimplicit none\n\n ! a default real, integer, and logical are the same storage size\n write(*,*)'size of integer ',storage_size(0)\n write(*,*)'size of real ',storage_size(0.0)\n write(*,*)'size of logical ',storage_size(.true.)\n write(*,*)'size of complex ',storage_size((0.0,0.0))\n\n ! note the size of an element of the array, not the storage size of\n ! the entire array is returned for array arguments\n write(*,*)'size of integer array ',storage_size([0,1,2,3,4,5,6,7,8,9])\n\nend program demo_storage_size\n```\nResults:\n```text\n size of integer 32\n size of real 32\n size of logical 32\n size of complex 64\n size of integer array 32\n```\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**c_sizeof**(3)](#c_sizeof)\n\n _fortran-lang intrinsic descriptions_\n", "SUM": "## sum\n\n### **Name**\n\n**sum** - \\[ARRAY:REDUCTION\\] Sum the elements of an array\n\n### **Synopsis**\n```fortran\n result = sum(array [,dim[,mask]] | [mask] )\n```\n```fortran\n TYPE(kind=KIND) function sum(array, dim, mask)\n\n TYPE(kind=KIND),intent(in) :: array(..)\n integer(kind=**),intent(in),optional :: dim\n logical(kind=**),intent(in),optional :: mask(..)\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n - **array** may be of any numeric type - _integer_, _real_ or _complex_.\n - **dim** is an _integer_\n - **mask** is _logical_ and conformable with **array**.\n - The result is of the same type and kind as **array**. It is scalar\n if **dim** is not present or **array** is a vector, else it is an array.\n\n### **Description**\n\n **sum** adds the elements of **array**.\n\n When only **array** is specified all elements are summed, but groups\n of sums may be returned along the dimension specified by **dim**\n and/or elements to add may be selected by a logical mask.\n\n No method is designated for how the sum is conducted, so whether or not\n accumulated error is compensated for is processor-dependent.\n\n### **Options**\n\n- **array**\n : an array containing the elements to add\n\n- **dim**\n : a value in the range from 1 to n, where n equals the rank (the number\n of dimensions) of **array**. **dim** designates the dimension\n along which to create sums. When absent a scalar sum of the elements\n optionally selected by **mask** is returned.\n\n- **mask**\n : an array of the same shape as **array** that designates\n which elements to add. If absent all elements are used in the sum(s).\n\n### **Result**\n\n If **dim** is absent, a scalar with the sum of all selected elements\n in **array** is returned. Otherwise, an array of rank n-1, where n\n equals the rank of **array**, and a shape similar to that of **array**\n with dimension **dim** dropped is returned. Since a vector has a rank\n of one, the result is a scalar (if n==1, n-1 is zero; and a rank of\n zero means a scalar).\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_sum\nimplicit none\ninteger :: vector(5) , matrix(3,4), box(5,6,7)\n\n vector = [ 1, 2, -3, 4, 5 ]\n\n matrix(1,:)=[ -1, 2, -3, 4 ]\n matrix(2,:)=[ 10, -20, 30, -40 ]\n matrix(3,:)=[ 100, 200, -300, 400 ]\n\n box=11\n\n ! basics\n print *, 'sum all elements:',sum(vector)\n print *, 'real :',sum([11.0,-5.0,20.0])\n print *, 'complex :',sum([(1.1,-3.3),(4.0,5.0),(8.0,-6.0)])\n ! with MASK option\n print *, 'sum odd elements:',sum(vector, mask=mod(vector, 2)==1)\n print *, 'sum positive values:', sum(vector, mask=vector>0)\n\n call printi('the input array', matrix )\n call printi('sum of all elements in matrix', sum(matrix) )\n call printi('sum of positive elements', sum(matrix,matrix>=0) )\n ! along dimensions\n call printi('sum along rows', sum(matrix,dim=1) )\n call printi('sum along columns', sum(matrix,dim=2) )\n call printi('sum of a vector is always a scalar', sum(vector,dim=1) )\n call printi('sum of a volume by row', sum(box,dim=1) )\n call printi('sum of a volume by column', sum(box,dim=2) )\n call printi('sum of a volume by depth', sum(box,dim=3) )\n\ncontains\n! CONVENIENCE ROUTINE; NOT DIRECTLY CONNECTED TO SPREAD(3)\nsubroutine printi(title,a)\nuse, intrinsic :: iso_fortran_env, only : stderr=>ERROR_UNIT,&\n & stdin=>INPUT_UNIT, stdout=>OUTPUT_UNIT\nimplicit none\n\n!@(#) print small 2d integer scalar, vector, matrix in row-column format\n\ncharacter(len=*),intent(in) :: title\ninteger,intent(in) :: a(..)\n\ncharacter(len=*),parameter :: all='(\" \",*(g0,1x))'\ncharacter(len=20) :: row\ninteger,allocatable :: b(:,:)\ninteger :: i\n write(*,all,advance='no')trim(title)\n ! copy everything to a matrix to keep code simple\n select rank(a)\n rank (0); write(*,'(a)')' (a scalar)'; b=reshape([a],[1,1])\n rank (1); write(*,'(a)')' (a vector)'; b=reshape(a,[size(a),1])\n rank (2); write(*,'(a)')' (a matrix)'; b=a\n rank default; stop '*printi* unexpected rank'\n end select\n ! find how many characters to use for integers\n write(row,'(i0)')ceiling(log10(real(maxval(abs(b)))))+2\n ! use this format to write a row\n row='(\" > [\",*(i'//trim(row)//':,\",\"))'\n do i=1,size(b,dim=1)\n write(*,fmt=row,advance='no')b(i,:)\n write(*,'(\" ]\")')\n enddo\n write(*,all) '>shape=',shape(a),',rank=',rank(a),',size=',size(a)\n write(*,*)\nend subroutine printi\nend program demo_sum\n```\nResults:\n```text\n sum all elements: 9\n real : 26.00000\n complex : (13.10000,-4.300000)\n sum odd elements: 6\n sum positive values: 12\n the input array (a matrix)\n > [ -1, 2, -3, 4 ]\n > [ 10, -20, 30, -40 ]\n > [ 100, 200, -300, 400 ]\n >shape= 3 4 ,rank= 2 ,size= 12\n\n sum of all elements in matrix (a scalar)\n > [ 382 ]\n >shape= ,rank= 0 ,size= 1\n\n sum of positive elements (a scalar)\n > [ 746 ]\n >shape= ,rank= 0 ,size= 1\n\n sum along rows (a vector)\n > [ 109 ]\n > [ 182 ]\n > [ -273 ]\n > [ 364 ]\n >shape= 4 ,rank= 1 ,size= 4\n\n sum along columns (a vector)\n > [ 2 ]\n > [ -20 ]\n > [ 400 ]\n >shape= 3 ,rank= 1 ,size= 3\n\n sum of a vector is always a scalar (a scalar)\n > [ 9 ]\n >shape= ,rank= 0 ,size= 1\n\n sum of a volume by row (a matrix)\n > [ 55, 55, 55, 55, 55, 55, 55 ]\n > [ 55, 55, 55, 55, 55, 55, 55 ]\n > [ 55, 55, 55, 55, 55, 55, 55 ]\n > [ 55, 55, 55, 55, 55, 55, 55 ]\n > [ 55, 55, 55, 55, 55, 55, 55 ]\n > [ 55, 55, 55, 55, 55, 55, 55 ]\n >shape= 6 7 ,rank= 2 ,size= 42\n\n sum of a volume by column (a matrix)\n > [ 66, 66, 66, 66, 66, 66, 66 ]\n > [ 66, 66, 66, 66, 66, 66, 66 ]\n > [ 66, 66, 66, 66, 66, 66, 66 ]\n > [ 66, 66, 66, 66, 66, 66, 66 ]\n > [ 66, 66, 66, 66, 66, 66, 66 ]\n >shape= 5 7 ,rank= 2 ,size= 35\n\n sum of a volume by depth (a matrix)\n > [ 77, 77, 77, 77, 77, 77 ]\n > [ 77, 77, 77, 77, 77, 77 ]\n > [ 77, 77, 77, 77, 77, 77 ]\n > [ 77, 77, 77, 77, 77, 77 ]\n > [ 77, 77, 77, 77, 77, 77 ]\n >shape= 5 6 ,rank= 2 ,size= 30\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n - [**all**(3)](#all) - Determines if all the values are true\n - [**any**(3)](#any) - Determines if any of the values in the logical array are true.\n - [**count**(3)](#count) - Count true values in an array\n - [**maxval**(3)](#maxval) - Determines the maximum value in an array\n - [**minval**(3)](#minval) - Minimum value of an array\n - [**product**(3)](#product) - Product of array elements\n - [**merge**(3)](#merge) - Merge variables\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", - "SYSTEM_CLOCK": "## system_clock\n\n### **Name**\n\n**system_clock** - \\[SYSTEM:TIME\\] Query system clock\n\n### **Synopsis**\n```fortran\n call system_clock([count] [,count_rate] [,count_max] )\n```\n```fortran\n subroutine system_clock(count, count_rate, count_max)\n\n integer,intent(out),optional :: count\n type(TYPE(kind=KIND),intent(out),optional :: count_rate\n integer,intent(out),optional :: count_max\n```\n### **Characteristics**\n\n - **count** is an _integer_ scalar\n - **count_rate** an _integer_ or _real_ scalar\n - **count_max** an _integer_ scalar\n\n\n### **Description**\n\n **system_clock** lets you measure durations of time with the\n precision of the smallest time increment generally available on a\n system by returning processor-dependent values based on the current\n value of the processor clock.\n\n **system_clock** is typically used to measure short time intervals\n (system clocks may be 24-hour clocks or measure processor clock ticks\n since boot, for example). It is most often used for measuring or\n tracking the time spent in code blocks in lieu of using profiling tools.\n\n **count_rate** and **count_max** are assumed constant (even though\n CPU rates can vary on a single platform).\n\n The accuracy of the measurements may depend on the kind of the arguments!\n\n Whether an image has no clock, has a single clock of its own, or shares\n a clock with another image, is processor dependent.\n\n If there is no clock, or querying the clock fails, **count** is set to\n **-huge(count)**, and **count_rate** and **count_max** are set to zero.\n\n### **Options**\n\n- **count**\n\n If there is no clock, **count** is returned as the negative value\n **-huge(count)**.\n\n Otherwise, the **clock** value is incremented by one for each clock\n count until the value **count_max** is reached and is then reset to\n zero at the next count. **clock** therefore is a modulo value that\n lies in the range **0 to count_max**.\n\n- **count_rate**\n : is assigned a processor-dependent approximation to the number of\n processor clock counts per second, or zero if there is no clock.\n **count_rate** is system dependent and can vary depending on the kind\n of the arguments. Generally, a large _real_ may generate a more precise\n interval.\n\n- **count_max**\n : is assigned the maximum\n value that **COUNT** can have, or zero if there is no clock.\n\n### **Examples**\n\n If the processor clock is a 24-hour clock that registers time at\n approximately 18.20648193 ticks per second, at 11:30 A.M. the reference\n\n```fortran\n call system_clock (count = c, count_rate = r, count_max = m)\n```\n defines\n```text\n C = (11*3600+30*60)*18.20648193 = 753748,\n R = 18.20648193, and\n M = 24*3600*18.20648193-1 = 1573039.\n```\n\nSample program:\n```fortran\nprogram demo_system_clock\nuse, intrinsic :: iso_fortran_env, only : wp=>real64,int32,int64\nimplicit none\ncharacter(len=*),parameter :: g='(1x,*(g0,1x))'\ninteger(kind=int64) :: count64, count_rate64, count_max64\ninteger(kind=int64) :: start64, finish64\ninteger(kind=int32) :: count32, count_rate32, count_max32\ninteger(kind=int32) :: start32, finish32\nreal(kind=wp) :: time_read\nreal(kind=wp) :: sum\ninteger :: i\n\n print g,'accuracy may vary with argument type!'\n call system_clock(count_rate=count_rate64)\n print g,'COUNT RATE FOR INT64:',count_rate64\n call system_clock(count_rate=count_rate32)\n print g,'COUNT RATE FOR INT32:',count_rate32\n\n print g,'query all arguments'\n call system_clock(count64, count_rate64, count_max64)\n print g, 'COUNT_MAX=',count_max64\n print g, 'COUNT_RATE=',count_rate64\n print g, 'CURRENT COUNT=',count64\n\n print g,'time some computation'\n call system_clock(start64)\n\n ! some code to time\n sum=0.0_wp\n do i=-huge(0)-1, huge(0)-1, 10\n sum=sum+sqrt(real(i))\n enddo\n print g,'SUM=',sum\n\n call system_clock(finish64)\n\n time_read=(finish64-start64)/real(count_rate64,wp)\n write(*,'(a30,1x,f7.4,1x,a)') 'time : ', time_read, ' seconds'\n\nend program demo_system_clock\n```\nResults:\n```text\n accuracy may vary with argument type!\n COUNT RATE FOR INT64: 1000000000\n COUNT RATE FOR INT32: 1000\n query all arguments\n COUNT_MAX= 9223372036854775807\n COUNT_RATE= 1000000000\n CURRENT COUNT= 518240530647469\n time some computation\n SUM= NaN\n time : 1.6686 seconds\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**date_and_time**(3)](#date_and_time),\n[**cpu_time**(3)](#cpu_time)\n\n _fortran-lang intrinsic descriptions_\n", + "SYSTEM_CLOCK": "## system_clock\n\n### **Name**\n\n**system_clock** - \\[SYSTEM:TIME\\] Query system clock\n\n### **Synopsis**\n```fortran\n call system_clock([count] [,count_rate] [,count_max] )\n```\n```fortran\n subroutine system_clock(count, count_rate, count_max)\n\n integer(kind=**),intent(out),optional :: count\n type(TYPE(kind=**),intent(out),optional :: count_rate\n integer(kind=**),intent(out),optional :: count_max\n```\n### **Characteristics**\n\n - **count** is an _integer_ scalar\n - **count_rate** is an _integer_ or _real_ scalar\n - **count_max** is an _integer_ scalar\n\n### **Description**\n\n **system_clock** lets you measure durations of time with the\n precision of the smallest time increment generally available on a\n system by returning processor-dependent values based on the current\n value of the processor clock.\n\n **system_clock** is typically used to measure short time intervals\n (system clocks may be 24-hour clocks or measure processor clock ticks\n since boot, for example). It is most often used for measuring or\n tracking the time spent in code blocks in lieu of using profiling tools.\n\n **count_rate** and **count_max** are assumed constant (even though\n CPU rates can vary on a single platform).\n\n Whether an image has no clock, has a single clock of its own, or shares\n a clock with another image, is processor dependent.\n\n If there is no clock, or querying the clock fails, **count** is set to\n **-huge(count)**, and **count_rate** and **count_max** are set to zero.\n\n The accuracy of the measurements may depend on the kind of the\n arguments!\n\n Timing-related procedures are obviously processor and system-dependent.\n More specific information may generally be found in compiler-specific\n documentation.\n\n### **Options**\n\n- **count**\n If there is no clock, the returned value for **count** is the negative\n value **-huge(count)**.\n\n Otherwise, the **clock** value is incremented by one for each clock\n count until the value **count_max** is reached and is then reset to\n zero at the next count. **clock** therefore is a modulo value that\n lies in the range **0 to count_max**.\n\n- **count_rate**\n : is assigned a processor-dependent approximation to the number of\n processor clock counts per second, or zero if there is no clock.\n **count_rate** is system dependent and can vary depending on the kind\n of the arguments. Generally, a large _real_ may generate a more precise\n interval.\n\n- **count_max**\n : is assigned the maximum value that **COUNT** can have, or zero if\n there is no clock.\n\n### **Examples**\n\n If the processor clock is a 24-hour clock that registers time at\n approximately 18.20648193 ticks per second, at 11:30 A.M. the reference\n\n```fortran\n call system_clock (count = c, count_rate = r, count_max = m)\n```\n defines\n```text\n C = (11*3600+30*60)*18.20648193 = 753748,\n R = 18.20648193, and\n M = 24*3600*18.20648193-1 = 1573039.\n```\n\nSample program:\n```fortran\nprogram demo_system_clock\nuse, intrinsic :: iso_fortran_env, only: wp => real64, int32, int64\nimplicit none\ncharacter(len=*), parameter :: g = '(1x,*(g0,1x))'\n\ninteger(kind=int64) :: count64, count_rate64, count_max64\ninteger(kind=int64) :: start64, finish64\n\ninteger(kind=int32) :: count32, count_rate32, count_max32\ninteger(kind=int32) :: start32, finish32\n\nreal(kind=wp) :: time_read\nreal(kind=wp) :: sum\ninteger :: i\n\n print g, 'accuracy may vary with argument type!'\n\n print g, 'query all arguments'\n\n call system_clock(count64, count_rate64, count_max64)\n print g, 'COUNT_MAX(64bit)=', count_max64\n print g, 'COUNT_RATE(64bit)=', count_rate64\n print g, 'CURRENT COUNT(64bit)=', count64\n\n call system_clock(count32, count_rate32, count_max32)\n print g, 'COUNT_MAX(32bit)=', count_max32\n print g, 'COUNT_RATE(32bit)=', count_rate32\n print g, 'CURRENT COUNT(32bit)=', count32\n\n print g, 'time some computation'\n call system_clock(start64)\n\n ! some code to time\n sum = 0.0_wp\n do i = -0, huge(0) - 1\n sum = sum + sqrt(real(i))\n end do\n print g, 'SUM=', sum\n\n call system_clock(finish64)\n\n time_read = (finish64 - start64)/real(count_rate64, wp)\n write (*, '(1x,a,1x,g0,1x,a)') 'time : ', time_read, ' seconds'\n\nend program demo_system_clock\n```\nResults:\n```text\n > accuracy may vary with argument type!\n > query all arguments\n > COUNT_MAX(64bit)= 9223372036854775807\n > COUNT_RATE(64bit)= 1000000000\n > CURRENT COUNT(64bit)= 1105422387865806\n > COUNT_MAX(32bit)= 2147483647\n > COUNT_RATE(32bit)= 1000\n > CURRENT COUNT(32bit)= 1105422387\n > time some computation\n > SUM= 66344288183024.266\n > time : 6.1341038460000004 seconds\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**date_and_time**(3)](#date_and_time),\n[**cpu_time**(3)](#cpu_time)\n\n _fortran-lang intrinsic descriptions_\n", "TAN": "## tan\n\n### **Name**\n\n**tan** - \\[MATHEMATICS:TRIGONOMETRIC\\] Tangent function\n\n### **Synopsis**\n```fortran\nresult = tan(x)\n```\n```fortran\n elemental TYPE(kind=KIND) function tan(x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - the **TYPE** of **x** may be _real_ or _complex_ of any supported kind\n - The returned value will be of the same type and kind as the argument\n **x**.\n\n### **Description**\n\n**tan** computes the tangent of **x**.\n\n### **Options**\n\n- **x**\n : The angle in radians to compute the tangent of for _real_ input.\n If **x** is of type _complex_, its real part is regarded as a value\n in radians.\n\n### **Result**\n\n The return value is the tangent of the value **x**.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_tan\nuse, intrinsic :: iso_fortran_env, only : real_kinds, &\n& real32, real64, real128\nimplicit none\nreal(kind=real64) :: x = 0.165_real64\n write(*,*)x, tan(x)\nend program demo_tan\n```\nResults:\n```text\n 0.16500000000000001 0.16651386310913616\n```\n### **Standard**\n\nFORTRAN 77 . For a complex argument, Fortran 2008 .\n\n### **See Also**\n\n[**atan**(3)](#atan),\n[**atan2**(3)](#atan2),\n[**cos**(3)](#cos),\n[**sin**(3)](#sin)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "TANH": "## tanh\n\n### **Name**\n\n**tanh** - \\[MATHEMATICS:TRIGONOMETRIC\\] Hyperbolic tangent function\n\n### **Synopsis**\n```fortran\n result = tanh(x)\n```\n```fortran\n elemental TYPE(kind=KIND) function tanh(x)\n\n TYPE(kind=KIND),intent(in) :: x\n```\n### **Characteristics**\n\n - **x** may be _real_ or _complex_ and any associated kind supported by\n the processor.\n - The returned value will be of the same type and kind as the argument.\n\n### **Description**\n\n**tanh** computes the hyperbolic tangent of **x**.\n\n### **Options**\n\n- **x**\n : The value to compute the Hyperbolic tangent of.\n\n### **Result**\n\nReturns the hyperbolic tangent of **x**.\n\n If **x** is _complex_, the imaginary part of the result is regarded as\n a radian value.\n\n If **x** is _real_, the return value lies in the range\n```\n -1 <= tanh(x) <= 1.\n```\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_tanh\nuse, intrinsic :: iso_fortran_env, only : &\n& real_kinds, real32, real64, real128\nimplicit none\nreal(kind=real64) :: x = 2.1_real64\n write(*,*)x, tanh(x)\nend program demo_tanh\n```\nResults:\n```text\n 2.1000000000000001 0.97045193661345386\n```\n### **Standard**\n\nFORTRAN 77 , for a complex argument Fortran 2008\n\n### **See Also**\n\n[**atanh**(3)](#atanh)\n\n### **Resources**\n\n- [Wikipedia:hyperbolic functions](https://en.wikipedia.org/wiki/Hyperbolic_functions)\n\n _fortran-lang intrinsic descriptions_\n", "THIS_IMAGE": "## this_image\n\n### **Name**\n\n**this_image** - \\[COLLECTIVE\\] Cosubscript index of this image\n\n### **Synopsis**\n\n```fortran\nresult = this_image() | = this_image(distance) | = this_image(coarray,dim)\n```\n```fortran\n integer function this_image( distance ,coarray, dim )\n\n type(TYPE(kind=**),optional :: coarray[*]\n integer,intent(in),optional :: distance\n integer,intent(in),optional :: dim\n```\n### **Characteristics**\n\n - a kind designated as ** may be any supported kind for the type\n - **coarray** can be of any type. If **dim** is present it is required.\n - **distance** is not permitted together with **coarray**\n - if **dim** if present, coarray is required.\n\n### **Description**\n\n**this_image** returns the cosubscript for this image.\n\n### **Options**\n\n- **distance**\n : Nonnegative scalar _integer_ (not permitted together with **coarray**).\n\n- **coarray**\n : if **dim** present, required).\n\n- **dim**\n : If present, **dim** shall be between one and the corank of **coarray**.\n\n### **Result**\n\nDefault integer. If **coarray** is not present, it is scalar; if **distance** is\nnot present or has value **0**, its value is the image index on the invoking\nimage for the current team, for values smaller or equal distance to the\ninitial team, it returns the image index on the ancestor team which has\na distance of **distance** from the invoking team. If **distance** is larger\nthan the distance to the initial team, the image index of the initial\nteam is returned. Otherwise when the **coarray** is present, if **dim** is not\npresent, a rank-1 array with corank elements is returned, containing the\ncosubscripts for **coarray** specifying the invoking image. If **dim** is\npresent, a scalar is returned, with the value of the **dim** element of\n**this_image(coarray)**.\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_this_image\nimplicit none\ninteger :: value[*]\ninteger :: i\n value = this_image()\n sync all\n if (this_image() == 1) then\n do i = 1, num_images()\n write(*,'(2(a,i0))') 'value[', i, '] is ', value[i]\n end do\n endif\nend program demo_this_image\n```\nResults:\n```text\n value[1] is 1\n```\n### **Standard**\n\nFortran 2008. With DISTANCE argument, TS 18508\n\n### **See Also**\n\n[**num\\_images**(3)](#num_images),\n[**image\\_index**(3)](#image_index)\n\n _fortran-lang intrinsic descriptions_\n", @@ -195,7 +195,8 @@ "TRANSFER": "## transfer\n\n### **Name**\n\n**transfer** - \\[TYPE:MOLD\\] Transfer bit patterns\n\n### **Synopsis**\n```fortran\n result = transfer(source, mold [,size] )\n```\n```fortran\n type(TYPE(kind=KIND)) function transfer(source,mold,size)\n\n type(TYPE(kind=KIND)),intent(in) :: source(..)\n type(TYPE(kind=KIND)),intent(in) :: mold(..)\n integer(kind=**),intent(in),optional :: size\n```\n### **Characteristics**\n\n- **source** shall be a scalar or an array of any type.\n- **mold** shall be a scalar or an array of any type.\n- **size** shall be a scalar of type _integer_.\n- **result** has the same type as **mold**\n\n### **Description**\n\n**transfer** copies the bitwise representation of **source** in memory\ninto a variable or array of the same type and type parameters as **mold**.\n\nThis is approximately equivalent to the C concept of \"casting\" one type\nto another.\n\n### **Options**\n\n- **source**\n : Holds the bit pattern to be copied\n\n- **mold**\n : the type of **mold** is used to define the type of the returned\n value. In addition, if it is an array the returned value is a\n one-dimensional array. If it is a scalar the returned value is a scalar.\n\n- **size**\n : If **size** is present, the result is a one-dimensional array of\n length **size**.\n\nIf **size** is absent but **mold** is an array (of any size or\nshape), the result is a one-dimensional array of the minimum length\nneeded to contain the entirety of the bitwise representation of **source**.\n\nIf **size** is absent and **mold** is a scalar, the result is a scalar.\n\n### **Result**\n\nThe result has the bit level representation of **source**.\n\nIf the bitwise representation of the result is longer than that of\n**source**, then the leading bits of the result correspond to those of\n**source** but any trailing bits are filled arbitrarily.\n\nWhen the resulting bit representation does not correspond to a valid\nrepresentation of a variable of the same type as **mold**, the results are\nundefined, and subsequent operations on the result cannot be guaranteed to\nproduce sensible behavior. For example, it is possible to create _logical_\nvariables for which **var** and .not. var both appear to be true.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_transfer\nuse,intrinsic :: iso_fortran_env, only : int32, real32\ninteger(kind=int32) :: i = 2143289344\nreal(kind=real32) :: x\ncharacter(len=10) :: string\ncharacter(len=1) :: chars(10)\n x=transfer(i, 1.0) ! prints \"nan\" on i686\n ! the bit patterns are the same\n write(*,'(b0,1x,g0)')x,x ! create a NaN\n write(*,'(b0,1x,g0)')i,i\n\n ! a string to an array of characters\n string='abcdefghij'\n chars=transfer(string,chars)\n write(*,'(*(\"[\",a,\"]\":,1x))')string\n write(*,'(*(\"[\",a,\"]\":,1x))')chars\nend program demo_transfer\n```\n\nResults:\n\n```text\n 1111111110000000000000000000000 NaN\n 1111111110000000000000000000000 2143289344\n [abcdefghij]\n [a] [b] [c] [d] [e] [f] [g] [h] [i] [j]\n```\n\n### **Comments**\n\n_Joe Krahn_: Fortran uses **molding** rather than **casting**.\n\nCasting, as in C, is an in-place reinterpretation. A cast is a device\nthat is built around an object to change its shape.\n\nFortran **transfer** reinterprets data out-of-place. It can be\nconsidered **molding** rather than casting. A **mold** is a device that\nconfers a shape onto an object placed into it.\n\nThe advantage of molding is that data is always valid in the context\nof the variable that holds it. For many cases, a decent compiler should\noptimize **transfer** into a simple assignment.\n\nThere are disadvantages of this approach. It is problematic to define a\nunion of data types because you must know the largest data object, which\ncan vary by compiler or compile options. In many cases, an _EQUIVALENCE_\nwould be far more effective, but Fortran Standards committees seem\noblivious to the benefits of _EQUIVALENCE_ when used sparingly.\n\n### **Standard**\n\nFortran 90\n\n### **See also**\n\n[****(3)](#)\n\n _fortran-lang intrinsic descriptions_\n", "TRANSPOSE": "## transpose\n\n### **Name**\n\n**transpose** - \\[ARRAY:MANIPULATION\\] Transpose an array of rank two\n\n### **Synopsis**\n```fortran\n result = transpose(matrix)\n```\n```fortran\n function transpose(matrix)\n\n type(TYPE(kind=KIND) :: transpose(N,M)\n type(TYPE(kind=KIND),intent(in) :: matrix(M,N)\n```\n### **Characteristics**\n\n - **matrix** is an array of any type with a rank of two.\n - The result will be the same type and kind as **matrix** and the\n reversed shape of the input array\n\n### **Description**\n\n **transpose** transposes an array of rank two.\n\n An array is transposed by interchanging the rows and columns of the\n given matrix. That is, element (i,j) of the result has the value of\n element (j,i) of the input for all (i,j).\n\n### **Options**\n\n- **matrix**\n : The array to transpose\n\n### **Result**\n\nThe transpose of the input array. The result has the same type as\n**matrix**, and has shape \\[ m, n \\] if **matrix** has shape \\[ n, m \\].\n\n### **Examples**\n\nSample program:\n```fortran\nprogram demo_transpose\nimplicit none\ninteger,save :: xx(3,5)= reshape([&\n 1, 2, 3, 4, 5, &\n 10, 20, 30, 40, 50, &\n 11, 22, 33, 44, -1055 &\n ],shape(xx),order=[2,1])\n\ncall print_matrix_int('xx array:',xx)\ncall print_matrix_int('xx array transposed:',transpose(xx))\n\ncontains\n\nsubroutine print_matrix_int(title,arr)\n! print small 2d integer arrays in row-column format\nimplicit none\ncharacter(len=*),intent(in) :: title\ninteger,intent(in) :: arr(:,:)\ninteger :: i\ncharacter(len=:),allocatable :: biggest\n write(*,*)trim(title) ! print title\n biggest=' ' ! make buffer to write integer into\n ! find how many characters to use for integers\n write(biggest,'(i0)')ceiling(log10(real(maxval(abs(arr)))))+2\n ! use this format to write a row\n biggest='(\" > [\",*(i'//trim(biggest)//':,\",\"))'\n ! print one row of array at a time\n do i=1,size(arr,dim=1)\n write(*,fmt=biggest,advance='no')arr(i,:)\n write(*,'(\" ]\")')\n enddo\nend subroutine print_matrix_int\n\nend program demo_transpose\n```\nResults:\n```\n xx array:\n > [ 1, 2, 3, 4, 5 ]\n > [ 10, 20, 30, 40, 50 ]\n > [ 11, 22, 33, 44, -1055 ]\n xx array transposed:\n > [ 1, 10, 11 ]\n > [ 2, 20, 22 ]\n > [ 3, 30, 33 ]\n > [ 4, 40, 44 ]\n > [ 5, 50, -1055 ]\n```\n### **Standard**\n\nFortran 95\n\n### **See also**\n\n- [**merge**(3)](#merge) - Merge variables\n- [**pack**(3)](#pack) - Pack an array into an array of rank one\n- [**spread**(3)](#spread) - Add a dimension and replicate data\n- [**unpack**(3)](#unpack) - Scatter the elements of a vector\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "TRIM": "## trim\n\n### **Name**\n\n**trim** - \\[CHARACTER:WHITESPACE\\] Remove trailing blank characters from a string\n\n### **Synopsis**\n```fortran\n result = trim(string)\n```\n```fortran\n character(len=:,kind=KIND) function trim(string)\n\n character(len=*,kind=KIND),intent(in) :: string\n```\n### **Characteristics**\n\n - **KIND** can be any kind supported for the _character_ type.\n - The result has the same type and kind as the input argument **string**.\n\n### **Description**\n\n **trim** removes trailing blank characters from a string.\n\n### **Options**\n\n- **string**\n : A string to trim\n\n### **Result**\n\n The result is the same as **string** except trailing blanks are removed.\n\n If **string** is composed entirely of blanks or has zero length,\n the result has zero length.\n\n### **Examples**\n\nSample program:\n\n```fortran\nprogram demo_trim\nimplicit none\ncharacter(len=:), allocatable :: str, strs(:)\ncharacter(len=*),parameter :: brackets='( *(\"[\",a,\"]\":,1x) )'\ninteger :: i\n\n str=' trailing '\n print brackets, str,trim(str) ! trims it\n\n str=' leading'\n print brackets, str,trim(str) ! no effect\n\n str=' '\n print brackets, str,trim(str) ! becomes zero length\n print *, len(str), len(trim(' '))\n\n ! array elements are all the same length, so you often\n ! want to print them\n strs=[character(len=10) :: \"Z\",\" a b c\",\"ABC\",\"\"]\n\n write(*,*)'untrimmed:'\n ! everything prints as ten characters; nice for neat columns\n print brackets, (strs(i), i=1,size(strs))\n print brackets, (strs(i), i=size(strs),1,-1)\n write(*,*)'trimmed:'\n ! everything prints trimmed\n print brackets, (trim(strs(i)), i=1,size(strs))\n print brackets, (trim(strs(i)), i=size(strs),1,-1)\n\nend program demo_trim\n```\nResults:\n```text\n > [ trailing ] [ trailing]\n > [ leading] [ leading]\n > [ ] []\n > 12 0\n > untrimmed:\n > [Z ] [ a b c ] [ABC ] [ ]\n > [ ] [ABC ] [ a b c ] [Z ]\n > trimmed:\n > [Z] [ a b c] [ABC] []\n > [] [ABC] [ a b c] [Z]\n```\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\nFunctions that perform operations on character strings, return lengths\nof arguments, and search for certain arguments:\n\n- **Elemental:**\n [**adjustl**(3)](#adjustl),\n [**adjustr**(3)](#adjustr),\n [**index**(3)](#index),\n [**scan**(3)](#scan),\n [**verify**(3)](#verify)\n\n- **Nonelemental:**\n [**len_trim**(3)](#len_trim),\n [**len**(3)](#len),\n [**repeat**(3)](#repeat),\n [**trim**](#trim)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", - "UBOUND": "## ubound\n\n### **Name**\n\n**ubound** - \\[ARRAY:INQUIRY\\] Upper dimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = ubound(array [,dim] [,kind] )\n```\n```fortran\n elemental TYPE(kind=KIND) function ubound(array,dim,kind)\n\n TYPE(kind=KIND),intent(in) :: array\n integer(kind=**),intent(in),optional :: dim\n integer(kind=**),intent(in),optional :: kind\n```\n### **Characteristics**\n\n- **array** shall be assumed-rank or an array, of any type.\n It cannot be an unallocated allocatable array or a pointer that is not associated.\n\n- **dim** shall be a scalar _integer_.\n The corresponding actual argument shall not be an optional dummy\n argument, a disassociated pointer, or an unallocated allocatable.\n\n- **kind** an _integer_ initialization expression indicating the kind\n parameter of the result.\n\n- The return value is of type _integer_ and of kind **kind**. If **kind**\n is absent, the return value is of default integer kind.\n The result is scalar if **dim** is present; otherwise, the result is\n an array of rank one and size n, where n is the rank of **array**.\n\n- a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n**ubound** returns the upper bounds of an array, or a single upper\nbound along the **dim** dimension.\n\n### **Options**\n\n- **array**\n : The assumed-rank or array of any type whose upper bounds are to be\n determined. If allocatable it must be allocated; if a pointer it must\n be associated. If an assumed-size array, **dim** must be present.\n\n- **dim**\n : a specific dimension of **array** to determine the bounds of.\n If **dim** is absent, the result is an array of the upper bounds of\n **array**. **dim** is required if **array** is an assumed-size array,\n and in that case must be less than or equal to the rank of **array**.\n\n- **kind**\n : indicates the kind parameter of the result. If absent, an _integer_\n of the default kind is returned.\n\n### **Result**\n\nThe return value is of type _integer_ and of kind **kind**. If **kind**\nis absent, the return value is of default integer kind.\n\nIf **dim** is absent, the result is an array of the upper bounds of\neach dimension of the **array**.\n\nIf **dim** is present, the result is a scalar corresponding to the upper\nbound of the array along that dimension.\n\nIf **array** is an expression rather than a whole array or array\nstructure component, or if it has a zero extent along the relevant\ndimension, the upper bound is taken to be the number of elements along\nthe relevant dimension.\n\n NOTE1\n If ARRAY is assumed-rank and has rank zero, DIM cannot be present\n since it cannot satisfy the requirement\n **1 <= DIM <= 0**.\n\n### **Examples**\n\nNote this function should not be used on assumed-size arrays or in any\nfunction without an explicit interface. Errors can occur if there is no\ninterface defined.\n\nSample program\n\n```fortran\n! program demo_ubound\nmodule m2_bounds\nimplicit none\n\ncontains\n\nsubroutine msub(arr)\n!!integer,intent(in) :: arr(*) ! cannot be assumed-size array\ninteger,intent(in) :: arr(:)\n write(*,*)'MSUB: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine msub\n\nend module m2_bounds\n!\nprogram demo_ubound\nuse m2_bounds, only : msub\nimplicit none\ninterface\n subroutine esub(arr)\n integer,intent(in) :: arr(:)\n end subroutine esub\nend interface\ninteger :: arr(-10:10)\n write(*,*)'MAIN: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n call csub()\n call msub(arr)\n call esub(arr)\ncontains\nsubroutine csub\n write(*,*)'CSUB: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine csub\n\nend\n\nsubroutine esub(arr)\nimplicit none\ninteger,intent(in) :: arr(:)\n ! WARNING: IF CALLED WITHOUT AN EXPLICIT INTERFACE\n ! THIS WILL GIVE UNDEFINED ANSWERS (like 0,0,0)\n write(*,*)'ESUB: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine esub\n!end program demo_ubound\n```\nResults:\n```text\n > MAIN: LOWER= -10 UPPER= 10 SIZE= 21\n > CSUB: LOWER= -10 UPPER= 10 SIZE= 21\n > MSUB: LOWER= 1 UPPER= 21 SIZE= 21\n > ESUB: LOWER= 1 UPPER= 21 SIZE= 21\n```\n### **Standard**\n\nFortran 95 , with KIND argument Fortran 2003\n\n### **See Also**\n\n#### Array inquiry:\n\n- [**size**(3)](#size) - Determine the size of an array\n- [**rank**(3)](#rank) - Rank of a data object\n- [**shape**(3)](#shape) - Determine the shape of an array\n- [**lbound**(3)](#lbound) - Lower dimension bounds of an array\n\n[**co\\_ubound**(3)](#co_ubound),\n[**co\\_lbound**(3)](co_lbound)\n\n#### State Inquiry:\n\n- [**allocated**(3)](#allocated) - Status of an allocatable entity\n- [**is_contiguous**(3)](#is_contiguous) - Test if object is contiguous\n\n#### Kind Inquiry:\n\n- [**kind**(3)](#kind) - Kind of an entity\n\n#### Bit Inquiry:\n\n- [**storage_size**(3)](#storage_size) - Storage size in bits\n- [**bit_size**(3)](#bit_size) - Bit size inquiry function\n- [**btest**(3)](#btest) - Tests a bit of an _integer_ value.\n- [**lbound**(3)](#lbound),\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "UBOUND": "## ubound\n\n### **Name**\n\n**ubound** - \\[ARRAY:INQUIRY\\] Upper dimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = ubound(array [,dim] [,kind] )\n```\n```fortran\n elemental TYPE(kind=KIND) function ubound(array,dim,kind)\n\n TYPE(kind=KIND),intent(in) :: array\n integer(kind=**),intent(in),optional :: dim\n integer(kind=**),intent(in),optional :: kind\n```\n### **Characteristics**\n\n- **array** shall be assumed-rank or an array, of any type.\n It cannot be an unallocated allocatable array or a pointer that is not associated.\n\n- **dim** shall be a scalar _integer_.\n The corresponding actual argument shall not be an optional dummy\n argument, a disassociated pointer, or an unallocated allocatable.\n\n- **kind** an _integer_ initialization expression indicating the kind\n parameter of the result.\n\n- The return value is of type _integer_ and of kind **kind**. If **kind**\n is absent, the return value is of default integer kind.\n The result is scalar if **dim** is present; otherwise, the result is\n an array of rank one and size n, where n is the rank of **array**.\n\n- a kind designated as ** may be any supported kind for the type\n\n### **Description**\n\n**ubound** returns the upper bounds of an array, or a single upper\nbound along the **dim** dimension.\n\n### **Options**\n\n- **array**\n : The assumed-rank or array of any type whose upper bounds are to be\n determined. If allocatable it must be allocated; if a pointer it must\n be associated. If an assumed-size array, **dim** must be present.\n\n- **dim**\n : a specific dimension of **array** to determine the bounds of.\n If **dim** is absent, the result is an array of the upper bounds of\n **array**. **dim** is required if **array** is an assumed-size array,\n and in that case must be less than or equal to the rank of **array**.\n\n- **kind**\n : indicates the kind parameter of the result. If absent, an _integer_\n of the default kind is returned.\n\n### **Result**\n\nThe return value is of type _integer_ and of kind **kind**. If **kind**\nis absent, the return value is of default integer kind.\n\nIf **dim** is absent, the result is an array of the upper bounds of\neach dimension of the **array**.\n\nIf **dim** is present, the result is a scalar corresponding to the upper\nbound of the array along that dimension.\n\nIf **array** is an expression rather than a whole array or array\nstructure component, or if it has a zero extent along the relevant\ndimension, the upper bound is taken to be the number of elements along\nthe relevant dimension.\n\n NOTE1\n If ARRAY is assumed-rank and has rank zero, DIM cannot be present\n since it cannot satisfy the requirement\n **1 <= DIM <= 0**.\n\n### **Examples**\n\nNote this function should not be used on assumed-size arrays or in any\nfunction without an explicit interface. Errors can occur if there is no\ninterface defined.\n\nSample program\n\n```fortran\n! program demo_ubound\nmodule m2_bounds\nimplicit none\n\ncontains\n\nsubroutine msub(arr)\n!!integer,intent(in) :: arr(*) ! cannot be assumed-size array\ninteger,intent(in) :: arr(:)\n write(*,*)'MSUB: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine msub\n\nend module m2_bounds\n!\nprogram demo_ubound\nuse m2_bounds, only : msub\nimplicit none\ninterface\n subroutine esub(arr)\n integer,intent(in) :: arr(:)\n end subroutine esub\nend interface\ninteger :: arr(-10:10)\n write(*,*)'MAIN: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\n call csub()\n call msub(arr)\n call esub(arr)\ncontains\nsubroutine csub\n write(*,*)'CSUB: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine csub\n\nend\n\nsubroutine esub(arr)\nimplicit none\ninteger,intent(in) :: arr(:)\n ! WARNING: IF CALLED WITHOUT AN EXPLICIT INTERFACE\n ! THIS WILL GIVE UNDEFINED ANSWERS (like 0,0,0)\n write(*,*)'ESUB: LOWER=',lbound(arr),'UPPER=',ubound(arr), &\n & 'SIZE=',size(arr)\nend subroutine esub\n!end program demo_ubound\n```\nResults:\n```text\n > MAIN: LOWER= -10 UPPER= 10 SIZE= 21\n > CSUB: LOWER= -10 UPPER= 10 SIZE= 21\n > MSUB: LOWER= 1 UPPER= 21 SIZE= 21\n > ESUB: LOWER= 1 UPPER= 21 SIZE= 21\n```\n### **Standard**\n\nFortran 95 , with KIND argument Fortran 2003\n\n### **See Also**\n\n#### Array inquiry:\n\n- [**size**(3)](#size) - Determine the size of an array\n- [**rank**(3)](#rank) - Rank of a data object\n- [**shape**(3)](#shape) - Determine the shape of an array\n- [**lbound**(3)](#lbound) - Lower dimension bounds of an array\n\n[**co\\_ubound**(3)](#ucobound),\n[**co\\_lbound**(3)](lcobound)\n\n#### State Inquiry:\n\n- [**allocated**(3)](#allocated) - Status of an allocatable entity\n- [**is_contiguous**(3)](#is_contiguous) - Test if object is contiguous\n\n#### Kind Inquiry:\n\n- [**kind**(3)](#kind) - Kind of an entity\n\n#### Bit Inquiry:\n\n- [**storage_size**(3)](#storage_size) - Storage size in bits\n- [**bit_size**(3)](#bit_size) - Bit size inquiry function\n- [**btest**(3)](#btest) - Tests a bit of an _integer_ value.\n- [**lbound**(3)](#lbound),\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", + "UCOBOUND": "## ucobound\n\n### **Name**\n\n**ucobound** - \\[COLLECTIVE\\] Upper codimension bounds of an array\n\n### **Synopsis**\n```fortran\n result = ucobound(coarray [,dim] [,kind] )\n```\n```fortran\n```\n### **Characteristics**\n\n### **Description**\n\n**ucobound** returns the upper cobounds of a coarray, or a single\nupper cobound along the **dim** codimension.\n\n### **Options**\n\n- **array**\n : Shall be an coarray, of any type.\n\n- **dim**\n : (Optional) Shall be a scalar _integer_.\n\n- **kind**\n : (Optional) An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nThe return value is of type _integer_ and of kind **kind**. If **kind** is absent,\nthe return value is of default integer kind. If **dim** is absent, the\nresult is an array of the lower cobounds of **coarray**. If **dim** is present,\nthe result is a scalar corresponding to the lower cobound of the array\nalong that codimension.\n\n### **Standard**\n\nFortran 2008\n\n### **See Also**\n\n[**lcobound**(3)](#lcobound),\n[**lbound**(3)](#lbound),\n[**ubound**(3)](#ubound)\n", "UNPACK": "## unpack\n\n### **Name**\n\n**unpack** - \\[ARRAY:CONSTRUCTION\\] Scatter the elements of a vector\ninto an array using a mask\n\n### **Synopsis**\n```fortran\n result = unpack(vector, mask, field)\n```\n```fortran\n type(TYPE(kind=KIND)) unpack(vector, mask, field)\n\n type(TYPE(kind=KIND)),intent(in) :: vector(:)\n logical,intent(in) :: mask(..)\n type(TYPE(kind=KIND)),intent(in) :: field(..)\n```\n### **Characteristics**\n\n - **vector** is a rank-one array of any type\n - **mask** is a logical array\n - **field** is the same type and type parameters as VECTOR conformable with **mask**.\n - The result is an array of the same type and type parameters as **vector**\n and the same shape as **mask**.\n\n### **Description**\n\n**unpack** scatters the elements of **vector** into a copy of an\narray **field** of any rank using _.true._ values from **mask** in array\nelement order to specify placement of the **vector** values.\n\nSo a copy of **field** is generated with select elements replaced with\nvalues from **vector**. This allows for complex replacement patterns\nthat would be difficult when using array syntax or multiple assignment\nstatements, particularly when the replacements are conditional.\n\n### **Options**\n\n- **vector**\n : New values to place into specified locations in **field**.\n It shall have at least as many elements as **mask** has _.true._\n values.\n\n- **mask**\n : Shall be an array that specifies which values\n in **field** are to be replaced with values from **vector**.\n\n- **field**\n : The input array to be altered.\n\n### **Result**\n\n The element of the result that corresponds to the ith true element\n of **mask**, in array element order, has the value **vector(i)** for i =\n 1, 2, . . ., t, where t is the number of true values in **mask**. Each\n other element has a value equal to **field* if **field* is scalar or to the\n corresponding element of **field* if it is an array.\n\n The resulting array corresponds to **field** with _.true._ elements\n of **mask** replaced by values from **vector** in array element order.\n\n### **Examples**\nParticular values may be \"scattered\" to particular positions in an array by using\n```text\n 1 0 0\n If M is the array 0 1 0\n 0 0 1\n\n V is the array [1, 2, 3],\n . T .\n and Q is the logical mask T . .\n . . T\n where \"T\" represents true and \".\" represents false, then the result of\n\n UNPACK (V, MASK = Q, FIELD = M) has the value\n\n 1 2 0\n 1 1 0\n 0 0 3\n\n and the result of UNPACK (V, MASK = Q, FIELD = 0) has the value\n\n 0 2 0\n 1 0 0\n 0 0 3\n```\n\nSample program:\n\n```fortran\nprogram demo_unpack\nimplicit none\nlogical,parameter :: T=.true., F=.false.\n\ninteger :: vector(2) = [1,1]\n\n! mask and field must conform\ninteger,parameter :: r=2, c=2\nlogical :: mask(r,c) = reshape([ T,F,F,T ],[2,2])\ninteger :: field(r,c) = 0, unity(2,2)\n\n ! basic usage\n unity = unpack( vector, mask, field )\n call print_matrix_int('unity=', unity)\n\n ! if FIELD is a scalar it is used to fill all the elements\n ! not assigned to by the vector and mask.\n call print_matrix_int('scalar field', &\n & unpack( &\n & vector=[ 1, 2, 3, 4 ], &\n & mask=reshape([ T,F,T,F,F,F,T,F,T ], [3,3]), &\n & field=0) )\n\ncontains\n\n subroutine print_matrix_int(title,arr)\n ! convenience routine:\n ! just prints small integer arrays in row-column format\n implicit none\n character(len=*),intent(in) :: title\n integer,intent(in) :: arr(:,:)\n integer :: i\n character(len=:),allocatable :: biggest\n\n write(*,*)trim(title)\n ! make buffer to write integer into\n biggest=' '\n ! find how many characters to use for integers\n write(biggest,'(i0)')ceiling(log10(real(maxval(abs(arr)))))+2\n ! use this format to write a row\n biggest='(\" [\",*(i'//trim(biggest)//':,\",\"))'\n ! print one row of array at a time\n do i=1,size(arr,dim=1)\n write(*,fmt=biggest,advance='no')arr(i,:)\n write(*,'(\" ]\")')\n enddo\n end subroutine print_matrix_int\n\nend program demo_unpack\n```\nResults:\n\n```text\n > unity=\n > [ 1, 0 ]\n > [ 0, 1 ]\n > scalar field\n > [ 1, 0, 3 ]\n > [ 0, 0, 0 ]\n > [ 2, 0, 4 ]\n```\n\n### **Standard**\n\nFortran 95\n\n### **See Also**\n\n[**merge**(3)](#merge),\n[**pack**(3)](#pack),\n[**spread**(3)](#spread)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n", "VERIFY": "## verify\n\n### **Name**\n\n**verify** - \\[CHARACTER:SEARCH\\] Position of a character in a string\nof characters that does not appear in a given set of characters.\n\n### **Synopsis**\n```fortran\n result = verify(string, set [,back] [,kind] )\n```\n```fortran\n elemental integer(kind=KIND) function verify(string,set,back,KIND)\n\n character(len=*,kind=**),intent(in) :: string\n character(len=*,kind=**),intent(in) :: set\n logical,intent(in),optional :: back\n integer,intent(in),optional :: KIND\n```\n### **Characteristics**\n\n - **string** and **set** must be of type _character_ and have the same kind for any\n individual call, but that can be any supported _character_ kind.\n - **KIND** must be a constant _integer_ initialization expression and a\n valid kind for the _integer_ type.\n - **back** shall be of type logical.\n - the kind of the returned value is the same as **kind** if\n present. Otherwise a default _integer_ kind is returned.\n\n### **Description**\n\n **verify** verifies that all the characters in **string** belong\n to the set of characters in **set** by identifying the position of\n the first character in the string that is not in the set.\n\n This makes it easy to verify strings are all uppercase or lowercase,\n follow a basic syntax, only contain printable characters, and many\n of the conditions tested for with the C routines **isalnum**(3c),\n **isalpha**(3c), **isascii**(3c), **isblank**(3c), **iscntrl**(3c),\n **isdigit**(3c), **isgraph**(3c), **islower**(3c), **isprint**(3c),\n **ispunct**(3c), **isspace**(3c), **isupper**(3c), and **isxdigit**(3c);\n but for a string as well as an array of strings.\n\n### **Options**\n\n- **string**\n : The string to search in for an unmatched character.\n\n- **set**\n : The set of characters that must be matched.\n\n- **back**\n : The direction to look for an unmatched character. The left-most\n unmatched character position is returned unless **back** is present\n and _.false._, which causes the position of the right-most unmatched\n character to be returned instead of the left-most unmatched character.\n\n- **kind**\n : An _integer_ initialization expression indicating the kind\n parameter of the result.\n\n### **Result**\n\nIf all characters of **string** are found in **set**, the result is zero.\n\nIf **string** is of zero length a zero (0) is always returned.\n\nOtherwise, if an unmatched character is found\nThe position of the first or last (if **back** is _.false._) unmatched\ncharacter in **string** is returned, starting with position one on the\nleft end of the string.\n\n### **Examples**\n\n#### Sample program I:\n```fortran\nprogram demo_verify\nimplicit none\n! some useful character sets\ncharacter,parameter :: &\n & int*(*) = '1234567890', &\n & low*(*) = 'abcdefghijklmnopqrstuvwxyz', &\n & upp*(*) = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', &\n & punc*(*) = \"!\"\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\", &\n & blank*(*) = ' ', &\n & tab = char(11), &\n & prnt*(*) = int//low//upp//blank//punc\n\ncharacter(len=:),allocatable :: string\ninteger :: i\n print *, 'basics:'\n print *, VERIFY ('ABBA', 'A') ! has the value 2.\n print *, VERIFY ('ABBA', 'A', BACK = .TRUE.) ! has the value 3.\n print *, VERIFY ('ABBA', 'AB') ! has the value 0.\n\n print *,'find first non-uppercase letter'\n ! will produce the location of \"d\", because there is no match in UPP\n write(*,*) 'something unmatched',verify(\"ABCdEFG\", upp)\n\n print *,'if everything is matched return zero'\n ! will produce 0 as all letters have a match\n write(*,*) 'everything matched',verify(\"ffoorrttrraann\", \"nartrof\")\n\n print *,'easily categorize strings as uppercase, lowercase, ...'\n ! easy C-like functionality but does entire strings not just characters\n write(*,*)'isdigit 123?',verify(\"123\", int) == 0\n write(*,*)'islower abc?',verify(\"abc\", low) == 0\n write(*,*)'isalpha aBc?',verify(\"aBc\", low//upp) == 0\n write(*,*)'isblank aBc dEf?',verify(\"aBc dEf\", blank//tab ) /= 0\n ! check if all printable characters\n string=\"aB;cde,fgHI!Jklmno PQRSTU vwxyz\"\n write(*,*)'isprint?',verify(string,prnt) == 0\n ! this now has a nonprintable tab character in it\n string(10:10)=char(11)\n write(*,*)'isprint?',verify(string,prnt) == 0\n\n print *,'VERIFY(3) is very powerful using expressions as masks'\n ! verify(3f) is often used in a logical expression\n string=\" This is NOT all UPPERCASE \"\n write(*,*)'all uppercase/spaces?',verify(string, blank//upp) == 0\n string=\" This IS all uppercase \"\n write(*,*) 'string=['//string//']'\n write(*,*)'all uppercase/spaces?',verify(string, blank//upp) == 0\n\n ! set and show complex string to be tested\n string=' Check this out. Let me know '\n ! show the string being examined\n write(*,*) 'string=['//string//']'\n write(*,*) ' '//repeat(int,4) ! number line\n\n ! the Fortran functions returns a position just not a logical like C\n print *, 'returning a position not just a logical is useful'\n ! which can be very useful for parsing strings\n write(*,*)'first non-blank character',verify(string, blank)\n write(*,*)'last non-blank character',verify(string, blank,back=.true.)\n write(*,*)'first non-letter non-blank',verify(string,low//upp//blank)\n\n !VERIFY(3) is elemental so you can check an array of strings in one call\n print *, 'elemental'\n ! are strings all letters (or blanks)?\n write(*,*) 'array of strings',verify( &\n ! strings must all be same length, so force to length 10\n & [character(len=10) :: \"YES\",\"ok\",\"000\",\"good one\",\"Nope!\"], &\n & low//upp//blank) == 0\n\n ! rarer, but the set can be an array, not just the strings to test\n ! you could do ISPRINT() this (harder) way :>\n write(*,*)'isprint?',.not.all(verify(\"aBc\", [(char(i),i=32,126)])==1)\n ! instead of this way\n write(*,*)'isprint?',verify(\"aBc\",prnt) == 0\n\nend program demo_verify\n```\nResults:\n```text\n > basics:\n > 2\n > 3\n > 0\n > find first non-uppercase letter\n > something unmatched 4\n > if everything is matched return zero\n > everything matched 0\n > easily categorize strings as uppercase, lowercase, ...\n > isdigit 123? T\n > islower abc? T\n > isalpha aBc? T\n > isblank aBc dEf? T\n > isprint? T\n > isprint? F\n > VERIFY(3) is very powerful using expressions as masks\n > all uppercase/spaces? F\n > string=[ This IS all uppercase ]\n > all uppercase/spaces? F\n > string=[ Check this out. Let me know ]\n > 1234567890123456789012345678901234567890\n > returning a position not just a logical is useful\n > first non-blank character 3\n > last non-blank character 29\n > first non-letter non-blank 17\n > elemental\n > array of strings T T F T F\n > isprint? T\n > isprint? T\n```\n#### Sample program II:\n\nDetermine if strings are valid integer representations\n\n```fortran\nprogram fortran_ints\nimplicit none\ninteger :: i\ncharacter(len=*),parameter :: ints(*)=[character(len=10) :: &\n '+1 ', &\n '3044848 ', &\n '30.40 ', &\n 'September ', &\n '1 2 3', &\n ' -3000 ', &\n ' ']\n ! show the strings to test\n write(*,'(\"|\",*(g0,\"|\"))') ints\n ! show if strings pass or fail the test done by isint(3f)\n write(*,'(\"|\",*(1x,l1,8x,\"|\"))') isint(ints)\n\ncontains\n\nelemental function isint(line) result (lout)\n!\n! determine if string is a valid integer representation\n! ignoring trailing spaces and leading spaces\n!\ncharacter(len=*),parameter :: digits='0123456789'\ncharacter(len=*),intent(in) :: line\ncharacter(len=:),allocatable :: name\nlogical :: lout\n lout=.false.\n ! make sure at least two characters long to simplify tests\n name=adjustl(line)//' '\n ! blank string\n if( name == '' )return\n ! allow one leading sign\n if( verify(name(1:1),'+-') == 0 ) name=name(2:)\n ! was just a sign\n if( name == '' )return\n lout=verify(trim(name), digits) == 0\nend function isint\n\nend program fortran_ints\n```\nResults:\n```text\n|+1 |3044848 |30.40 |September|1 2 3 | -3000 | |\n| T | T | F | F | F | T | F |\n```\n#### Sample program III:\n\nDetermine if strings represent valid Fortran symbol names\n\n```fortran\nprogram fortran_symbol_name\nimplicit none\ninteger :: i\ncharacter(len=*),parameter :: symbols(*)=[character(len=10) :: &\n 'A_ ', &\n '10 ', &\n 'September ', &\n 'A B', &\n '_A ', &\n ' ']\n\n write(*,'(\"|\",*(g0,\"|\"))') symbols\n write(*,'(\"|\",*(1x,l1,8x,\"|\"))') fortran_name(symbols)\n\ncontains\n\nelemental function fortran_name(line) result (lout)\n!\n! determine if a string is a valid Fortran name\n! ignoring trailing spaces (but not leading spaces)\n!\ncharacter(len=*),parameter :: int='0123456789'\ncharacter(len=*),parameter :: lower='abcdefghijklmnopqrstuvwxyz'\ncharacter(len=*),parameter :: upper='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\ncharacter(len=*),parameter :: allowed=upper//lower//int//'_'\n\ncharacter(len=*),intent(in) :: line\ncharacter(len=:),allocatable :: name\nlogical :: lout\n name=trim(line)\n if(len(name).ne.0)then\n ! first character is alphameric\n lout = verify(name(1:1), lower//upper) == 0 &\n ! other characters are allowed in a symbol name\n & .and. verify(name,allowed) == 0 &\n ! allowable length\n & .and. len(name) <= 63\n else\n lout = .false.\n endif\nend function fortran_name\n\nend program fortran_symbol_name\n```\nResults:\n```text\n |A_ |10 |September |A B |_A | |\n | T | F | T | F | F | F |\n```\n#### Sample program IV:\n\ncheck if string is of form NN-HHHHH\n\n```fortran\nprogram checkform\n! check if string is of form NN-HHHHH\nimplicit none\ncharacter(len=*),parameter :: int='1234567890'\ncharacter(len=*),parameter :: hex='abcdefABCDEF0123456789'\nlogical :: lout\ncharacter(len=80) :: chars\n\n chars='32-af43d'\n lout=.true.\n\n ! are the first two characters integer characters?\n lout = lout.and.(verify(chars(1:2), int) == 0)\n\n ! is the third character a dash?\n lout = lout.and.(verify(chars(3:3), '-') == 0)\n\n ! is remaining string a valid representation of a hex value?\n lout = lout.and.(verify(chars(4:8), hex) == 0)\n\n if(lout)then\n write(*,*)trim(chars),' passed'\n else\n write(*,*)trim(chars),' failed'\n endif\nend program checkform\n```\nResults:\n```text\n 32-af43d passed\n```\n#### Sample program V:\n\nexploring uses of elemental functionality and dusty corners\n\n```fortran\nprogram more_verify\nimplicit none\ncharacter(len=*),parameter :: &\n & int='0123456789', &\n & low='abcdefghijklmnopqrstuvwxyz', &\n & upp='ABCDEFGHIJKLMNOPQRSTUVWXYZ', &\n & blank=' '\n! note character variables in an array have to be of the same length\ncharacter(len=6) :: strings(3)=[\"Go \",\"right \",\"home! \"]\ncharacter(len=2) :: sets(3)=[\"do\",\"re\",\"me\"]\n\n ! elemental -- you can use arrays for both strings and for sets\n\n ! check each string from right to left for non-letter/non-blank\n write(*,*)'last non-letter',verify(strings,upp//low//blank,back=.true.)\n\n ! even BACK can be an array\n ! find last non-uppercase character in \"Howdy \"\n ! and first non-lowercase in \"there \"\n write(*,*) verify(strings(1:2),[upp,low],back=[.true.,.false.])\n\n ! using a null string for a set is not well defined. Avoid it\n write(*,*) 'null',verify(\"for tran \", \"\", .true.) ! 8,length of string?\n ! probably what you expected\n write(*,*) 'blank',verify(\"for tran \", \" \", .true.) ! 7,found 'n'\n\n ! first character in \"Go \" not in \"do\",\n ! and first letter in \"right \" not in \"ri\"\n ! and first letter in \"home! \" not in \"me\"\n write(*,*) verify(strings,sets)\n\nend program more_verify\n```\nResults:\n```text\n > last non-letter 0 0 5\n > 6 6\n > null 9\n > blank 8\n > 1 2 1\n```\n### **Standard**\n\nFortran 95 , with **kind** argument - Fortran 2003\n\n### **See Also**\n\nFunctions that perform operations on character strings, return lengths\nof arguments, and search for certain arguments:\n\n- **Elemental:**\n [**adjustl**(3)](#adjustl),\n [**adjustr**(3)](#adjustr),\n [**index**(3)](#index),\n [**scan**(3)](#scan),\n\n- **Nonelemental:**\n [**len_trim**(3)](#len_trim),\n [**len**(3)](#len),\n [**repeat**(3)](#repeat),\n [**trim**(3)](#trim)\n\n _fortran-lang intrinsic descriptions (license: MIT) \\@urbanjost_\n" }