Skip to content

Commit dd412c2

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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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 475d08f commit dd412c2

File tree

4 files changed

+35
-50
lines changed

4 files changed

+35
-50
lines changed

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

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ Computes the cumulative maximum value along one or more [ndarray][@stdlib/ndarra
3636

3737
```javascript
3838
var ndarray2array = require( '@stdlib/ndarray/to-array' );
39-
var ndarray = require( '@stdlib/ndarray/ctor' );
39+
var array = require( '@stdlib/ndarray/array' );
4040

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

4443
var y = cumax( x );
4544
// returns <ndarray>
@@ -62,17 +61,22 @@ By default, the function performs the operation over all elements in a provided
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' );
65+
66+
var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
67+
'shape': [ 2, 2 ],
68+
'order': 'row-major'
69+
});
6670

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' );
71+
var v = ndarray2array( x );
72+
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
6973

7074
var y = cumax( x, {
7175
'dims': [ 0 ]
7276
});
7377
// returns <ndarray>
7478

75-
var v = ndarray2array( y );
79+
v = ndarray2array( y );
7680
// returns [ [ -1.0, 2.0 ], [ -1.0, 4.0 ] ]
7781

7882
y = cumax( x, {
@@ -96,18 +100,19 @@ By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [da
96100

97101
```javascript
98102
var ndarray2array = require( '@stdlib/ndarray/to-array' );
99-
var dtype = require( '@stdlib/ndarray/dtype' );
100-
var ndarray = require( '@stdlib/ndarray/ctor' );
103+
var getDType = require( '@stdlib/ndarray/dtype' );
104+
var array = require( '@stdlib/ndarray/array' );
101105

102-
var xbuf = [ -1.0, 2.0, -3.0 ];
103-
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
106+
var x = array( [ -1.0, 2.0, -3.0 ], {
107+
'dtype': 'generic'
108+
});
104109

105110
var y = cumax( x, {
106111
'dtype': 'float64'
107112
});
108113
// returns <ndarray>
109114

110-
var dt = dtype( y );
115+
var dt = getDType( y );
111116
// returns 'float64'
112117
```
113118

@@ -117,13 +122,11 @@ Computes the cumulative maximum value along one or more [ndarray][@stdlib/ndarra
117122

118123
```javascript
119124
var ndarray2array = require( '@stdlib/ndarray/to-array' );
120-
var ndarray = require( '@stdlib/ndarray/ctor' );
121-
122-
var xbuf = [ -1.0, 2.0, -3.0 ];
123-
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
125+
var array = require( '@stdlib/ndarray/array' );
126+
var zerosLike = require( '@stdlib/ndarray/zeros-like' );
124127

125-
var ybuf = [ 0.0, 0.0, 0.0 ];
126-
var y = new ndarray( 'generic', ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' );
128+
var x = array( [ -1.0, 2.0, -3.0 ] );
129+
var y = zerosLike( x );
127130

128131
var out = cumax.assign( x, y );
129132
// returns <ndarray>
@@ -168,7 +171,7 @@ The method accepts the following options:
168171

169172
```javascript
170173
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
171-
var dtype = require( '@stdlib/ndarray/dtype' );
174+
var getDType = require( '@stdlib/ndarray/dtype' );
172175
var ndarray2array = require( '@stdlib/ndarray/to-array' );
173176
var ndarray = require( '@stdlib/ndarray/ctor' );
174177
var cumax = require( '@stdlib/stats/cumax' );
@@ -188,7 +191,7 @@ var y = cumax( x, {
188191
});
189192

190193
// Resolve the output array data type:
191-
var dt = dtype( y );
194+
var dt = getDType( y );
192195
console.log( dt );
193196

194197
// Print the results:

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@
2525

2626
Examples
2727
--------
28-
> var buf = [ -1.0, 2.0, -3.0, -4.0 ];
29-
> var dt = 'generic';
30-
> var sh = [ buf.length ];
31-
> var sx = [ 1 ];
32-
> var ox = 0;
33-
> var ord = 'row-major';
34-
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, buf, sh, sx, ox, ord );
28+
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
3529
> var y = {{alias}}( x );
3630
> {{alias:@stdlib/ndarray/to-array}}( y )
3731
[ -1.0, 2.0, 2.0, 2.0 ]
@@ -64,13 +58,7 @@
6458

6559
Examples
6660
--------
67-
> var buf = [ -1.0, 2.0, -3.0, -4.0 ];
68-
> var dt = 'generic';
69-
> var sh = [ buf.length ];
70-
> var sx = [ 1 ];
71-
> var ox = 0;
72-
> var ord = 'row-major';
73-
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, buf, sh, sx, ox, ord );
61+
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
7462
> var out = {{alias:@stdlib/ndarray/zeros-like}}( x );
7563
> var y = {{alias}}.assign( x, out )
7664
<ndarray>

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ interface Unary {
6666
*
6767
* @example
6868
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
69-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
69+
* var array = require( '@stdlib/ndarray/array' );
7070
*
71-
* var xbuf = [ -1.0, 2.0, -3.0 ];
72-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
71+
* var x = array( [ -1.0, 2.0, -3.0 ] );
7372
*
7473
* var y = cumax( x );
7574
* // returns <ndarray>
@@ -90,11 +89,9 @@ interface Unary {
9089
* @example
9190
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
9291
* var zerosLike = require( '@stdlib/ndarray/zeros-like' );
93-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
94-
*
95-
* var xbuf = [ -1.0, 2.0, -3.0 ];
96-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
92+
* var array = require( '@stdlib/ndarray/array' );
9793
*
94+
* var x = array( [ -1.0, 2.0, -3.0 ] );
9895
* var y = zerosLike( x );
9996
*
10097
* var out = cumax.assign( x, y );
@@ -118,10 +115,9 @@ interface Unary {
118115
*
119116
* @example
120117
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
121-
* var ndarray = require( '@stdlib/ndarray/base/ctor' );
118+
* var array = require( '@stdlib/ndarray/array' );
122119
*
123-
* var xbuf = [ -1.0, 2.0, -3.0 ];
124-
* var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
120+
* var x = array( [ -1.0, 2.0, -3.0 ] );
125121
*
126122
* var y = cumax( x );
127123
* // returns <ndarray>
@@ -132,11 +128,9 @@ interface Unary {
132128
* @example
133129
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
134130
* var zerosLike = require( '@stdlib/ndarray/zeros-like' );
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' );
139132
*
133+
* var x = array( [ -1.0, 2.0, -3.0 ] );
140134
* var y = zerosLike( x );
141135
*
142136
* var out = cumax.assign( x, y );

lib/node_modules/@stdlib/stats/cumax/examples/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
22-
var dtype = require( '@stdlib/ndarray/dtype' );
22+
var getDType = require( '@stdlib/ndarray/dtype' );
2323
var ndarray2array = require( '@stdlib/ndarray/to-array' );
2424
var ndarray = require( '@stdlib/ndarray/ctor' );
2525
var cumax = require( './../lib' );
@@ -39,7 +39,7 @@ var y = cumax( x, {
3939
});
4040

4141
// Resolve the output array data type:
42-
var dt = dtype( y );
42+
var dt = getDType( y );
4343
console.log( dt );
4444

4545
// Print the results:

0 commit comments

Comments
 (0)