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: CHANGELOG.md
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,25 @@
4
4
5
5
<sectionclass="release"id="unreleased">
6
6
7
-
## Unreleased (2025-01-18)
7
+
## Unreleased (2025-02-02)
8
+
9
+
<sectionclass="features">
10
+
11
+
### Features
12
+
13
+
-[`7793d43`](https://github.com/stdlib-js/stdlib/commit/7793d4347d1e97f221b05522e724dd26ebb96ca7) - add support for accessor arrays and refactor `stats/base/max`[(#5008)](https://github.com/stdlib-js/stdlib/pull/5008)
14
+
15
+
</section>
16
+
17
+
<!-- /.features -->
8
18
9
19
<sectionclass="commits">
10
20
11
21
### Commits
12
22
13
23
<details>
14
24
25
+
-[`7793d43`](https://github.com/stdlib-js/stdlib/commit/7793d4347d1e97f221b05522e724dd26ebb96ca7) - **feat:** add support for accessor arrays and refactor `stats/base/max`[(#5008)](https://github.com/stdlib-js/stdlib/pull/5008)_(by Aayush Khanna)_
Copy file name to clipboardExpand all lines: README.md
+18-32Lines changed: 18 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -69,33 +69,29 @@ To view installation and usage instructions specific to each branch build, be su
69
69
var max =require( '@stdlib/stats-base-max' );
70
70
```
71
71
72
-
#### max( N, x, stride )
72
+
#### max( N, x, strideX )
73
73
74
74
Computes the maximum value of a strided array `x`.
75
75
76
76
```javascript
77
77
var x = [ 1.0, -2.0, 2.0 ];
78
-
varN=x.length;
79
78
80
-
var v =max( N, x, 1 );
79
+
var v =max( x.length, x, 1 );
81
80
// returns 2.0
82
81
```
83
82
84
83
The function has the following parameters:
85
84
86
85
-**N**: number of indexed elements.
87
86
-**x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
88
-
-**stride**: index increment for `x`.
87
+
-**strideX**: stride length for `x`.
89
88
90
-
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`,
89
+
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`,
91
90
92
91
```javascript
93
-
var floor =require( '@stdlib/math-base-special-floor' );
94
-
95
92
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ];
96
-
varN=floor( x.length/2 );
97
93
98
-
var v =max( N, x, 2 );
94
+
var v =max( 4, x, 2 );
99
95
// returns 4.0
100
96
```
101
97
@@ -105,42 +101,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
112
107
113
-
varN=floor( x0.length/2 );
114
-
115
-
var v =max( N, x1, 2 );
108
+
var v =max( 4, x1, 2 );
116
109
// returns 4.0
117
110
```
118
111
119
-
#### max.ndarray( N, x, stride, offset )
112
+
#### max.ndarray( N, x, strideX, offsetX )
120
113
121
114
Computes the maximum value of a strided array using alternative indexing semantics.
122
115
123
116
```javascript
124
117
var x = [ 1.0, -2.0, 2.0 ];
125
-
varN=x.length;
126
118
127
-
var v =max.ndarray( N, x, 1, 0 );
119
+
var v =max.ndarray( x.length, x, 1, 0 );
128
120
// returns 2.0
129
121
```
130
122
131
123
The function has the following additional parameters:
132
124
133
-
-**offset**: starting index for `x`.
125
+
-**offsetX**: starting index for `x`.
134
126
135
-
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
127
+
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 element in `x` starting from the second element
136
128
137
129
```javascript
138
-
var floor =require( '@stdlib/math-base-special-floor' );
139
-
140
130
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
141
-
varN=floor( x.length/2 );
142
131
143
-
var v =max.ndarray( N, x, 2, 1 );
132
+
var v =max.ndarray( 4, x, 2, 1 );
144
133
// returns 4.0
145
134
```
146
135
@@ -153,6 +142,7 @@ var v = max.ndarray( N, x, 2, 1 );
153
142
## Notes
154
143
155
144
- If `N <= 0`, both functions return `NaN`.
145
+
- 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]).
156
146
- Depending on the environment, the typed versions ([`dmax`][@stdlib/stats/strided/dmax], [`smax`][@stdlib/stats/base/smax], etc.) are likely to be significantly more performant.
157
147
158
148
</section>
@@ -166,18 +156,12 @@ var v = max.ndarray( N, x, 2, 1 );
166
156
<!-- eslint no-undef: "error" -->
167
157
168
158
```javascript
169
-
var randu =require( '@stdlib/random-base-randu' );
170
-
var round =require( '@stdlib/math-base-special-round' );
0 commit comments