You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/stats/base/nanrange/README.md
+23-32
Original file line number
Diff line number
Diff line change
@@ -38,9 +38,9 @@ The [**range**][range] is defined as the difference between the maximum and mini
38
38
var nanrange =require( '@stdlib/stats/base/nanrange' );
39
39
```
40
40
41
-
#### nanrange( N, x, stride )
41
+
#### nanrange( N, x, strideX )
42
42
43
-
Computes the [range][range] of a strided array`x`, ignoring `NaN` values.
43
+
Computes the [range][range] of a strided array, ignoring `NaN` values.
44
44
45
45
```javascript
46
46
var x = [ 1.0, -2.0, NaN, 2.0 ];
@@ -54,38 +54,32 @@ The function has the following parameters:
54
54
55
55
-**N**: number of indexed elements.
56
56
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
57
-
-**stride**: index increment for `x`.
57
+
-**strideX**: stride length for `x`.
58
58
59
-
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [range][range] of every other element in `x`,
59
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [range][range] of every other element in `x`,
60
60
61
61
```javascript
62
-
var floor =require( '@stdlib/math/base/special/floor' );
63
-
64
62
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0, NaN, NaN ];
65
-
varN=floor( x.length/2 );
66
63
67
-
var v =nanrange( N, x, 2 );
64
+
var v =nanrange( 5, x, 2 );
68
65
// returns 6.0
69
66
```
70
67
71
68
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
81
77
82
-
varN=floor( x0.length/2 );
83
-
84
-
var v =nanrange( N, x1, 2 );
78
+
var v =nanrange( 4, x1, 2 );
85
79
// returns 6.0
86
80
```
87
81
88
-
#### nanrange.ndarray( N, x, stride, offset )
82
+
#### nanrange.ndarray( N, x, strideX, offsetX )
89
83
90
84
Computes the [range][range] of a strided array, ignoring `NaN` values and using alternative indexing semantics.
91
85
@@ -99,17 +93,14 @@ var v = nanrange.ndarray( N, x, 1, 0 );
99
93
100
94
The function has the following additional parameters:
101
95
102
-
-**offset**: starting index for `x`.
96
+
-**offsetX**: starting index for `x`.
103
97
104
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to calculate the [range][range] for every other value in `x`starting from the second value
98
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to calculate the [range][range] for every other element in the strided array starting from the second element
105
99
106
100
```javascript
107
-
var floor =require( '@stdlib/math/base/special/floor' );
108
-
109
101
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, NaN, NaN, 2.0, 3.0, 4.0 ];
110
-
varN=floor( x.length/2 );
111
102
112
-
var v =nanrange.ndarray( N, x, 2, 1 );
103
+
var v =nanrange.ndarray( 5, x, 2, 1 );
113
104
// returns 6.0
114
105
```
115
106
@@ -122,6 +113,7 @@ var v = nanrange.ndarray( N, x, 2, 1 );
122
113
## Notes
123
114
124
115
- If `N <= 0`, both functions return `NaN`.
116
+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
125
117
- Depending on the environment, the typed versions ([`dnanrange`][@stdlib/stats/base/dnanrange], [`snanrange`][@stdlib/stats/base/snanrange], etc.) are likely to be significantly more performant.
126
118
127
119
</section>
@@ -135,22 +127,19 @@ var v = nanrange.ndarray( N, x, 2, 1 );
0 commit comments