forked from stdlib-js/stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.txt
More file actions
100 lines (77 loc) · 2.98 KB
/
repl.txt
File metadata and controls
100 lines (77 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{{alias}}( x, n[, options], predicate[, thisArg] )
Tests whether at least `n` elements along one or more ndarray dimensions
pass a test implemented by a predicate function.
Parameters
----------
x: ndarray
Input ndarray.
n: ndarray|integer
Number of elements which must pass the test implemented by a predicate
function. Must be broadcast compatible with the non-reduced dimensions
of input ndarray. Must have an integer data type.
options: Object (optional)
Function options.
options.dims: Array<integer> (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 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 f ( v ) { return v > 0.0; };
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2], [ 3, 4 ] ] );
> var y = {{alias}}( x, 3, f )
<ndarray>[ true ]
> y = {{alias}}( x, 3, { 'keepdims': true }, f )
<ndarray>[ [ true ] ]
{{alias}}.assign( x, n, y[, options], predicate[, thisArg] )
Tests whether at least `n` elements along one or more ndarray dimensions
pass a test implemented by a predicate function and assigns the results to
a provided output ndarray.
Parameters
----------
x: ndarray
Input ndarray.
n: ndarray|integer
Number of elements which must pass the test implemented by a predicate
function. Must be broadcast compatible with the non-reduced dimensions
of input ndarray. Must have an integer data type.
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<integer> (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 execution context.
Returns
-------
y: ndarray
Output ndarray.
Examples
--------
> function f ( v ) { return v > 0.0 };
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2], [ 3, 4 ] ] );
> var y = {{alias:@stdlib/ndarray/from-scalar}}( false );
> var out = {{alias}}.assign( x, 3, y, f )
<ndarray>[ true ]
> var bool = ( out === y )
true
See Also
--------