Skip to content

Commit f154c06

Browse files
kgryteanandkaranubc
authored andcommitted
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: 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 27ea442 commit f154c06

File tree

2 files changed

+17
-97
lines changed

2 files changed

+17
-97
lines changed

lib/node_modules/@stdlib/ndarray/every/README.md

Lines changed: 15 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,12 @@ var every = require( '@stdlib/ndarray/every' );
4040

4141
Tests whether every element along one or more [`ndarray`][@stdlib/ndarray/ctor] dimensions is truthy.
4242

43-
<!-- eslint-disable max-len -->
44-
4543
```javascript
46-
var Float64Array = require( '@stdlib/array/float64' );
47-
var ndarray = require( '@stdlib/ndarray/ctor' );
48-
49-
// Create a data buffer:
50-
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 ] );
51-
52-
// Define the shape of the input array:
53-
var sh = [ 3, 1, 2 ];
54-
55-
// Define the array strides:
56-
var sx = [ 4, 4, 1 ];
57-
58-
// Define the index offset:
59-
var ox = 1;
44+
var array = require( '@stdlib/ndarray/array' );
6045

6146
// Create an input ndarray:
62-
var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
47+
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
48+
// returns <ndarray>
6349

6450
// Test elements:
6551
var out = every( x );
@@ -81,27 +67,13 @@ The function accepts the following `options`:
8167

8268
By default, the function performs a reduction over all elements in a provided [`ndarray`][@stdlib/ndarray/ctor]. To reduce specific dimensions, set the `dims` option.
8369

84-
<!-- eslint-disable max-len -->
85-
8670
```javascript
87-
var Float64Array = require( '@stdlib/array/float64' );
88-
var ndarray = require( '@stdlib/ndarray/ctor' );
71+
var array = require( '@stdlib/ndarray/array' );
8972
var ndarray2array = require( '@stdlib/ndarray/to-array' );
9073

91-
// Create a data buffer:
92-
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 ] );
93-
94-
// Define the shape of the input array:
95-
var sh = [ 3, 1, 2 ];
96-
97-
// Define the array strides:
98-
var sx = [ 4, 4, 1 ];
99-
100-
// Define the index offset:
101-
var ox = 1;
102-
10374
// Create an input ndarray:
104-
var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
75+
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
76+
// returns <ndarray>
10577

10678
// Test elements:
10779
var out = every( x, {
@@ -115,27 +87,13 @@ var v = ndarray2array( out );
11587

11688
By default, the function returns an [`ndarray`][@stdlib/ndarray/ctor] having a shape matching only the non-reduced dimensions of the input [`ndarray`][@stdlib/ndarray/ctor] (i.e., the reduced dimensions are dropped). To include the reduced dimensions as singleton dimensions in the output [`ndarray`][@stdlib/ndarray/ctor], set the `keepdims` option to `true`.
11789

118-
<!-- eslint-disable max-len -->
119-
12090
```javascript
121-
var Float64Array = require( '@stdlib/array/float64' );
122-
var ndarray = require( '@stdlib/ndarray/ctor' );
91+
var array = require( '@stdlib/ndarray/array' );
12392
var ndarray2array = require( '@stdlib/ndarray/to-array' );
12493

125-
// Create a data buffer:
126-
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 ] );
127-
128-
// Define the shape of the input array:
129-
var sh = [ 3, 1, 2 ];
130-
131-
// Define the array strides:
132-
var sx = [ 4, 4, 1 ];
133-
134-
// Define the index offset:
135-
var ox = 1;
136-
13794
// Create an input ndarray:
138-
var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
95+
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
96+
// returns <ndarray>
13997

14098
// Test elements:
14199
var out = every( x, {
@@ -152,27 +110,13 @@ var v = ndarray2array( out );
152110

153111
Tests whether every element along one or more [`ndarray`][@stdlib/ndarray/ctor] dimensions is truthy and assigns results to a provided output [`ndarray`][@stdlib/ndarray/ctor].
154112

155-
<!-- eslint-disable max-len -->
156-
157113
```javascript
158-
var Float64Array = require( '@stdlib/array/float64' );
159-
var ndarray = require( '@stdlib/ndarray/ctor' );
114+
var array = require( '@stdlib/ndarray/array' );
160115
var empty = require( '@stdlib/ndarray/empty' );
161116

162-
// Create a data buffer:
163-
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 ] );
164-
165-
// Define the shape of the input array:
166-
var sh = [ 3, 1, 2 ];
167-
168-
// Define the array strides:
169-
var sx = [ 4, 4, 1 ];
170-
171-
// Define the index offset:
172-
var ox = 1;
173-
174117
// Create an input ndarray:
175-
var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
118+
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
119+
// returns <ndarray>
176120

177121
// Create an output ndarray:
178122
var y = empty( [], {
@@ -205,25 +149,13 @@ By default, the function performs a reduction over all elements in a provided [`
205149
<!-- eslint-disable max-len -->
206150

207151
```javascript
208-
var Float64Array = require( '@stdlib/array/float64' );
209-
var ndarray = require( '@stdlib/ndarray/ctor' );
152+
var array = require( '@stdlib/ndarray/array' );
210153
var empty = require( '@stdlib/ndarray/empty' );
211154
var ndarray2array = require( '@stdlib/ndarray/to-array' );
212155

213-
// Create a data buffer:
214-
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 ] );
215-
216-
// Define the shape of the input array:
217-
var sh = [ 3, 1, 2 ];
218-
219-
// Define the array strides:
220-
var sx = [ 4, 4, 1 ];
221-
222-
// Define the index offset:
223-
var ox = 1;
224-
225156
// Create an input ndarray:
226-
var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
157+
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
158+
// returns <ndarray>
227159

228160
// Create an output ndarray:
229161
var y = empty( [ 3 ], {

lib/node_modules/@stdlib/ndarray/every/docs/repl.txt

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

2828
Examples
2929
--------
30-
> var xbuf = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0, 1.0, 1.0 ] );
31-
> var dt = 'float64';
32-
> var sh = [ 2, 2 ];
33-
> var sx = [ 2, 1 ];
34-
> var ox = 0;
35-
> var order = 'row-major';
36-
> var x = {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, sx, ox, order );
30+
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 1.0 ], [ 1.0, 1.0 ] ] );
3731
> var y = {{alias}}( x )
3832
<ndarray>
3933
> y.get()
@@ -74,13 +68,7 @@
7468

7569
Examples
7670
--------
77-
> var xbuf = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0, 1.0, 1.0 ] );
78-
> var dt = 'float64';
79-
> var sh = [ 2, 2 ];
80-
> var sx = [ 2, 1 ];
81-
> var ox = 0;
82-
> var order = 'row-major';
83-
> var x = {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, sx, ox, order );
71+
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 1.0 ], [ 1.0, 1.0 ] ] );
8472
> var y = {{alias:@stdlib/ndarray/from-scalar}}( false );
8573
> var out = {{alias}}.assign( x, y )
8674
<ndarray>

0 commit comments

Comments
 (0)