@@ -40,26 +40,12 @@ var every = require( '@stdlib/ndarray/every' );
40
40
41
41
Tests whether every element along one or more [ ` ndarray ` ] [ @stdlib/ndarray/ctor ] dimensions is truthy.
42
42
43
- <!-- eslint-disable max-len -->
44
-
45
43
``` 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' );
60
45
61
46
// 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>
63
49
64
50
// Test elements:
65
51
var out = every ( x );
@@ -81,27 +67,13 @@ The function accepts the following `options`:
81
67
82
68
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.
83
69
84
- <!-- eslint-disable max-len -->
85
-
86
70
``` javascript
87
- var Float64Array = require ( ' @stdlib/array/float64' );
88
- var ndarray = require ( ' @stdlib/ndarray/ctor' );
71
+ var array = require ( ' @stdlib/ndarray/array' );
89
72
var ndarray2array = require ( ' @stdlib/ndarray/to-array' );
90
73
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
-
103
74
// 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>
105
77
106
78
// Test elements:
107
79
var out = every ( x, {
@@ -115,27 +87,13 @@ var v = ndarray2array( out );
115
87
116
88
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 ` .
117
89
118
- <!-- eslint-disable max-len -->
119
-
120
90
``` javascript
121
- var Float64Array = require ( ' @stdlib/array/float64' );
122
- var ndarray = require ( ' @stdlib/ndarray/ctor' );
91
+ var array = require ( ' @stdlib/ndarray/array' );
123
92
var ndarray2array = require ( ' @stdlib/ndarray/to-array' );
124
93
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
-
137
94
// 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>
139
97
140
98
// Test elements:
141
99
var out = every ( x, {
@@ -152,27 +110,13 @@ var v = ndarray2array( out );
152
110
153
111
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 ] .
154
112
155
- <!-- eslint-disable max-len -->
156
-
157
113
``` javascript
158
- var Float64Array = require ( ' @stdlib/array/float64' );
159
- var ndarray = require ( ' @stdlib/ndarray/ctor' );
114
+ var array = require ( ' @stdlib/ndarray/array' );
160
115
var empty = require ( ' @stdlib/ndarray/empty' );
161
116
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
-
174
117
// 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>
176
120
177
121
// Create an output ndarray:
178
122
var y = empty ( [], {
@@ -205,25 +149,13 @@ By default, the function performs a reduction over all elements in a provided [`
205
149
<!-- eslint-disable max-len -->
206
150
207
151
``` javascript
208
- var Float64Array = require ( ' @stdlib/array/float64' );
209
- var ndarray = require ( ' @stdlib/ndarray/ctor' );
152
+ var array = require ( ' @stdlib/ndarray/array' );
210
153
var empty = require ( ' @stdlib/ndarray/empty' );
211
154
var ndarray2array = require ( ' @stdlib/ndarray/to-array' );
212
155
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
-
225
156
// 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>
227
159
228
160
// Create an output ndarray:
229
161
var y = empty ( [ 3 ], {
0 commit comments