{{alias}}( x[, options], predicate[, thisArg] ) Counts the number of elements along one or more ndarray dimensions which pass a test implemented by a predicate function. The predicate function is provided the following arguments: - value: current array element. - indices: current array element indices. - arr: the input ndarray. Parameters ---------- x: ndarray Input ndarray. options: Object (optional) Function options. options.dims: Array (optional) List of dimensions over which to perform a reduction. If not provided, the function performs a reduction over all elements in a provided input ndarray. options.keepdims: boolean (optional) Boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions. Default: false. predicate: Function Predicate function. thisArg: any (optional) Predicate function execution context. Returns ------- out: ndarray Output ndarray. When performing a reduction over all elements, the function returns a zero-dimensional ndarray containing the result. Examples -------- > function clbk( v ) { return v > 0.0; }; > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 1.0 ], [ 0.0, 1.0 ] ] ); > var y = {{alias}}( x, clbk ) > y.get() 3 > y = {{alias}}( x, { 'keepdims': true }, clbk ) [ [ 3 ] ] {{alias}}.assign( x, y[, options], predicate[, thisArg] ) Counts the number of elements along one or more ndarray dimensions which pass a test implemented by a predicate function and assigns the results to a provided output ndarray. Parameters ---------- x: ndarray Input ndarray. y: ndarray Output ndarray. The output shape must match the shape of the non-reduced dimensions of the input ndarray. options: Object (optional) Function options. options.dims: Array (optional) List of dimensions over which to perform a reduction. If not provided, the function performs a reduction over all elements in a provided input ndarray. predicate: Function Predicate function. thisArg: any (optional) Predicate function execution context. Returns ------- y: ndarray Output ndarray. Examples -------- > function clbk( v ) { return v > 0.0; }; > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 1.0 ], [ 0.0, 1.0 ] ] ); > var y = {{alias:@stdlib/ndarray/from-scalar}}( 0, { 'dtype': 'int32' } ); > var out = {{alias}}.assign( x, y, clbk ) [ 3 ] > var bool = ( out === y ) true See Also --------