Skip to content

Commit 26eb730

Browse files
committed
docs: updated
1 parent e57055b commit 26eb730

File tree

5 files changed

+22
-77
lines changed

5 files changed

+22
-77
lines changed

lib/node_modules/@stdlib/stats/max-by/README.md

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ function clbk( v ) {
4444
}
4545

4646
var y = maxBy( x, clbk );
47-
// returns <ndarray>
48-
49-
var v = y.get();
50-
// returns 4.0
47+
// returns <ndarray>[ 4.0 ]
5148
```
5249

5350
The function has the following parameters:
@@ -99,7 +96,6 @@ The function accepts the following options:
9996
By default, the function performs a reduction over all elements in a provided input [ndarray][@stdlib/ndarray/ctor]. To perform a reduction over specific dimensions, provide a `dims` option.
10097

10198
```javascript
102-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
10399
var array = require( '@stdlib/ndarray/array' );
104100

105101
function clbk( v ) {
@@ -110,41 +106,30 @@ var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
110106
'shape': [ 2, 2 ],
111107
'order': 'row-major'
112108
});
113-
var v = ndarray2array( x );
114-
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
109+
// returns <ndarray>[ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
115110

116111
var opts = {
117112
'dims': [ 0 ]
118113
};
119114
var y = maxBy( x, opts, clbk );
120-
// returns <ndarray>
121-
122-
v = ndarray2array( y );
123-
// returns [ -100.0, 400.0 ]
115+
// returns <ndarray>[ -100.0, 400.0 ]
124116

125117
opts = {
126118
'dims': [ 1 ]
127119
};
128120
y = maxBy( x, opts, clbk );
129-
// returns <ndarray>
130-
131-
v = ndarray2array( y );
132-
// returns [ 200.0, 400.0 ]
121+
// returns <ndarray>[ 200.0, 400.0 ]
133122

134123
opts = {
135124
'dims': [ 0, 1 ]
136125
};
137126
y = maxBy( x, opts, clbk );
138-
// returns <ndarray>
139-
140-
v = y.get();
141-
// returns 400.0
127+
// returns <ndarray>[ 400.0 ]
142128
```
143129

144130
By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
145131

146132
```javascript
147-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
148133
var array = require( '@stdlib/ndarray/array' );
149134

150135
function clbk( v ) {
@@ -156,38 +141,28 @@ var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
156141
'order': 'row-major'
157142
});
158143

159-
var v = ndarray2array( x );
160-
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
144+
// returns <ndarray>[ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
161145

162146
var opts = {
163147
'dims': [ 0 ],
164148
'keepdims': true
165149
};
166150
var y = maxBy( x, opts, clbk );
167-
// returns <ndarray>
168-
169-
v = ndarray2array( y );
170-
// returns [ [ -100.0, 400.0 ] ]
151+
// returns <ndarray>[ [ -100.0, 400.0 ] ]
171152

172153
opts = {
173154
'dims': [ 1 ],
174155
'keepdims': true
175156
};
176157
y = maxBy( x, opts, clbk );
177-
// returns <ndarray>
178-
179-
v = ndarray2array( y );
180-
// returns [ [ 200.0 ], [ 400.0 ] ]
158+
// returns <ndarray>[ [ 200.0 ], [ 400.0 ] ]
181159

