Skip to content

Commit da4a8e3

Browse files
committed
fix: apply suggestions from code review
--- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - 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 2410f40 commit da4a8e3

5 files changed

Lines changed: 45 additions & 44 deletions

File tree

lib/node_modules/@stdlib/blas/ext/base/dediff/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ console.log( out );
152152

153153
## Notes
154154

155-
- If `N <= 0`, both functions return `x` unchanged.
155+
- If the sum of `N`, `N1`, and `N2` is less than or equal to `1`, both functions return the output array unchanged.
156156

157157
</section>
158158

@@ -222,14 +222,14 @@ console.log( 'Output', out );
222222

223223
<!-- lint disable maximum-heading-length -->
224224

225-
#### stdlib_strided_dediff( N, x, strideX, N1, prepend, strideP, N2, append, strideA, \*out, strideOut )
225+
#### stdlib_strided_dediff( N, \*X, strideX, N1, \*prepend, strideP, N2, \*append, strideA, \*Out, strideOut )
226226

227227
Calculates the differences between consecutive elements of a double-precision floating-point strided array.
228228

229229
```c
230-
double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
231-
double p[] = { 1.0 };
232-
double a[] = { 11.0 };
230+
const double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
231+
const double p[] = { 1.0 };
232+
const double a[] = { 11.0 };
233233
double out[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
234234

235235
stdlib_strided_dediff( 5, x, 1, 1, p, 1, 1, a, 1, out, 1 );
@@ -238,31 +238,31 @@ stdlib_strided_dediff( 5, x, 1, 1, p, 1, 1, a, 1, out, 1 );
238238
The function accepts the following arguments:
239239
240240
- **N**: `[in] CBLAS_INT` number of indexed elements.
241-
- **x**: `[in] double` input [`Float64Array`][@stdlib/array/float64].
242-
- **strideX**: `[in] CBLAS_INT` stride length for `x`.
241+
- **X**: `[in] double` input [`Float64Array`][@stdlib/array/float64].
242+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
243243
- **N1**: `[in] CBLAS_INT` number of elements in `prepend`.
244244
- **prepend**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to prepend after computing differences.
245245
- **strideP**: `[in] CBLAS_INT` stride length for `prepend`.
246246
- **N2**: `[in] CBLAS_INT` number of elements in `append`.
247247
- **append**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to append after computing differences.
248248
- **strideA**: `[in] CBLAS_INT` strides length for `append`.
249-
- **out**: `[in] double` output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
250-
- **strideOut**: `[in] CBLAS_INT` stride length for `out`.
249+
- **Out**: `[inout] double` output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
250+
- **strideOut**: `[in] CBLAS_INT` stride length for `Out`.
251251
252252
```c
253-
void stdlib_strided_dediff( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, double *out, const CBLAS_INT strideOut );
253+
void stdlib_strided_dediff( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, double *Out, const CBLAS_INT strideOut );
254254
```
255255

256256
<!-- lint disable maximum-heading-length -->
257257

258-
#### stdlib_strided_dediff_ndarray( N, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, \*out, strideOut, offsetOut )
258+
#### stdlib_strided_dediff_ndarray( N, \*X, strideX, offsetX, N1, \*prepend, strideP, offsetP, N2, \*append, strideA, offsetA, \*Out, strideOut, offsetOut )
259259

260260
Calculates the differences between consecutive elements of a double-precision floating-point strided array using alternative indexing semantics.
261261

262262
```c
263-
double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
264-
double p[] = { 1.0 };
265-
double a[] = { 11.0 };
263+
const double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
264+
const double p[] = { 1.0 };
265+
const double a[] = { 11.0 };
266266
double out[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
267267

268268
stdlib_strided_dediff_ndarray( 5, 1, x, 1, 0, 1, p, 1, 0, 1, a, 1, 0, out, 1, 0 );
@@ -271,9 +271,9 @@ stdlib_strided_dediff_ndarray( 5, 1, x, 1, 0, 1, p, 1, 0, 1, a, 1, 0, out, 1, 0
271271
The function accepts the following arguments:
272272
273273
- **N**: `[in] CBLAS_INT` number of indexed elements.
274-
- **x**: `[in] double` input [`Float64Array`][@stdlib/array/float64].
275-
- **strideX**: `[in] CBLAS_INT` stride length for `x`.
276-
- **offsetX**: `[in] CBLAS_INT` starting index for `x`.
274+
- **X**: `[in] double` input [`Float64Array`][@stdlib/array/float64].
275+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
276+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
277277
- **N1**: `[in] CBLAS_INT` number of elements in `prepend`.
278278
- **prepend**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to prepend after computing differences.
279279
- **strideP**: `[in] CBLAS_INT` stride length for `prepend`.
@@ -282,12 +282,12 @@ The function accepts the following arguments:
282282
- **append**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to append after computing differences.
283283
- **strideA**: `[in] CBLAS_INT` strides length for `append`.
284284
- **offsetA**: `[in] CBLAS_INT` starting index for `append`.
285-
- **out**: `[in] double` output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
286-
- **strideOut**: `[in] CBLAS_INT` stride length for `out`.
287-
- **offsetOut**: `[in] CBLAS_INT` starting index for `out`.
285+
- **Out**: `[inout] double` output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
286+
- **strideOut**: `[in] CBLAS_INT` stride length for `Out`.
287+
- **offsetOut**: `[in] CBLAS_INT` starting index for `Out`.
288288
289289
```c
290-
void stdlib_strided_dediff_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT offsetP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, const CBLAS_INT offsetA, double *out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut );
290+
void stdlib_strided_dediff_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT offsetP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, const CBLAS_INT offsetA, double *Out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut );
291291
```
292292

293293
</section>

lib/node_modules/@stdlib/blas/ext/base/dediff/docs/repl.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
Indexing is relative to the first index. To introduce an offset, use a typed
1010
array view.
1111

12-
If `N <= 0`, the function returns `x` unchanged.
12+
If the sum of `N`, `N1`, and `N2` is less than or equal to `1`, both
13+
functions return the output array unchanged.
1314

1415
Parameters
1516
----------

lib/node_modules/@stdlib/blas/ext/base/dediff/include/stdlib/blas/ext/base/dediff.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ extern "C" {
3131
/**
3232
* Calculates the differences between consecutive elements of a double-precision floating-point strided array.
3333
*/
34-
void API_SUFFIX(stdlib_strided_dediff)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, double *out, const CBLAS_INT strideOut );
34+
void API_SUFFIX(stdlib_strided_dediff)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, double *Out, const CBLAS_INT strideOut );
3535

3636
/**
3737
* Calculates the differences between consecutive elements of a double-precision floating-point strided array using alternative indexing semantics.
3838
*/
39-
void API_SUFFIX(stdlib_strided_dediff_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT offsetP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, const CBLAS_INT offsetA, double *out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut );
39+
void API_SUFFIX(stdlib_strided_dediff_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT offsetP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, const CBLAS_INT offsetA, double *Out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut );
4040

4141

4242
#ifdef __cplusplus

lib/node_modules/@stdlib/blas/ext/base/dediff/src/addon.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
4343
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
4444
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, prepend, N1, strideP, argv, 4 );
4545
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, append, N2, strideA, argv, 7 );
46-
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, out, N+N1+N2-1, strideOut, argv, 9 );
47-
API_SUFFIX(stdlib_strided_dediff)( N, X, strideX, N1, prepend, strideP, N2, append, strideA, out, strideOut );
46+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Out, N+N1+N2-1, strideOut, argv, 9 );
47+
API_SUFFIX(stdlib_strided_dediff)( N, X, strideX, N1, prepend, strideP, N2, append, strideA, Out, strideOut );
4848
return NULL;
4949
}
5050

