@@ -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 ` - Creates fixed-spaced values of given spacing, within a given interval
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,20 +371,20 @@ 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
```
@@ -424,9 +424,9 @@ 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
430
end program demo_math_arg
431
431
```
432
432
@@ -465,9 +465,9 @@ Notes: Although the angle of the complex number `0` is undefined, `argd((0,0))`
465
465
``` fortran
466
466
program demo_math_argd
467
467
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°
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°
471
471
end program demo_math_argd
472
472
```
473
473
@@ -506,13 +506,13 @@ Notes: Although the angle of the complex number `0` is undefined, `argpi((0,0))`
506
506
``` fortran
507
507
program demo_math_argpi
508
508
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
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
512
512
end program demo_math_argpi
513
513
```
514
514
515
- ### ` is_close `
515
+ ### ` is_close ` - Returns a boolean scalar/array where two scalars/arrays are element-wise equal within a tolerance
516
516
517
517
#### Description
518
518
@@ -577,15 +577,15 @@ program demo_math_is_close
577
577
y = -3
578
578
NAN = sqrt(y)
579
579
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
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
584
584
585
585
end program demo_math_is_close
586
586
```
587
587
588
- ### ` all_close `
588
+ ### ` all_close ` - Returns a boolean scalar where two arrays are element-wise equal within a tolerance
589
589
590
590
#### Description
591
591
@@ -643,29 +643,26 @@ program demo_math_all_close
643
643
NAN = sqrt(y)
644
644
z = (1.0, 1.0)
645
645
646
- print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) !! T
646
+ print *, all_close(z+cmplx(1.0e-11, 1.0e-11), z) ! T
647
647
print *, NAN, all_close([NAN], [NAN]), all_close([NAN], [NAN], equal_nan=.true.)
648
- !! NAN, F, T
648
+ ! NAN, F, T
649
649
650
650
end program demo_math_all_close
651
651
```
652
652
653
- ### ` diff `
653
+ ### ` diff ` - Computes differences between adjacent elements of an array
654
654
655
655
#### Description
656
656
657
657
Computes differences between adjacent elements of an array.
658
658
659
659
#### Syntax
660
660
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
- ```
661
+ For a rank-1 array:
662
+ ` y = [[stdlib_math(module):diff(interface)]](x [, n, prepend, append]) `
663
+
664
+ and for a rank-2 array:
665
+ ` y = [[stdlib_math(module):diff(interface)]](x [, n, dim, prepend, append]) `
669
666
670
667
#### Status
671
668
@@ -696,16 +693,17 @@ Shall be a `real/integer` and `rank-1/rank-2` array.
696
693
This argument is ` intent(in) ` and ` optional ` , which is no value by default.
697
694
698
695
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 ` .
696
+
697
+ - The ` x ` , ` prepend ` and ` append ` arguments must have the same ` type ` , ` kind ` and ` rank ` .
698
+ - If the value of ` n ` is less than or equal to ` 0 ` (which is not recommended), the return value of ` diff ` is ` x ` .
701
699
- If the value of ` dim ` is not equal to ` 1 ` or ` 2 ` (which is not recommended),
702
700
` 1 ` will be used by the internal process of ` diff ` .
703
701
704
702
705
703
#### Result value
706
704
707
705
Returns the finite difference of the input array.
708
- Shall be a ` real/integer ` and ` rank-1/rank-2 ` array.
706
+ Shall be a ` real/integer ` and ` rank-1/rank-2 ` array.
709
707
When both ` prepend ` and ` append ` are not present, the result ` y ` has one fewer element than ` x ` alongside the dimension ` dim ` .
710
708
711
709
#### Example
0 commit comments