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/blas/ext/find-index/README.md
+7-27Lines changed: 7 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,10 +47,7 @@ var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
47
47
48
48
// Perform operation:
49
49
var out =findIndex( x, isEven );
50
-
// returns <ndarray>
51
-
52
-
var idx =out.get();
53
-
// returns 1
50
+
// returns <ndarray>[ 1 ]
54
51
```
55
52
56
53
The function has the following parameters:
@@ -84,10 +81,7 @@ var ctx = {
84
81
'count':0
85
82
};
86
83
var out =findIndex( x, isEven, ctx );
87
-
// returns <ndarray>
88
-
89
-
var idx =out.get();
90
-
// returns 1
84
+
// returns <ndarray>[ 1 ]
91
85
92
86
var count =ctx.count;
93
87
// returns 2
@@ -114,16 +108,12 @@ var x = array( [ 1.0, 3.0, 5.0, 7.0 ] );
114
108
115
109
// Perform operation:
116
110
var out =findIndex( x, isEven );
117
-
// returns <ndarray>
118
-
119
-
var idx =out.get();
120
-
// returns -1
111
+
// returns <ndarray>[ -1 ]
121
112
```
122
113
123
114
By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
124
115
125
116
```javascript
126
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
127
117
var array =require( '@stdlib/ndarray/array' );
128
118
129
119
functionisEven( v ) {
@@ -137,17 +127,13 @@ var opts = {
137
127
};
138
128
139
129
var out =findIndex( x, opts, isEven );
140
-
// returns <ndarray>
141
-
142
-
var idx =ndarray2array( out );
143
-
// returns [ -1, 0 ]
130
+
// returns <ndarray>[ -1, 0 ]
144
131
```
145
132
146
133
By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
147
134
148
135
```javascript
149
136
var array =require( '@stdlib/ndarray/array' );
150
-
var ndarray2array =require( '@stdlib/ndarray/to-array' );
151
137
152
138
functionisEven( v ) {
153
139
return v %2.0===0.0;
@@ -161,10 +147,7 @@ var opts = {
161
147
};
162
148
163
149
var out =findIndex( x, opts, isEven );
164
-
// returns <ndarray>
165
-
166
-
var idx =ndarray2array( out );
167
-
// returns [ [ -1, 0 ] ]
150
+
// returns <ndarray>[ [ -1, 0 ] ]
168
151
```
169
152
170
153
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
0 commit comments