@@ -71,8 +71,8 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
7171
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
7272
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, prepend, N1, strideP, argv, 5 );
7373
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, append, N2, strideA, argv, 9 );
74-
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, out, N+N1+N2-1, strideOut, argv, 12 );
75-
API_SUFFIX(stdlib_strided_dediff_ndarray)( N, X, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, out, strideOut, offsetOut );
74+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Out, N+N1+N2-1, strideOut, argv, 12 );
75+
API_SUFFIX(stdlib_strided_dediff_ndarray)( N, X, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, Out, strideOut, offsetOut );
7676
return NULL;
7777
}
7878

lib/node_modules/@stdlib/blas/ext/base/dediff/src/main.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,32 @@
2525
* Calculates the differences between consecutive elements of a double-precision floating-point strided array.
2626
*
2727
* @param N number of indexed elements
28-
* @param x input array
29-
* @param strideX stride length for `x`
28+
* @param X input array
29+
* @param strideX stride length for `X`
3030
* @param N1 number of indexed elements of prepend
3131
* @param prepend prepend array
3232
* @param strideP stride length for `prepend`
3333
* @param N2 number of indexed elements of append
3434
* @param append append array
3535
* @param strideA stride length for `append`
36-
* @param out output array
37-
* @param strideOut stride length for `out`
36+
* @param Out output array
37+
* @param strideOut stride length for `Out`
3838
*/
39-
void API_SUFFIX(stdlib_strided_dediff)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, double *out, const CBLAS_INT strideOut ) {
39+
void API_SUFFIX(stdlib_strided_dediff)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, double *Out, const CBLAS_INT strideOut ) {
4040
const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
4141
const CBLAS_INT op = stdlib_strided_stride2offset( N1, strideP );
4242
const CBLAS_INT oa = stdlib_strided_stride2offset( N2, strideA );
4343
const CBLAS_INT oo = stdlib_strided_stride2offset( N+N1+N2-1, strideOut );
44-
API_SUFFIX(stdlib_strided_dediff_ndarray)( N, X, strideX, ox, N1, prepend, strideP, op, N2, append, strideA, oa, out, strideOut, oo );
44+
API_SUFFIX(stdlib_strided_dediff_ndarray)( N, X, strideX, ox, N1, prepend, strideP, op, N2, append, strideA, oa, Out, strideOut, oo );
4545
}
4646

