@@ -40,26 +40,12 @@ var every = require( '@stdlib/ndarray/every' );
4040
4141Tests 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:
6551var out = every ( x );
@@ -81,27 +67,13 @@ The function accepts the following `options`:
8167
8268By 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' );
8972var 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:
10779var out = every ( x, {
@@ -115,27 +87,13 @@ var v = ndarray2array( out );
11587
11688By 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' );
12392var 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:
14199var out = every ( x, {
@@ -152,27 +110,13 @@ var v = ndarray2array( out );
152110
153111Tests 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' );
160115var 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:
178122var 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' );
210153var empty = require ( ' @stdlib/ndarray/empty' );
211154var 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:
229161var y = empty ( [ 3 ], {
0 commit comments