Skip to content

Commit 15f18ab

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent d153912 commit 15f18ab

File tree

8 files changed

+37
-27
lines changed

8 files changed

+37
-27
lines changed

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ Note that indexing is relative to the last index. To introduce an offset, use [`
8787
```javascript
8888
var Float64Array = require( '@stdlib/array/float64' );
8989

90-
// Initial array...
90+
// Initial array:
9191
var x0 = new Float64Array( [ -2.0, 3.0, -6.0, -4.0, 5.0, 3.0 ] );
9292

93-
// Create an offset view...
93+
// Create an offset view:
9494
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
9595

96-
// Find index...
96+
// Find index:
9797
var idx = dlastIndexOf( 5, 3.0, x1, 2 );
9898
// returns 2
9999
```
@@ -159,7 +159,7 @@ var x = discreteUniform( 10, -100, 100, {
159159
});
160160
console.log( x );
161161

162-
var idx = dlastIndexOf( x.length, 80.0, x, 1 );
162+
var idx = dlastIndexOf.ndarray( x.length, 80.0, x, 1, 0 );
163163
console.log( idx );
164164
```
165165

@@ -262,7 +262,7 @@ CBLAS_INT stdlib_strided_dlast_index_of_ndarray( const CBLAS_INT N, const double
262262

263263
int main( void ) {
264264
// Create a strided array:
265-
double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, 3.0, 7.0, -8.0 };
265+
const double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, 3.0, 7.0, -8.0 };
266266

267267
// Specify the number of indexed elements:
268268
const int N = 8;

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/docs/repl.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
floating-point strided array using alternative indexing semantics.
4343

4444
While typed array views mandate a view offset based on the underlying
45-
buffer, the offset parameter supports indexing semantics based on a
46-
starting index.
45+
buffer, the offset parameter supports indexing semantics based on a starting
46+
index.
4747

4848
Parameters
4949
----------

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/docs/types/index.d.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919
// TypeScript Version: 4.1
2020

2121
/**
22-
* Interface describing `dlastIndexOf`
23-
*
22+
* Interface describing `dlastIndexOf`.
2423
*/
2524
interface Routine {
2625
/**
2726
* Returns the last index of a specified search element in a double-precision floating-point strided array.
2827
*
28+
* ## Notes
29+
*
30+
* - If the function is unable to find a search element, the function returns `-1`.
31+
*
2932
* @param N - number of indexed elements
3033
* @param searchElement - search element
3134
* @param x - input array
@@ -45,6 +48,10 @@ interface Routine {
4548
/**
4649
* Returns the last index of a specified search element in a double-precision floating-point strided array using alternative indexing semantics.
4750
*
51+
* ## Notes
52+
*
53+
* - If the function is unable to find a search element, the function returns `-1`.
54+
*
4855
* @param N - number of indexed elements
4956
* @param searchElement - search element
5057
* @param x - input array
@@ -66,6 +73,10 @@ interface Routine {
6673
/**
6774
* Returns the last index of a specified search element in a double-precision floating-point strided array.
6875
*
76+
* ## Notes
77+
*
78+
* - If the function is unable to find a search element, the function returns `-1`.
79+
*
6980
* @param N - number of indexed elements
7081
* @param searchElement - search element
7182
* @param x - input array

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/examples/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ var x = discreteUniform( 10, -100, 100, {
2626
});
2727
console.log( x );
2828

29-
var idx = dlastIndexOf.ndarray( 5, 2.0, x, 1, 9 );
29+
var idx = dlastIndexOf.ndarray( x.length, 80.0, x, 1, 0 );
3030
console.log( idx );

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/lib/ndarray.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,19 @@ var dindexOf = require( '@stdlib/blas/ext/base/dindex-of' ).ndarray;
4545
*/
4646
function dlastIndexOf( N, searchElement, x, strideX, offsetX ) {
4747
var idx;
48-
var sv;
49-
var ov;
50-
5148
if ( N <= 0 ) {
5249
return -1;
5350
}
54-
ov = offsetX + ( ( N - 1 ) * strideX );
55-
sv = -strideX;
51+
// Reverse the iteration order by flipping the stride and adjusting the offset:
52+
offsetX += ( N-1 ) * strideX;
53+
strideX *= -1;
5654

57-
// Find index of the search element in the reversed view:
58-
idx = dindexOf( N, searchElement, x, sv, ov );
55+
// Find the index of the search element in the reversed "view":
56+
idx = dindexOf( N, searchElement, x, strideX, offsetX );
5957
if ( idx < 0 ) {
6058
return idx;
6159
}
62-
// Convert the index from reversed view to the forward view:
60+
// Convert the index from reversed "view" to an index in the original "view":
6361
idx = N - 1 - idx;
6462
return idx;
6563
}

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/src/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ CBLAS_INT API_SUFFIX(stdlib_strided_dlast_index_of_ndarray)( const CBLAS_INT N,
5353
if ( N <= 0 ) {
5454
return -1;
5555
}
56+
// Reverse the iteration order by flipping the stride and adjusting the offset:
5657
ov = offsetX + ( ( N - 1 ) * strideX );
5758
sv = -strideX;
5859

59-
// Find index of the search element in the reversed view:
60-
idx = API_SUFFIX(stdlib_strided_dindex_of_ndarray)( N, searchElement, X, sv, ov ); // eslint-disable-line max-len
60+
// Find the index of the search element in the reversed "view":
61+
idx = API_SUFFIX(stdlib_strided_dindex_of_ndarray)( N, searchElement, X, sv, ov );
6162
if ( idx < 0 ) {
6263
return idx;
6364
}
64-
// Convert the index from reversed view to the forward view:
65+
// Convert the index from reversed "view" to an index in the original "view":
6566
idx = N - 1 - idx;
6667
return idx;
6768
}

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/test/test.ndarray.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ tape( 'the function returns the last index of an element which equals a provided
4343
actual = dlastIndexOf( x.length, 1.0, x, 1, 0 );
4444
t.strictEqual( actual, 1, 'returns expected value' );
4545

46-
actual = dlastIndexOf( x.length, 2.0, x, 1, 1 );
46+
actual = dlastIndexOf( x.length-1, 2.0, x, 1, 1 );
4747
t.strictEqual( actual, 2, 'returns expected value' );
4848

49-
actual = dlastIndexOf( x.length, 3.0, x, 1, 2 );
49+
actual = dlastIndexOf( x.length-2, 3.0, x, 1, 2 );
5050
t.strictEqual( actual, 3, 'returns expected value' );
5151

52-
actual = dlastIndexOf( x.length, 4.0, x, 1, 2 );
52+
actual = dlastIndexOf( x.length-2, 4.0, x, 1, 2 );
5353
t.strictEqual( actual, -1, 'returns expected value' );
5454

5555
// Negative stride...

lib/node_modules/@stdlib/blas/ext/base/dlast-index-of/test/test.ndarray.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ tape( 'the function returns the last index of an element which equals a provided
5252
actual = dlastIndexOf( x.length, 1.0, x, 1, 0 );
5353
t.strictEqual( actual, 1, 'returns expected value' );
5454

55-
actual = dlastIndexOf( x.length, 2.0, x, 1, 1 );
55+
actual = dlastIndexOf( x.length-1, 2.0, x, 1, 1 );
5656
t.strictEqual( actual, 2, 'returns expected value' );
5757

58-
actual = dlastIndexOf( x.length, 3.0, x, 1, 2 );
58+
actual = dlastIndexOf( x.length-2, 3.0, x, 1, 2 );
5959
t.strictEqual( actual, 3, 'returns expected value' );
6060

61-
actual = dlastIndexOf( x.length, 4.0, x, 1, 2 );
61+
actual = dlastIndexOf( x.length-2, 4.0, x, 1, 2 );
6262
t.strictEqual( actual, -1, 'returns expected value' );
6363

6464
// Negative stride...

0 commit comments

Comments
 (0)