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/mediansorted/README.md
+14-26
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ limitations under the License.
36
36
var mediansorted =require( '@stdlib/stats/base/mediansorted' );
37
37
```
38
38
39
-
#### mediansorted( N, x, stride )
39
+
#### mediansorted( N, x, strideX )
40
40
41
41
Computes the median value of a sorted strided array `x`.
42
42
@@ -54,17 +54,14 @@ 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 median value 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 median value 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, 3.0, 3.0, 4.0, 2.0 ];
65
-
varN=floor( x.length/2 );
66
63
67
-
var v =mediansorted( N, x, 2 );
64
+
var v =mediansorted( 4, x, 2 );
68
65
// returns 2.5
69
66
```
70
67
@@ -74,18 +71,15 @@ Note that indexing is relative to the first index. To introduce an offset, use [
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 =mediansorted( N, x1, 2 );
78
+
var v =mediansorted( 4, x1, 2 );
85
79
// returns 2.0
86
80
```
87
81
88
-
#### mediansorted.ndarray( N, x, stride, offset )
82
+
#### mediansorted.ndarray( N, x, strideX, offsetX )
89
83
90
84
Computes the median value of a sorted strided array using alternative indexing semantics.
91
85
@@ -98,17 +92,14 @@ var v = mediansorted.ndarray( x.length, x, 1, 0 );
98
92
99
93
The function has the following additional parameters:
100
94
101
-
-**offset**: starting index for `x`.
95
+
-**offsetX**: starting index for `x`.
102
96
103
-
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 median value for every other value in `x` starting from the second value
97
+
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 median value for every other value in `x` starting from the second value
104
98
105
99
```javascript
106
-
var floor =require( '@stdlib/math/base/special/floor' );
107
-
108
100
var x = [ 2.0, 1.0, 2.0, 2.0, -2.0, 2.0, 3.0, 4.0 ];
109
-
varN=floor( x.length/2 );
110
101
111
-
var v =mediansorted.ndarray( N, x, 2, 1 );
102
+
var v =mediansorted.ndarray( 4, x, 2, 1 );
112
103
// returns 2.0
113
104
```
114
105
@@ -122,6 +113,7 @@ var v = mediansorted.ndarray( N, x, 2, 1 );
122
113
123
114
- If `N <= 0`, both functions return `NaN`.
124
115
- The input strided array must be sorted in either **strictly** ascending or descending order.
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
126
118
</section>
127
119
@@ -134,16 +126,10 @@ var v = mediansorted.ndarray( N, x, 2, 1 );
0 commit comments