4747
/**
4848
* Calculates the differences between consecutive elements of a double-precision floating-point strided array using alternative indexing semantics.
4949
*
5050
* @param N number of indexed elements
51-
* @param x input array
52-
* @param strideX stride length for `x`
53-
* @param offsetX starting index for `x`
51+
* @param X input array
52+
* @param strideX stride length for `X`
53+
* @param offsetX starting index for `X`
5454
* @param N1 number of indexed elements of prepend
5555
* @param prepend prepend array
5656
* @param strideP stride length for `prepend`
@@ -59,11 +59,11 @@ void API_SUFFIX(stdlib_strided_dediff)( const CBLAS_INT N, const double *X, cons
5959
* @param append append array
6060
* @param strideA stride length for `append`
6161
* @param offsetA starting index for `append`
62-
* @param out output array
63-
* @param strideOut stride length for `out`
64-
* @param offsetOut starting index for `out`
62+
* @param Out output array
63+
* @param strideOut stride length for `Out`
64+
* @param offsetOut starting index for `Out`
6565
*/
66-
void API_SUFFIX(stdlib_strided_dediff_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT offsetP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, const CBLAS_INT offsetA, double *out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut ) {
66+
void API_SUFFIX(stdlib_strided_dediff_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT N1, const double *prepend, const CBLAS_INT strideP, const CBLAS_INT offsetP, const CBLAS_INT N2, const double *append, const CBLAS_INT strideA, const CBLAS_INT offsetA, double *Out, const CBLAS_INT strideOut, const CBLAS_INT offsetOut ) {
6767
CBLAS_INT total;
6868
CBLAS_INT ix;
6969
CBLAS_INT io;
@@ -77,7 +77,7 @@ void API_SUFFIX(stdlib_strided_dediff_ndarray)( const CBLAS_INT N, const double
7777
}
7878

7979
// Copy `prepend` into output array:
80-
c_dcopy_ndarray( N1, prepend, strideP, offsetP, out, strideOut, offsetOut );
80+
c_dcopy_ndarray( N1, prepend, strideP, offsetP, Out, strideOut, offsetOut );
8181

8282
// Compute differences of input array:
8383
ix = offsetX;
@@ -86,13 +86,13 @@ void API_SUFFIX(stdlib_strided_dediff_ndarray)( const CBLAS_INT N, const double
8686
for ( i = 1; i < N; i++ ) {
8787
ix += strideX;
8888
curr = X[ ix ];
89-
out[ io ] = curr - prev;
89+
Out[ io ] = curr - prev;
9090
prev = curr;
9191
io += strideOut;
9292
}
9393

9494
// Copy `append` into output array:
95-
c_dcopy_ndarray( N2, append, strideA, offsetA, out, strideOut, io );
95+
c_dcopy_ndarray( N2, append, strideA, offsetA, Out, strideOut, io );
9696

9797
return;
9898
}

0 commit comments

Comments
 (0)