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
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/array/base/count-ifs/README.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ limitations under the License.
20
20
21
21
# countIfs
22
22
23
-
> Count the number of elements in the input arrays which pass the tests implemented by the predicate functions.
23
+
> Perform element-wise evaluation of one or more input arrays according to provided predicate functions and count the number of elements for which all predicates respectively return `true`.
24
24
25
25
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26
26
@@ -40,9 +40,9 @@ limitations under the License.
40
40
var countIfs =require( '@stdlib/array/base/count-ifs' );
Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
45
+
Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
46
46
47
47
```javascript
48
48
functionpredicate0( value ) {
@@ -60,11 +60,21 @@ var out = countIfs( x0, predicate0, x1, predicate1 );
60
60
// returns 1
61
61
```
62
62
63
+
The function has the following parameters:
64
+
65
+
-**x0**: first input array.
66
+
-**predicate0**: first predicate function.
67
+
-**x1**: second input array (_optional_).
68
+
-**predicate1**: second predicate function (_optional_).
69
+
-**x2**: third input array (_optional_).
70
+
-**predicate2**: third predicate function (_optional_).
71
+
-**args**: additional input arrays and corresponding predicate functions (_optional_).
72
+
63
73
Each predicate function is provided three arguments:
64
74
65
75
-**value**: current array element.
66
76
-**index**: current array element index.
67
-
-**arr**: input array.
77
+
-**arr**: the corresponding input array.
68
78
69
79
</section>
70
80
@@ -91,7 +101,7 @@ Each predicate function is provided three arguments:
91
101
92
102
<!-- eslint no-undef: "error" -->
93
103
94
-
<!-- eslint max-len: "off"-->
104
+
<!-- eslint-disable max-len -->
95
105
96
106
```javascript
97
107
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
@@ -103,18 +113,14 @@ var countIfs = require( '@stdlib/array/base/count-ifs' );
103
113
var x =discreteUniform( 10, -5, 5, {
104
114
'dtype':'int32'
105
115
});
106
-
// returns <Int32Array>
116
+
console.log( x );
107
117
108
118
var y =discreteUniform( 10, -5, 5, {
109
119
'dtype':'int32'
110
120
});
111
-
// returns <Int32Array>
121
+
console.log( y );
112
122
113
123
var out =countIfs( x, naryFunction( isPositiveInteger, 1 ), y, naryFunction( isNegativeInteger, 1 ) );
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
75
+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
94
+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
95
95
*
96
96
* @param x0 - first input array
97
97
* @param predicate0 - first predicate function
@@ -114,10 +114,10 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
114
114
* var n = countIfs( x0, predicate0, x1, predicate1 );
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
120
+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
121
121
*
122
122
* @param x0 - first input array
123
123
* @param predicate0 - first predicate function
@@ -147,10 +147,10 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
147
147
* var n = countIfs( x0, predicate0, x1, predicate1 );
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
153
+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
154
154
*
155
155
* @param x0 - first input array
156
156
* @param predicate0 - first predicate function
@@ -187,10 +187,10 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
187
187
* var n = countIfs( x0, predicate0, x1, predicate1, x3, predicate3 );
* Counts the number of elements in the input arrays which pass the tests implemented by the predicate functions.
193
+
* Performs element-wise evaluation of one or more input arrays according to provided predicate functions and counts the number of elements for which all predicates respectively return `true`.
194
194
*
195
195
* @param x0 - first input array
196
196
* @param predicate0 - first predicate function
@@ -202,7 +202,7 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
202
202
* @param predicate3 - fourth predicate function
203
203
* @param x4 - fifth input array
204
204
* @param predicate4 - fifth predicate function
205
-
* @param args - additional input values
205
+
* @param args - additional input arrays and predicate functions
206
206
* @returns result
207
207
*
208
208
* @example
@@ -235,7 +235,7 @@ declare function countIfs<T, U extends InputArray<T>>( x0: U, predicate0: Predic
235
235
* var n = countIfs( x0, predicate0, x1, predicate1, x3, predicate3, x4, predicate4 );
0 commit comments