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/base/slast-index-of-row/README.md
+76-59Lines changed: 76 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,16 +22,12 @@ limitations under the License.
22
22
23
23
> Return the index of the last row in a single-precision floating-point input matrix which has the same elements as a provided search vector.
24
24
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
-
27
25
<sectionclass="intro">
28
26
29
27
</section>
30
28
31
29
<!-- /.intro -->
32
30
33
-
<!-- Package usage documentation. -->
34
-
35
31
<sectionclass="usage">
36
32
37
33
## Usage
@@ -50,17 +46,16 @@ var Uint8Array = require( '@stdlib/array/uint8' );
var out =slastIndexOfRow( 'column-major', 4, 2, A, 4, x, 1, workspace, 1 );
56
+
var x =newFloat32Array( [ 3.0, 4.0 ] );
57
+
var workspace =newUint8Array( 3 );
58
+
var out =slastIndexOfRow( 'row-major', 3, 2, A, 2, x, 1, workspace, 1 );
64
59
// returns 2
65
60
```
66
61
@@ -70,11 +65,11 @@ The function has the following parameters:
70
65
-**M**: number of rows in `A`.
71
66
-**N**: number of columns in `A`.
72
67
-**A**: input matrix stored as a [`Float32Array`][mdn-float32array].
73
-
-**LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
68
+
-**LDA**: stride length for the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
74
69
-**x**: search vector stored as a [`Float32Array`][mdn-float32array].
75
-
-**strideX**: stride length of`x`.
76
-
-**workspace**: workspace array stored as a [`Uint8Array`][mdn-uint8array] for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order.
77
-
-**strideW**: stride length of`workspace`.
70
+
-**strideX**: stride length for`x`.
71
+
-**workspace**: workspace array stored as a [`Uint8Array`][mdn-uint8array] for tracking row match candidates. This parameter is ignored if the input matrix is stored in row-major order.
72
+
-**strideW**: stride length for`workspace`.
78
73
79
74
When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may provide an empty workspace array.
80
75
@@ -86,15 +81,14 @@ var Uint8Array = require( '@stdlib/array/uint8' );
var out =slastIndexOfRow.ndarray( 4, 2, A, 1, 4, 0, x, 1, 0, workspace, 1, 0 );
158
+
var x =newFloat32Array( [ 3.0, 4.0 ] );
159
+
var workspace =newUint8Array( 3 );
160
+
var out =slastIndexOfRow.ndarray( 3, 2, A, 2, 1, 0, x, 1, 0, workspace, 1, 0 );
169
161
// returns 2
170
162
```
171
163
@@ -174,14 +166,14 @@ The function has the following parameters:
174
166
-**M**: number of rows in `A`.
175
167
-**N**: number of columns in `A`.
176
168
-**A**: input matrix stored as a [`Float32Array`][mdn-float32array].
177
-
-**strideA1**: stride of the first dimension of `A`.
178
-
-**strideA2**: stride of the second dimension of `A`.
169
+
-**strideA1**: stride length for the first dimension of `A`.
170
+
-**strideA2**: stride length for the second dimension of `A`.
179
171
-**offsetA**: starting index for `A`.
180
172
-**x**: search vector stored as a [`Float32Array`][mdn-float32array].
181
-
-**strideX**: stride length of`x`.
173
+
-**strideX**: stride length for`x`.
182
174
-**offsetX**: starting index for `x`.
183
-
-**workspace**: workspace array stored as a [`Uint8Array`][mdn-uint8array] for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order.
184
-
-**strideW**: stride length of`workspace`.
175
+
-**workspace**: workspace array stored as a [`Uint8Array`][mdn-uint8array] for tracking row match candidates. This parameter is ignored if the input matrix is stored in row-major order.
176
+
-**strideW**: stride length for`workspace`.
185
177
-**offsetW**: starting index for `workspace`.
186
178
187
179
When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may provide an empty workspace array.
@@ -190,32 +182,57 @@ When an input matrix is stored in row-major order, the workspace parameter is ig
var out =slastIndexOfRow.ndarray( 4, 2, A, 2, 1, 0, x, 1, 0, workspace, 1, 0 );
196
+
var out =slastIndexOfRow.ndarray( 3, 2, A, 2, 1, 0, x, 1, 0, workspace, 1, 0 );
198
197
// returns 2
199
198
```
200
199
200
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example,
var out =slastIndexOfRow.ndarray( 3, 2, A, 2, 1, 1, x, 1, 1, workspace, 1, 0 );
218
+
// returns 1
219
+
```
220
+
201
221
</section>
202
222
203
223
<!-- /.usage -->
204
224
205
-
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
206
-
207
225
<sectionclass="notes">
208
226
209
227
## Notes
210
228
229
+
- If `M <= 0` or `N <= 0`, both functions return `-1`.
211
230
- When searching for a matching row, 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.
212
231
213
232
</section>
214
233
215
234
<!-- /.notes -->
216
235
217
-
<!-- Package usage examples. -->
218
-
219
236
<sectionclass="examples">
220
237
221
238
## Examples
@@ -231,11 +248,11 @@ var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
231
248
var shape2strides =require( '@stdlib/ndarray/base/shape2strides' );
232
249
var slastIndexOfRow =require( '@stdlib/blas/ext/base/slast-index-of-row' );
console.log( ndarray2array( A, shape, strides, 0, order ) );
240
257
241
258
var x =newFloat32Array( [ 4.0, 5.0, 6.0 ] );
@@ -303,10 +320,10 @@ The function accepts the following arguments:
303
320
- **M**: `[in] CBLAS_INT` number of rows in `A`.
304
321
- **N**: `[in] CBLAS_INT` number of columns in `A`.
305
322
- **A**: `[in] float*` input matrix.
306
-
- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
323
+
- **LDA**: `[in] CBLAS_INT` stride length for the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
307
324
- **X**: `[in] float*` search vector.
308
325
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
309
-
- **workspace**: `[inout] uint8_t*` workspace array for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order.
326
+
- **workspace**: `[inout] uint8_t*` workspace array for tracking row match candidates. This parameter is ignored if the input matrix is stored in row-major order.
310
327
- **strideW**: `[in] CBLAS_INT` stride length for `workspace`.
311
328
312
329
When an input matrix is stored in row-major order, the workspace parameter is ignored, and, thus, one may either provide an empty workspace array or a `NULL` pointer.
@@ -349,13 +366,13 @@ The function accepts the following arguments:
349
366
-**M**: `[in] CBLAS_INT` number of rows in `A`.
350
367
-**N**: `[in] CBLAS_INT` number of columns in `A`.
351
368
-**A**: `[in] float*` input matrix.
352
-
-**strideA1**: `[in] CBLAS_INT` stride of the first dimension of `A`.
353
-
-**strideA2**: `[in] CBLAS_INT` stride of the second dimension of `A`.
354
-
-**offsetA**: `[in] CBLAS_INT`index offset for `A`.
369
+
-**strideA1**: `[in] CBLAS_INT` stride length for the first dimension of `A`.
370
+
-**strideA2**: `[in] CBLAS_INT` stride length for the second dimension of `A`.
371
+
-**offsetA**: `[in] CBLAS_INT`starting index for `A`.
355
372
-**X**: `[in] float*` search vector.
356
373
-**strideX**: `[in] CBLAS_INT` stride length for `X`.
357
374
-**offsetX**: `[in] CBLAS_INT` starting index for `X`.
358
-
-**workspace**: `[inout] uint8_t*` workspace array for tracking row match candidates. This parameter is ignored if the function is provided an input matrix stored in row-major order.
375
+
-**workspace**: `[inout] uint8_t*` workspace array for tracking row match candidates. This parameter is ignored if the input matrix is stored in row-major order.
359
376
-**strideW**: `[in] CBLAS_INT` stride length for `workspace`.
360
377
-**offsetW**: `[in] CBLAS_INT` starting index for `workspace`.
0 commit comments