@@ -320,7 +320,7 @@ program demo_logspace_rstart_cbase
320
320
321
321
end program demo_logspace_rstart_cbase
322
322
```
323
- ### ` arange `
323
+ ### ` arange ` function
324
324
325
325
#### Status
326
326
@@ -332,7 +332,7 @@ Pure function.
332
332
333
333
#### Description
334
334
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.
336
336
337
337
#### Syntax
338
338
@@ -360,7 +360,7 @@ If `step < 0`, the `step` argument will be corrected to `abs(step)` by the inter
360
360
361
361
#### Return value
362
362
363
- Returns a one-dimensional ` array ` of fixed-spaced values.
363
+ Returns a rank-1 ` array ` of fixed-spaced values.
364
364
365
365
For ` integer ` type arguments, the length of the result vector is ` (end - start)/step + 1 ` .
366
366
For ` 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
371
371
program demo_math_arange
372
372
use stdlib_math, only: arange
373
373
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]
379
379
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]
383
383
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]]
385
385
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!
388
388
389
389
end program demo_math_arange
390
390
```
391
391
392
- ### ` arg ` - Computes the phase angle in radian of a complex scalar
392
+ ### ` arg ` function
393
393
394
394
#### Status
395
395
@@ -424,13 +424,14 @@ Notes: Although the angle of the complex number `0` is undefined, `arg((0,0))` r
424
424
``` fortran
425
425
program demo_math_arg
426
426
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, π]
430
431
end program demo_math_arg
431
432
```
432
433
433
- ### ` argd ` - Computes the phase angle in degree of a complex scalar
434
+ ### ` argd ` function
434
435
435
436
#### Status
436
437
@@ -465,13 +466,14 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))`
465
466
``` fortran
466
467
program demo_math_argd
467
468
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°]
471
473
end program demo_math_argd
472
474
```
473
475
474
- ### ` argpi ` - Computes the phase angle in circular of a complex scalar
476
+ ### ` argpi ` function
475
477
476
478
#### Status
477
479
@@ -506,13 +508,14 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))`
506
508
``` fortran
507
509
program demo_math_argpi
508
510
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]
512
515
end program demo_math_argpi
513
516
```
514
517
515
- ### ` is_close `
518
+ ### ` is_close ` function
516
519
517
520
#### Description
518
521
@@ -577,15 +580,15 @@ program demo_math_is_close
577
580
y = -3
578
581
NAN = sqrt(y)
579
582
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
584
587
585
588
end program demo_math_is_close
586
589
```
587
590
588
- ### ` all_close `
591
+ ### ` all_close ` function
589
592
590
593
#### Description
591
594
@@ -643,29 +646,26 @@ program demo_math_all_close
643
646
NAN = sqrt(y)
644
647
z = (1.0, 1.0)
645
648
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
647
650
print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.)
648
- !! NAN, F, T
651
+ ! NAN, F, T
649
652
650
653
end program demo_math_all_close
651
654
```
652
655
653
- ### ` diff `
656
+ ### ` diff ` function
654
657
655
658
#### Description
656
659
657
660
Computes differences between adjacent elements of an array.
658
661
659
662
#### Syntax
660
663
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]) `
669
669
670
670
#### Status
671
671
@@ -696,8 +696,9 @@ Shall be a `real/integer` and `rank-1/rank-2` array.
696
696
This argument is ` intent(in) ` and ` optional ` , which is no value by default.
697
697
698
698
Note:
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 ` .
701
702
- If the value of ` dim ` is not equal to ` 1 ` or ` 2 ` (which is not recommended),
702
703
` 1 ` will be used by the internal process of ` diff ` .
703
704
0 commit comments