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
{{ message }}
Repository navigation
Commit 5e2b384
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/ext/base/ndarray/dfirst-index-equal/README.md
+22-3Lines changed: 22 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,11 +42,16 @@ Returns the index of the first element in a one-dimensional double-precision flo
42
42
43
43
```javascript
44
44
var Float64Vector =require( '@stdlib/ndarray/vector/float64' );
45
+
var scalar2ndarray =require( '@stdlib/ndarray/from-scalar' );
45
46
46
47
var x =newFloat64Vector( [ 1.0, 2.0, 3.0, 4.0 ] );
47
48
var y =newFloat64Vector( [ 0.0, 0.0, 3.0, 0.0 ] );
48
49
49
-
var idx =dfirstIndexEqual( [ x, y ] );
50
+
var fromIndex =scalar2ndarray( 0, {
51
+
'dtype':'generic'
52
+
});
53
+
54
+
var idx =dfirstIndexEqual( [ x, y, fromIndex ] );
50
55
// returns 2
51
56
```
52
57
@@ -56,16 +61,22 @@ The function has the following parameters:
56
61
57
62
- first one-dimensional input ndarray.
58
63
- second one-dimensional input ndarray.
64
+
- a zero-dimensional ndarray containing the index from which to begin searching.
59
65
60
66
If the function is unable to find an element in the first one-dimensional input ndarray equal to a corresponding element in the second one-dimensional input ndarray, the function returns `-1`.
61
67
62
68
```javascript
63
69
var Float64Vector =require( '@stdlib/ndarray/vector/float64' );
70
+
var scalar2ndarray =require( '@stdlib/ndarray/from-scalar' );
64
71
65
72
var x =newFloat64Vector( [ 1.0, 2.0, 3.0, 4.0 ] );
66
73
var y =newFloat64Vector( [ 5.0, 6.0, 7.0, 8.0 ] );
67
74
68
-
var idx =dfirstIndexEqual( [ x, y ] );
75
+
var fromIndex =scalar2ndarray( 0, {
76
+
'dtype':'generic'
77
+
});
78
+
79
+
var idx =dfirstIndexEqual( [ x, y, fromIndex ] );
69
80
// returns -1
70
81
```
71
82
@@ -77,6 +88,7 @@ var idx = dfirstIndexEqual( [ x, y ] );
77
88
78
89
## Notes
79
90
91
+
- If a specified starting search index is negative, the function resolves the starting search index by counting backward from the last element (where `-1` refers to the last element).
80
92
- When comparing elements, the function checks for equality using the strict equality operator `===`. As a consequence, `NaN` values are considered distinct, and `-0` and `+0` are considered the same.
81
93
82
94
</section>
@@ -91,7 +103,9 @@ var idx = dfirstIndexEqual( [ x, y ] );
91
103
92
104
```javascript
93
105
var discreteUniform =require( '@stdlib/random/discrete-uniform' );
106
+
var scalar2ndarray =require( '@stdlib/ndarray/from-scalar' );
94
107
var ndarray2array =require( '@stdlib/ndarray/to-array' );
108
+
var ndarraylike2scalar =require( '@stdlib/ndarray/ndarraylike2scalar' );
95
109
var dfirstIndexEqual =require( '@stdlib/blas/ext/base/ndarray/dfirst-index-equal' );
96
110
97
111
var opts = {
@@ -103,7 +117,12 @@ console.log( ndarray2array( x ) );
* Returns the index of the first element in a one-dimensional double-precision floating-point ndarray equal to a corresponding element in another one-dimensional double-precision floating-point ndarray.
@@ -31,6 +31,7 @@ import { float64ndarray } from '@stdlib/types/ndarray';
31
31
*
32
32
* - first one-dimensional input ndarray.
33
33
* - second one-dimensional input ndarray.
34
+
* - a zero-dimensional ndarray containing the index from which to begin searching.
34
35
*
35
36
* - When comparing elements, the function checks for equality using the strict equality operator `===`. As a consequence, `NaN` values are considered distinct, and `-0` and `+0` are considered the same.
36
37
*
@@ -39,14 +40,19 @@ import { float64ndarray } from '@stdlib/types/ndarray';
39
40
*
40
41
* @example
41
42
* var Float64Vector = require( '@stdlib/ndarray/vector/float64' );
43
+
* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
42
44
*
43
45
* var x = new Float64Vector( [ 1.0, 2.0, 3.0, 4.0 ] );
44
46
* var y = new Float64Vector( [ 0.0, 0.0, 3.0, 0.0 ] );
45
47
*
46
-
* var idx = dfirstIndexEqual( [ x, y ] );
48
+
* var fromIndex = scalar2ndarray( 0, {
49
+
* 'dtype': 'generic'
50
+
* });
51
+
*
52
+
* var idx = dfirstIndexEqual( [ x, y, fromIndex ] );
@@ -38,6 +40,7 @@ var strided = require( '@stdlib/blas/ext/base/dfirst-index-equal' ).ndarray;
38
40
*
39
41
* - first one-dimensional input ndarray.
40
42
* - second one-dimensional input ndarray.
43
+
* - a zero-dimensional ndarray containing the index from which to begin searching.
41
44
*
42
45
* - When comparing elements, the function checks for equality using the strict equality operator `===`. As a consequence, `NaN` values are considered distinct, and `-0` and `+0` are considered the same.
43
46
*
@@ -46,17 +49,50 @@ var strided = require( '@stdlib/blas/ext/base/dfirst-index-equal' ).ndarray;
46
49
*
47
50
* @example
48
51
* var Float64Vector = require( '@stdlib/ndarray/vector/float64' );
52
+
* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
49
53
*
50
54
* var x = new Float64Vector( [ 1.0, 2.0, 3.0, 4.0 ] );
51
55
* var y = new Float64Vector( [ 0.0, 0.0, 3.0, 0.0 ] );
52
56
*
53
-
* var idx = dfirstIndexEqual( [ x, y ] );
57
+
* var fromIndex = scalar2ndarray( 0, {
58
+
* 'dtype': 'generic'
59
+
* });
60
+
*
61
+
* var idx = dfirstIndexEqual( [ x, y, fromIndex ] );
0 commit comments