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
@@ -75,7 +72,6 @@ By default, the function performs a reduction over all elements in a provided [`
75
72
76
73
```javascript
77
74
var array =require( '@stdlib/ndarray/array' );
78
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
79
75
80
76
functionclbk( value ) {
81
77
return value >0.0;
@@ -90,17 +86,13 @@ var opts = {
90
86
'dims': [ 1, 2 ]
91
87
};
92
88
var out =countIf( x, opts, clbk );
93
-
// returns <ndarray>
94
-
95
-
var v =ndarray2array( out );
96
-
// returns [ 2, 2, 1 ]
89
+
// returns <ndarray>[ 2, 2, 1 ]
97
90
```
98
91
99
92
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`.
100
93
101
94
```javascript
102
95
var array =require( '@stdlib/ndarray/array' );
103
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/ndarray/count-if/docs/types/index.d.ts
+6-24Lines changed: 6 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -124,10 +124,7 @@ interface CountIf {
124
124
*
125
125
* // Perform reduction:
126
126
* var out = countIf( x, predicate );
127
-
* // returns <ndarray>
128
-
*
129
-
* var v = out.get();
130
-
* // returns 5
127
+
* // returns <ndarray>[ 5 ]
131
128
*/
132
129
<T=unknown,U=unknown>(x: typedndarray<T>,predicate: Predicate<T,U>,thisArg?: ThisParameterType<Predicate<T,U>>): int32ndarray;// FIXME: update once `int64` dtype support
133
130
@@ -167,10 +164,7 @@ interface CountIf {
167
164
*
168
165
* // Perform reduction:
169
166
* var out = countIf( x, {}, predicate );
170
-
* // returns <ndarray>
171
-
*
172
-
* var v = out.get();
173
-
* // returns 5
167
+
* // returns <ndarray>[ 5 ]
174
168
*/
175
169
<T=unknown,U=unknown>(x: typedndarray<T>,options: Options,predicate: Predicate<T,U>,thisArg?: ThisParameterType<Predicate<T,U>>): int32ndarray;// FIXME: update once `int64` dtype support; may require adding support for an output `dtype` option
0 commit comments