Skip to content

Commit 38a86ef

Browse files
committed
docs: update examples
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 283b1eb commit 38a86ef

File tree

5 files changed

+39
-55
lines changed

5 files changed

+39
-55
lines changed

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ var max = require( '@stdlib/stats/max' );
3535
Computes the maximum value along one or more [ndarray][@stdlib/ndarray/ctor] dimensions.
3636

3737
```javascript
38-
var ndarray = require( '@stdlib/ndarray/ctor' );
38+
var array = require( '@stdlib/ndarray/array' );
3939

40-
var xbuf = [ -1.0, 2.0, -3.0 ];
41-
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
40+
var x = array( [ -1.0, 2.0, -3.0 ] );
4241

4342
var y = max( x );
4443
// returns <ndarray>
@@ -62,10 +61,12 @@ By default, the function performs a reduction over all elements in a provided in
6261

6362
```javascript
6463
var ndarray2array = require( '@stdlib/ndarray/to-array' );
65-
var ndarray = require( '@stdlib/ndarray/ctor' );
64+
var array = require( '@stdlib/ndarray/array' );
6665

67-
var xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
68-
var x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
66+
var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
67+
'shape': [ 2, 2 ],
68+
'order': 'row-major'
69+
});
6970

7071
var y = max( x, {
7172
'dims': [ 0 ]
@@ -96,10 +97,12 @@ By default, the function excludes reduced dimensions from the output [ndarray][@
9697

9798
```javascript
9899
var ndarray2array = require( '@stdlib/ndarray/to-array' );
99-
var ndarray = require( '@stdlib/ndarray/ctor' );
100+
var array = require( '@stdlib/ndarray/array' );
100101

101-
var xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
102-
var x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
102+
var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
103+
'shape': [ 2, 2 ],
104+
'order': 'row-major'
105+
});
103106

104107
var y = max( x, {
105108
'dims': [ 0 ],
@@ -132,18 +135,19 @@ v = ndarray2array( y );
132135
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.
133136

134137
```javascript
135-
var dtype = require( '@stdlib/ndarray/dtype' );
136-
var ndarray = require( '@stdlib/ndarray/ctor' );
138+
var getDType = require( '@stdlib/ndarray/dtype' );
139+
var array = require( '@stdlib/ndarray/array' );
137140

138-
var xbuf = [ -1.0, 2.0, -3.0 ];
139-
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
141+
var x = array( [ -1.0, 2.0, -3.0 ], {
142+
'dtype': 'generic'
143+
});
140144

141145
var y = max( x, {
142146
'dtype': 'float64'
143147
});
144148
// returns <ndarray>
145149

146-
var dt = dtype( y );
150+
var dt = getDType( y );
147151
// returns 'float64'
148152
```
149153

@@ -152,13 +156,11 @@ var dt = dtype( y );
152156
Computes the maximum value along one or more [ndarray][@stdlib/ndarray/ctor] dimensions and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
153157

154158
```javascript
155-
var ndarray = require( '@stdlib/ndarray/ctor' );
156-
157-
var xbuf = [ -1.0, 2.0, -3.0 ];
158-
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
159+
var array = require( '@stdlib/ndarray/array' );
160+
var zeros = require( '@stdlib/ndarray/zeros' );
159161

160-
var ybuf = [ 0.0 ];
161-
var y = new ndarray( 'generic', ybuf, [], [ 0 ], 0, 'row-major' );
162+
var x = array( [ -1.0, 2.0, -3.0 ] );
163+
var y = zeros( [] );
162164

163165
var out = max.assign( x, y );
164166
// returns <ndarray>

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@
2929

3030
Examples
3131
--------
32-
> var buf = [ -1.0, 2.0, -3.0, -4.0 ];
33-
> var dt = 'generic';
34-
> var sh = [ buf.length ];
35-
> var sx = [ 1 ];
36-
> var ox = 0;
37-
> var ord = 'row-major';
38-
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, buf, sh, sx, ox, ord );
32+
> var x = new {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
3933
> var y = {{alias}}( x );
4034
> var v = y.get()
4135
2.0
@@ -68,14 +62,8 @@
6862

6963
Examples
7064
--------
71-
> var buf = [ -1.0, 2.0, -3.0, -4.0 ];
72-
> var dt = 'generic';
73-
> var sh = [ buf.length ];
74-
> var sx = [ 1 ];
75-
> var ox = 0;
76-
> var ord = 'row-major';
77-
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, buf, sh, sx, ox, ord );
78-
> var out = {{alias:@stdlib/ndarray/zeros}}( [], { 'dtype': dt } );
65+
> var x = new {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
66+
> var out = {{alias:@stdlib/ndarray/zeros}}( [] );
7967
> var y = {{alias}}.assign( x, out )
8068
<ndarray>
8169
> var bool = ( out === y )

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

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,9 @@ interface Unary {
7070
* @returns output ndarray
7171
*
7272
* @example
73-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
73+
* var array = require( '@stdlib/ndarray/array' );
7474
*
75-
* var xbuf = [ -1.0, 2.0, -3.0 ];
76-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
75+
* var x = array( [ -1.0, 2.0, -3.0 ] );
7776
*
7877
* var y = max( x );
7978
* // returns <ndarray>
@@ -92,13 +91,11 @@ interface Unary {
9291
* @returns output ndarray
9392
*
9493
* @example
95-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
94+
* var array = require( '@stdlib/ndarray/array' );
95+
* var zeros = require( '@stdlib/ndarray/zeros' );
9696
*
97-
* var xbuf = [ -1.0, 2.0, -3.0 ];
98-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
99-
*
100-
* var ybuf = [ 0.0 ];
101-
* var y = new ndarray( 'generic', ybuf, [], [ 0 ], 0, 'row-major' );
97+
* var x = array( [ -1.0, 2.0, -3.0 ] );
98+
* var y = zeros( [] );
10299
*
103100
* var out = max.assign( x, y );
104101
* // returns <ndarray>
@@ -120,10 +117,9 @@ interface Unary {
120117
* @returns output ndarray
121118
*
122119
* @example
123-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
120+
* var array = require( '@stdlib/ndarray/array' );
124121
*
125-
* var xbuf = [ -1.0, 2.0, -3.0 ];
126-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
122+
* var x = array( [ -1.0, 2.0, -3.0 ] )
127123
*
128124
* var y = max( x );
129125
* // returns <ndarray>
@@ -132,13 +128,11 @@ interface Unary {
132128
* // returns 2.0
133129
*
134130
* @example
135-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
136-
*
137-
* var xbuf = [ -1.0, 2.0, -3.0 ];
138-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
131+
* var array = require( '@stdlib/ndarray/array' );
132+
* var zeros = require( '@stdlib/ndarray/zeros' );
139133
*
140-
* var ybuf = [ 0.0 ];
141-
* var y = new ndarray( 'generic', ybuf, [], [ 0 ], 0, 'row-major' );
134+
* var x = array( [ -1.0, 2.0, -3.0 ] )
135+
* var y = zeros( [] );
142136
*
143137
* var out = max.assign( x, y );
144138
* // returns <ndarray>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* var max = require( '@stdlib/stats/max' );
3030
*
3131
* // Create a data buffer:
32-
* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
32+
* var xbuf = new Float64Array( [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 7.0, 0.0, 0.0, 10.0, 11.0, 0.0 ] );
3333
*
3434
* // Define the shape of the input array:
3535
* var sh = [ 3, 1, 2 ];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var table = {
7272
* var ndarray = require( '@stdlib/ndarray/ctor' );
7373
*
7474
* // Create a data buffer:
75-
* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
75+
* var xbuf = new Float64Array( [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 7.0, 0.0, 0.0, 10.0, 11.0, 0.0 ] );
7676
*
7777
* // Define the shape of the input array:
7878
* var sh = [ 3, 1, 2 ];

0 commit comments

Comments
 (0)