@@ -320,7 +320,7 @@ program demo_logspace_rstart_cbase
320320
321321end program demo_logspace_rstart_cbase
322322```
323- ### ` arange `
323+ ### ` arange ` function
324324
325325#### Status
326326
@@ -332,7 +332,7 @@ Pure function.
332332
333333#### Description
334334
335- Creates a one-dimensional ` array ` of the ` integer/real ` type with fixed-spaced values of given spacing, within a given interval.
335+ Creates a rank-1 ` array ` of the ` integer/real ` type with fixed-spaced values of given spacing, within a given interval.
336336
337337#### Syntax
338338
@@ -360,7 +360,7 @@ If `step < 0`, the `step` argument will be corrected to `abs(step)` by the inter
360360
361361#### Return value
362362
363- Returns a one-dimensional ` array ` of fixed-spaced values.
363+ Returns a rank-1 ` array ` of fixed-spaced values.
364364
365365For ` integer ` type arguments, the length of the result vector is ` (end - start)/step + 1 ` .
366366For ` real ` type arguments, the length of the result vector is ` floor((end - start)/step) + 1 ` .
@@ -371,25 +371,25 @@ For `real` type arguments, the length of the result vector is `floor((end - star
371371program demo_math_arange
372372 use stdlib_math, only: arange
373373
374- print *, arange(3) !! [1,2,3]
375- print *, arange(-1) !! [1,0,-1]
376- print *, arange(0,2) !! [0,1,2]
377- print *, arange(1,-1) !! [1,0,-1]
378- print *, arange(0, 2, 2) !! [0,2]
374+ print *, arange(3) ! [1,2,3]
375+ print *, arange(-1) ! [1,0,-1]
376+ print *, arange(0,2) ! [0,1,2]
377+ print *, arange(1,-1) ! [1,0,-1]
378+ print *, arange(0, 2, 2) ! [0,2]
379379
380- print *, arange(3.0) !! [1.0,2.0,3.0]
381- print *, arange(0.0,5.0) !! [0.0,1.0,2.0,3.0,4.0,5.0]
382- print *, arange(0.0,6.0,2.5) !! [0.0,2.5,5.0]
380+ print *, arange(3.0) ! [1.0,2.0,3.0]
381+ print *, arange(0.0,5.0) ! [0.0,1.0,2.0,3.0,4.0,5.0]
382+ print *, arange(0.0,6.0,2.5) ! [0.0,2.5,5.0]
383383
384- print *, (1.0,1.0)*arange(3) !! [(1.0,1.0),(2.0,2.0),[3.0,3.0]]
384+ print *, (1.0,1.0)*arange(3) ! [(1.0,1.0),(2.0,2.0),[3.0,3.0]]
385385
386- print *, arange(0.0,2.0,-2.0) !! [0.0,2.0]. Not recommended: `step` argument is negative!
387- print *, arange(0.0,2.0,0.0) !! [0.0,1.0,2.0]. Not recommended: `step` argument is zero!
386+ print *, arange(0.0,2.0,-2.0) ! [0.0,2.0]. Not recommended: `step` argument is negative!
387+ print *, arange(0.0,2.0,0.0) ! [0.0,1.0,2.0]. Not recommended: `step` argument is zero!
388388
389389end program demo_math_arange
390390```
391391
392- ### ` arg ` - Computes the phase angle in radian of a complex scalar
392+ ### ` arg ` function
393393
394394#### Status
395395
@@ -424,13 +424,14 @@ Notes: Although the angle of the complex number `0` is undefined, `arg((0,0))` r
424424``` fortran
425425program demo_math_arg
426426 use stdlib_math, only: arg
427- print *, arg((0.0, 0.0)) !! 0.0
428- print *, arg((3.0, 4.0)) !! 0.927
429- print *, arg(2.0*exp((0.0, 0.5))) !! 0.5
427+ print *, arg((0.0, 0.0)) ! 0.0
428+ print *, arg((3.0, 4.0)) ! 0.927
429+ print *, arg(2.0*exp((0.0, 0.5))) ! 0.5
430+ print *, arg([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [π/2, 0.0, -π/2, π]
430431end program demo_math_arg
431432```
432433
433- ### ` argd ` - Computes the phase angle in degree of a complex scalar
434+ ### ` argd ` function
434435
435436#### Status
436437
@@ -465,13 +466,14 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))`
465466``` fortran
466467program demo_math_argd
467468 use stdlib_math, only: argd
468- print *, argd((0.0, 0.0)) !! 0.0
469- print *, argd((3.0, 4.0)) !! 53.1°
470- print *, argd(2.0*exp((0.0, 0.5))) !! 28.64°
469+ print *, argd((0.0, 0.0)) ! 0.0°
470+ print *, argd((3.0, 4.0)) ! 53.1°
471+ print *, argd(2.0*exp((0.0, 0.5))) ! 28.64°
472+ print *, argd([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [90°, 0°, -90°, 180°]
471473end program demo_math_argd
472474```
473475
474- ### ` argpi ` - Computes the phase angle in circular of a complex scalar
476+ ### ` argpi ` function
475477
476478#### Status
477479
@@ -506,13 +508,14 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))`
506508``` fortran
507509program demo_math_argpi
508510 use stdlib_math, only: argpi
509- print *, argpi((0.0, 0.0)) !! 0.0
510- print *, argpi((3.0, 4.0)) !! 0.295
511- print *, argpi(2.0*exp((0.0, 0.5))) !! 0.159
511+ print *, argpi((0.0, 0.0)) ! 0.0
512+ print *, argpi((3.0, 4.0)) ! 0.295
513+ print *, argpi(2.0*exp((0.0, 0.5))) ! 0.159
514+ print *, argpi([(0.0, 1.0), (1.0, 0.0), (0.0, -1.0), (-1.0, 0.0)]) ! [0.5, 0.0, -0.5, 1.0]
512515end program demo_math_argpi
513516```
514517
515- ### ` is_close `
518+ ### ` is_close ` function
516519
517520#### Description
518521
@@ -577,15 +580,15 @@ program demo_math_is_close
577580 y = -3
578581 NAN = sqrt(y)
579582
580- print *, is_close(x,[real :: 1, 2.1]) !! [T, F]
581- print *, is_close(2.0, 2.1, abs_tol=0.1) !! T
582- print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) !! NAN, F, F
583- print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) !! F, T
583+ print *, is_close(x,[real :: 1, 2.1]) ! [T, F]
584+ print *, is_close(2.0, 2.1, abs_tol=0.1) ! T
585+ print *, NAN, is_close(2.0, NAN), is_close(2.0, NAN, equal_nan=.true.) ! NAN, F, F
586+ print *, is_close(NAN, NAN), is_close(NAN, NAN, equal_nan=.true.) ! F, T
584587
585588end program demo_math_is_close
586589```
587590
588- ### ` all_close `
591+ ### ` all_close ` function
589592
590593#### Description
591594
@@ -643,29 +646,26 @@ program demo_math_all_close
643646 NAN = sqrt(y)
644647 z = (1.0, 1.0)
645648
646- print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) !! T
649+ print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) ! T
647650 print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.)
648- !! NAN, F, T
651+ ! NAN, F, T
649652
650653end program demo_math_all_close
651654```
652655
653- ### ` diff `
656+ ### ` diff ` function
654657
655658#### Description
656659
657660Computes differences between adjacent elements of an array.
658661
659662#### Syntax
660663
661- For a rank-1 array
662- ``` fortran
663- y = [[stdlib_math(module):diff(interface)]](x [, n, prepend, append])
664- ```
665- and for a rank-2 array
666- ``` fortran
667- y = [[stdlib_math(module):diff(interface)]](x [, n, dim, prepend, append])
668- ```
664+ For a rank-1 array:
665+ ` y = [[stdlib_math(module):diff(interface)]](x [, n, prepend, append]) `
666+
667+ and for a rank-2 array:
668+ ` y = [[stdlib_math(module):diff(interface)]](x [, n, dim, prepend, append]) `
669669
670670#### Status
671671
@@ -696,8 +696,9 @@ Shall be a `real/integer` and `rank-1/rank-2` array.
696696This argument is ` intent(in) ` and ` optional ` , which is no value by default.
697697
698698Note:
699- - The ` x ` , ` prepend ` and ` append ` arguments must have the same ` type ` , ` kind ` and ` rank ` .
700- - If the value of ` n ` is less than or equal to ` 0 ` (which is not recommended), the return value of ` diff ` is ` x ` .
699+
700+ - The ` x ` , ` prepend ` and ` append ` arguments must have the same ` type ` , ` kind ` and ` rank ` .
701+ - If the value of ` n ` is less than or equal to ` 0 ` (which is not recommended), the return value of ` diff ` is ` x ` .
701702- If the value of ` dim ` is not equal to ` 1 ` or ` 2 ` (which is not recommended),
702703` 1 ` will be used by the internal process of ` diff ` .
703704
0 commit comments