182160
opts = {
183161
'dims': [ 0, 1 ],
184162
'keepdims': true
185163
};
186164
y = maxBy( x, opts, clbk );
187-
// returns <ndarray>
188-
189-
v = ndarray2array( y );
190-
// returns [ [ 400.0 ] ]
165+
// returns <ndarray>[ [ 400.0 ] ]
191166
```
192167

193168
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
@@ -208,7 +183,7 @@ var opts = {
208183
'dtype': 'float64'
209184
};
210185
var y = maxBy( x, opts, clbk );
211-
// returns <ndarray>
186+
// returns <ndarray>[ 2.0 ]
212187

213188
var dt = String( getDType( y ) );
214189
// returns 'float64'
@@ -230,10 +205,7 @@ var x = array( [ -1.0, 2.0, -3.0 ] );
230205
var y = zeros( [] );
231206

232207
var out = maxBy.assign( x, y, clbk );
233-
// returns <ndarray>
234-
235-
var v = out.get();
236-
// returns 200.0
208+
// returns <ndarray>200.0
237209

238210
var bool = ( out === y );
239211
// returns true

lib/node_modules/@stdlib/stats/max-by/docs/repl.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@
4949
--------
5050
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
5151
> function clbk( v ) { return v * 2.0; };
52-
> var y = {{alias}}( x, clbk );
53-
> var v = y.get()
54-
4.0
52+
> var y = {{alias}}( x, clbk )
53+
<ndarray>[ 4.0 ]
5554

5655

5756
{{alias}}.assign( x, out[, options], clbk[, thisArg] )
@@ -102,11 +101,9 @@
102101
> var out = {{alias:@stdlib/ndarray/zeros}}( [] );
103102
> function clbk( v ) { return v * 2.0; };
104103
> var y = {{alias}}.assign( x, out, clbk )
105-
<ndarray>
104+
<ndarray>[ 4.0 ]
106105
> var bool = ( out === y )
107106
true
108-
> var v = out.get()
109-
4.0
110107

111108
See Also
112109
--------

lib/node_modules/@stdlib/stats/max-by/docs/types/index.d.ts

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ interface Unary {
124124
* var x = array( [ -1.0, 2.0, -3.0 ] );
125125
*
126126
* var y = maxBy( x, clbk );
127-
* // returns <ndarray>
128-
*
129-
* var v = y.get();
130-
* // returns 4.0
127+
* // returns <ndarray>[ 4.0 ]
131128
*/
132129
<T = unknown, U extends InputArray<T> = InputArray<T>, ThisArg = unknown>( x: U, clbk: Callback<T, U, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, ThisArg>> ): OutputArray<number>; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
133130

@@ -150,10 +147,7 @@ interface Unary {
150147
* var x = array( [ -1.0, 2.0, -3.0 ] );
151148
*
152149
* var y = maxBy( x, {}, clbk );
153-
* // returns <ndarray>
154-
*
155-
* var v = y.get();
156-
* // returns 4.0
150+
* // returns <ndarray>[ 4.0 ]
157151
*/
158152
<T = unknown, U extends InputArray<T> = InputArray<T>, ThisArg = unknown>( x: U, options: Options, clbk: Callback<T, U, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, ThisArg>> ): OutputArray<number>; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
159153

@@ -178,10 +172,7 @@ interface Unary {
178172
* }
179173
*
180174
* var out = maxBy.assign( x, y, clbk );
181-
* // returns <ndarray>
182-
*
183-
* var v = out.get();
184-
* // returns 4.0
175+
* // returns <ndarray>[ 4.0 ]
185176
*
186177
* var bool = ( out === y );
187178
* // returns true
@@ -210,10 +201,7 @@ interface Unary {
210201
* }
211202
*
212203
* var out = maxBy.assign( x, y, {}, clbk );
213-
* // returns <ndarray>
214-
*
215-
* var v = out.get();
216-
* // returns 4.0
204+
* // returns <ndarray>[ 4.0 ]
217205
*
218206
* var bool = ( out === y );
219207
* // returns true
@@ -240,10 +228,7 @@ interface Unary {
240228
* }
241229
*
242230
* var y = maxBy( x, clbk );
243-
* // returns <ndarray>
244-
*
245-
* var v = y.get();
246-
* // returns 4.0
231+
* // returns <ndarray>[ 4.0 ]
247232
*
248233
* @example
249234
* var array = require( '@stdlib/ndarray/array' );
@@ -257,10 +242,7 @@ interface Unary {
257242
* }
258243
*
259244
* var out = maxBy.assign( x, y, clbk );
260-
* // returns <ndarray>
261-
*
262-
* var v = out.get();
263-
* // returns 4.0
245+
* // returns <ndarray>[ 4.0 ]
264246
*
265247
* var bool = ( out === y );
266248
* // returns true

lib/node_modules/@stdlib/stats/max-by/lib/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@
5050
*
5151
* // Perform reduction:
5252
* var out = maxBy( x, clbk );
53-
* // returns <ndarray>
54-
*
55-
* var v = out.get();
56-
* // returns 22.0
53+
* // returns <ndarray>[ 22.0 ]
5754
*/
5855

5956
// MODULES //

lib/node_modules/@stdlib/stats/max-by/lib/main.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ var table = {
8686
*
8787
* // Perform reduction:
8888
* var out = maxBy( x, clbk );
89-
* // returns <ndarray>
90-
*
91-
* var v = out.get();
92-
* // returns 22.0
89+
* // returns <ndarray>[ 22.0 ]
9390
*/
9491
var maxBy = factory( table, [ idtypes ], odtypes, policies );
9592

0 commit comments

Comments
 (0)