You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -76,7 +73,6 @@ By default, the function performs a reduction over all elements in a provided [`
76
73
77
74
```javascript
78
75
var array =require( '@stdlib/ndarray/array' );
79
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
80
76
81
77
functionpredicate( value ) {
82
78
return value >0.0;
@@ -92,17 +88,13 @@ var opts = {
92
88
93
89
// Perform reduction:
94
90
var out =someBy( x, 2, opts, predicate );
95
-
// returns <ndarray>
96
-
97
-
var v =ndarray2array( out );
98
-
// returns [ true, true ]
91
+
// returns <ndarray>[ true, true ]
99
92
```
100
93
101
94
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`.
102
95
103
96
```javascript
104
97
var array =require( '@stdlib/ndarray/array' );
105
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
106
98
107
99
functionpredicate( value ) {
108
100
return value >0.0;
@@ -119,10 +111,7 @@ var opts = {
119
111
120
112
// Perform reduction:
121
113
var out =someBy( x, 2, opts, predicate );
122
-
// returns <ndarray>
123
-
124
-
var v =ndarray2array( out );
125
-
// returns [ [ [ true, true ] ] ]
114
+
// returns <ndarray>[ [ [ true, true ] ] ]
126
115
```
127
116
128
117
To set the predicate function execution context, provide a `thisArg`.
@@ -148,10 +137,7 @@ var ctx = {
148
137
149
138
// Perform reduction:
150
139
var out =someBy( x, 2, predicate, ctx );
151
-
// returns <ndarray>
152
-
153
-
var v =out.get();
154
-
// returns true
140
+
// returns <ndarray>[ true ]
155
141
156
142
var count =ctx.count;
157
143
// returns 2
@@ -180,13 +166,10 @@ var y = empty( [], {
180
166
181
167
// Perform reduction:
182
168
var out =someBy.assign( x, 2, y, predicate );
183
-
// returns <ndarray>
169
+
// returns <ndarray>[ true ]
184
170
185
171
var bool = ( out === y );
186
172
// returns true
187
-
188
-
var v =y.get();
189
-
// returns true
190
173
```
191
174
192
175
The function accepts the following arguments:
@@ -207,7 +190,6 @@ By default, the function performs a reduction over all elements in a provided [`
207
190
```javascript
208
191
var array =require( '@stdlib/ndarray/array' );
209
192
var empty =require( '@stdlib/ndarray/empty' );
210
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
211
193
212
194
functionpredicate( value ) {
213
195
return value >0.0;
@@ -228,12 +210,10 @@ var opts = {
228
210
229
211
// Perform reduction:
230
212
var out =someBy.assign( x, 2, y, opts, predicate );
0 commit comments