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/mskmax/README.md
+22-34
Original file line number
Diff line number
Diff line change
@@ -52,20 +52,17 @@ The function has the following parameters:
52
52
53
53
-**N**: number of indexed elements.
54
54
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
55
-
-**strideX**: index increment for `x`.
55
+
-**strideX**: stride length for `x`.
56
56
-**mask**: mask [`Array`][mdn-array] or [`typed array`][mdn-typed-array]. If a `mask` array element is `0`, the corresponding element in `x` is considered valid and **included** in computation. If a `mask` array element is `1`, the corresponding element in `x` is considered invalid/missing and **excluded** from computation.
57
-
-**strideMask**: index increment for `mask`.
57
+
-**strideMask**: stride length for `mask`.
58
58
59
-
The `N` and `stride` parameters determine which elements are accessed at runtime. For example, to compute the maximum value of every other element in `x`,
59
+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the maximum 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, -7.0, -2.0, 4.0, 3.0, 5.0, 6.0 ];
65
63
var mask = [ 0, 0, 0, 0, 0, 0, 1, 1 ];
66
-
varN=floor( x.length/2 );
67
64
68
-
var v =mskmax( N, x, 2, mask, 2 );
65
+
var v =mskmax( 4, x, 2, mask, 2 );
69
66
// returns 4.0
70
67
```
71
68
@@ -76,17 +73,14 @@ Note that indexing is relative to the first index. To introduce offsets, use [`t
var mask1 =newUint8Array( mask0.buffer, mask0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
86
82
87
-
varN=floor( x0.length/2 );
88
-
89
-
var v =mskmax( N, x1, 2, mask1, 2 );
83
+
var v =mskmax( 4, x1, 2, mask1, 2 );
90
84
// returns 4.0
91
85
```
92
86
@@ -107,16 +101,13 @@ The function has the following additional parameters:
107
101
-**offsetX**: starting index for `x`.
108
102
-**offsetMask**: starting index for `mask`.
109
103
110
-
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
104
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the maximum value for every other value in `x` starting from the second value
111
105
112
106
```javascript
113
-
var floor =require( '@stdlib/math/base/special/floor' );
114
-
115
107
var x = [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, 5.0, 6.0 ];
116
108
var mask = [ 0, 0, 0, 0, 0, 0, 1, 1 ];
117
-
varN=floor( x.length/2 );
118
109
119
-
var v =mskmax.ndarray( N, x, 2, 1, mask, 2, 1 );
110
+
var v =mskmax.ndarray( 4, x, 2, 1, mask, 2, 1 );
120
111
// returns 4.0
121
112
```
122
113
@@ -130,6 +121,8 @@ var v = mskmax.ndarray( N, x, 2, 1, mask, 2, 1 );
130
121
131
122
- If `N <= 0`, both functions return `NaN`.
132
123
- Depending on the environment, the typed versions ([`dmskmax`][@stdlib/stats/base/dmskmax], [`smskmax`][@stdlib/stats/base/smskmax], etc.) are likely to be significantly more performant.
124
+
- 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
+
133
126
134
127
</section>
135
128
@@ -142,27 +135,18 @@ var v = mskmax.ndarray( N, x, 2, 1, mask, 2, 1 );
142
135
<!-- eslint no-undef: "error" -->
143
136
144
137
```javascript
145
-
var randu =require( '@stdlib/random/base/randu' );
146
-
var round =require( '@stdlib/math/base/special/round' );
0 commit comments