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/maxsorted/README.md
+15-28
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ limitations under the License.
36
36
var maxsorted =require( '@stdlib/stats/base/maxsorted' );
37
37
```
38
38
39
-
#### maxsorted( N, x, stride )
39
+
#### maxsorted( N, x, strideX )
40
40
41
41
Computes the maximum value of a sorted strided array `x`.
42
42
@@ -58,17 +58,14 @@ The function has the following parameters:
58
58
59
59
-**N**: number of indexed elements.
60
60
-**x**: sorted input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
61
-
-**stride**: index increment for `x`.
61
+
-**strideX**: stride length for `x`.
62
62
63
-
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the maximum value of every other element in `x`,
63
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the maximum value of every other element in `x`,
64
64
65
65
```javascript
66
-
var floor =require( '@stdlib/math/base/special/floor' );
67
-
68
66
var x = [ 1.0, 2.0, 2.0, -7.0, 3.0, 3.0, 4.0, 2.0 ];
69
-
varN=floor( x.length/2 );
70
67
71
-
var v =maxsorted( N, x, 2 );
68
+
var v =maxsorted( 4, x, 2 );
72
69
// returns 4.0
73
70
```
74
71
@@ -78,42 +75,35 @@ 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
85
81
86
-
varN=floor( x0.length/2 );
87
-
88
-
var v =maxsorted( N, x1, 2 );
82
+
var v =maxsorted( 4, x1, 2 );
89
83
// returns 4.0
90
84
```
91
85
92
-
#### maxsorted.ndarray( N, x, stride, offset )
86
+
#### maxsorted.ndarray( N, x, strideX, offsetX )
93
87
94
88
Computes the maximum value of a sorted strided array using alternative indexing semantics.
95
89
96
90
```javascript
97
91
var x = [ 1.0, 2.0, 3.0 ];
98
-
varN=x.length;
99
92
100
-
var v =maxsorted.ndarray( N, x, 1, 0 );
93
+
var v =maxsorted.ndarray( x.length, x, 1, 0 );
101
94
// returns 3.0
102
95
```
103
96
104
97
The function has the following additional parameters:
105
98
106
-
-**offset**: starting index for `x`.
99
+
-**offsetX**: starting index for `x`.
107
100
108
-
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 maximum value for every other value in `x` starting from the second value
101
+
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 maximum value for every other value in `x` starting from the second value
109
102
110
103
```javascript
111
-
var floor =require( '@stdlib/math/base/special/floor' );
112
-
113
104
var x = [ 2.0, 1.0, 2.0, 2.0, -2.0, 2.0, 3.0, 4.0 ];
114
-
varN=floor( x.length/2 );
115
105
116
-
var v =maxsorted.ndarray( N, x, 2, 1 );
106
+
var v =maxsorted.ndarray( 4, x, 2, 1 );
117
107
// returns 4.0
118
108
```
119
109
@@ -127,6 +117,7 @@ var v = maxsorted.ndarray( N, x, 2, 1 );
127
117
128
118
- If `N <= 0`, both functions return `NaN`.
129
119
- The input strided array must be sorted in either **strictly** ascending or descending order.
120
+
- 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]).
130
121
131
122
</section>
132
123
@@ -139,16 +130,10 @@ var v = maxsorted.ndarray( N, x, 2, 1 );
0 commit comments