Skip to content

Commit 55c2534

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: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - 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: 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: passed - task: lint_license_headers status: passed ---
1 parent 57ae344 commit 55c2534

12 files changed

Lines changed: 837 additions & 1060 deletions

File tree

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ The function has the following parameters:
6161
- **prepend**: a [`Float64Array`][@stdlib/array/float64] containing values to prepend prior to computing differences.
6262
- **strideP**: stride length for `prepend`.
6363
- **N2**: number of elements to `append`.
64-
- **append**: a [`Float64Array`][@stdlib/array/float64] containing values to append prior to computing differences..
65-
- **strideA**: strides length for `append`.
64+
- **append**: a [`Float64Array`][@stdlib/array/float64] containing values to append prior to computing differences.
65+
- **strideA**: stride length for `append`.
6666
- **out**: output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - k` elements.
6767
- **strideOut**: stride length for `out`.
6868
- **workspace**: workspace [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
@@ -161,7 +161,7 @@ console.log( out );
161161

162162
## Notes
163163

164-
- If `N <= 0`, both functions return `x` unchanged.
164+
- If `N <= 0`, both functions return the output array unchanged.
165165

166166
</section>
167167

@@ -233,14 +233,14 @@ console.log( 'Output', out );
233233

234234
<!-- lint disable maximum-heading-length -->
235235

236-
#### stdlib_strided_ddiff( N, k, x, strideX, N1, prepend, strideP, N2, append, strideA, \*out, strideOut, workspace, strideW )
236+
#### stdlib_strided_ddiff( N, k, \*X, strideX, N1, \*prepend, strideP, N2, \*append, strideA, \*Out, strideOut, \*Workspace, strideW )
237237

238238
Calculates the k-th discrete forward differences of a double-precision floating-point strided array.
239239

240240
```c
241-
double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
242-
double p[] = { 1.0 };
243-
double a[] = { 11.0 };
241+
const double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
242+
const double p[] = { 1.0 };
243+
const double a[] = { 11.0 };
244244
double out[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
245245
double w[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
246246

@@ -251,33 +251,33 @@ The function accepts the following arguments:
251251
252252
- **N**: `[in] CBLAS_INT` number of indexed elements.
253253
- **k**: `[in] CBLAS_INT` number of times to recursively compute differences.
254-
- **x**: `[in] double` input [`Float64Array`][@stdlib/array/float64].
254+
- **X**: `[in] double*` input array.
255255
- **strideX**: `[in] CBLAS_INT` stride length for `x`.
256256
- **N1**: `[in] CBLAS_INT` number of elements in `prepend`.
257-
- **prepend**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to prepend prior to computing differences.
257+
- **prepend**: `[in] double*` array containing values to prepend prior to computing differences.
258258
- **strideP**: `[in] CBLAS_INT` stride length for `prepend`.
259259
- **N2**: `[in] CBLAS_INT` number of elements in `append`.
260-
- **append**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to append prior to computing differences..
261-
- **strideA**: `[in] CBLAS_INT` strides length for `append`.
262-
- **out**: `[in] double` output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - k` elements.
260+
- **append**: `[in] double*` array containing values to append prior to computing differences.
261+
- **strideA**: `[in] CBLAS_INT` stride length for `append`.
262+
- **Out**: `[inout] double*` output array. Must have `N + N1 + N2 - k` elements.
263263
- **strideOut**: `[in] CBLAS_INT` stride length for `out`.
264-
- **workspace**: `[in] double` workspace [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
264+
- **Workspace**: `[inout] double*` workspace array. Must have `N + N1 + N2 - 1` elements.
265265
- **strideW**: `[in] CBLAS_INT` stride length for `workspace`.
266266
267267
```c
268-
void stdlib_strided_ddiff( const CBLAS_INT N, const CBLAS_INT k, 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, double *workspace, const CBLAS_INT strideW );
268+
void stdlib_strided_ddiff( const CBLAS_INT N, const CBLAS_INT k, 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, double *Workspace, const CBLAS_INT strideW );
269269
```
270270

271271
<!-- lint disable maximum-heading-length -->
272272

273-
#### stdlib_strided_ddiff_ndarray( N, k, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, \*out, strideOut, offsetOut, w, strideW, offsetW )
273+
#### stdlib_strided_ddiff_ndarray( N, k, \*X, strideX, offsetX, N1, \*prepend, strideP, offsetP, N2, \*append, strideA, offsetA, \*Out, strideOut, offsetOut, \*W, strideW, offsetW )
274274

275275
Calculates the k-th discrete forward differences of a double-precision floating-point strided array using alternative indexing semantics.
276276

277277
```c
278-
double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
279-
double p[] = { 1.0 };
280-
double a[] = { 11.0 };
278+
const double x[] = { 2.0, 4.0, 6.0, 8.0, 10.0 };
279+
const double p[] = { 1.0 };
280+
const double a[] = { 11.0 };
281281
double out[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
282282
double w[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
283283

@@ -288,26 +288,26 @@ The function accepts the following arguments:
288288
289289
- **N**: `[in] CBLAS_INT` number of indexed elements.
290290
- **k**: `[in] CBLAS_INT` number of times to recursively compute differences.
291-
- **x**: `[in] double` input [`Float64Array`][@stdlib/array/float64].
291+
- **X**: `[in] double*` input array.
292292
- **strideX**: `[in] CBLAS_INT` stride length for `x`.
293293
- **offsetX**: `[in] CBLAS_INT` starting index for `x`.
294294
- **N1**: `[in] CBLAS_INT` number of elements in `prepend`.
295-
- **prepend**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to prepend prior to computing differences.
295+
- **prepend**: `[in] double*` array containing values to prepend prior to computing differences.
296296
- **strideP**: `[in] CBLAS_INT` stride length for `prepend`.
297297
- **offsetP**: `[in] CBLAS_INT` starting index for `prepend`.
298298
- **N2**: `[in] CBLAS_INT` number of elements in `append`.
299-
- **append**: `[in] double` a [`Float64Array`][@stdlib/array/float64] containing values to append prior to computing differences..
300-
- **strideA**: `[in] CBLAS_INT` strides length for `append`.
299+
- **append**: `[in] double*` array containing values to append prior to computing differences.
300+
- **strideA**: `[in] CBLAS_INT` stride length for `append`.
301301
- **offsetA**: `[in] CBLAS_INT` starting index for `append`.
302-
- **out**: `[in] double` output [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - k` elements.
302+
- **Out**: `[inout] double*` output array. Must have `N + N1 + N2 - k` elements.
303303
- **strideOut**: `[in] CBLAS_INT` stride length for `out`.
304304
- **offsetOut**: `[in] CBLAS_INT` starting index for `out`.
305-
- **workspace**: `[in] double` workspace [`Float64Array`][@stdlib/array/float64]. Must have `N + N1 + N2 - 1` elements.
305+
- **Workspace**: `[inout] double*` workspace array. Must have `N + N1 + N2 - 1` elements.
306306
- **strideW**: `[in] CBLAS_INT` stride length for `workspace`.
307307
- **offsetW**: `[in] CBLAS_INT` starting index for `workspace`.
308308
309309
```c
310-
void stdlib_strided_ddiff_ndarray( const CBLAS_INT N, const CBLAS_INT k, 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, double *workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW );
310+
void stdlib_strided_ddiff_ndarray( const CBLAS_INT N, const CBLAS_INT k, 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, double *Workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW );
311311
```
312312

313313
</section>

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
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 `N <= 0`, the function returns the output array unchanged.
1313

1414
Parameters
1515
----------
@@ -47,7 +47,7 @@
4747
Output array.
4848

4949
so: integer
50-
Stride length for `Out`.
50+
Stride length for `out`.
5151

5252
w: Float64Array
5353
Workspace array.
@@ -62,7 +62,7 @@
6262

6363
Examples
6464
--------
65-
// Standard Usage:
65+
// Standard usage:
6666
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] );
6767
> var p = new {{alias:@stdlib/array/float64}}( [ 0.0 ] );
6868
> var a = new {{alias:@stdlib/array/float64}}( [ 3.0 ] );
@@ -75,8 +75,8 @@
7575
> x = new {{alias:@stdlib/array/float64}}( [ 2.0, 4.0, 6.0, 8.0, 10.0 ] );
7676
> p = new {{alias:@stdlib/array/float64}}( [ 1.0 ] );
7777
> a = new {{alias:@stdlib/array/float64}}( [ 11.0 ] );
78-
> var out = new {{alias:@stdlib/array/float64}}( 4 );
79-
> var w = new {{alias:@stdlib/array/float64}}( 4 );
78+
> out = new {{alias:@stdlib/array/float64}}( 4 );
79+
> w = new {{alias:@stdlib/array/float64}}( 4 );
8080
> {{alias}}( 3, 1, x, 2, 1, p, 1, 1, a, 1, out, 1, w, 1 )
8181
<Float64Array>[ 1.0, 4.0, 4.0, 1.0 ]
8282

@@ -85,8 +85,8 @@
8585
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
8686
> p = new {{alias:@stdlib/array/float64}}( [ 1.0 ] );
8787
> a = new {{alias:@stdlib/array/float64}}( [ 11.0 ] );
88-
> var out = new {{alias:@stdlib/array/float64}}( 5 );
89-
> var w = new {{alias:@stdlib/array/float64}}( 5 );
88+
> out = new {{alias:@stdlib/array/float64}}( 5 );
89+
> w = new {{alias:@stdlib/array/float64}}( 5 );
9090
> {{alias}}( x1.length, 1, x1, 1, 1, p, 1, 1, a, 1, out, 1, w, 1 )
9191
<Float64Array>[ 3.0, 2.0, 2.0, 2.0, 1.0 ]
9292

@@ -144,10 +144,10 @@
144144
Output array.
145145

146146
so: integer
147-
Stride length for `Out`.
147+
Stride length for `out`.
148148

149149
oo: integer
150-
Stride length for `Out`.
150+
Starting index for `out`.
151151

152152
w: Float64Array
153153
Workspace array.
@@ -165,7 +165,7 @@
165165

166166
Examples
167167
--------
168-
// Standard Usage:
168+
// Standard usage:
169169
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] );
170170
> var p = new {{alias:@stdlib/array/float64}}( [ 0.0 ] );
171171
> var a = new {{alias:@stdlib/array/float64}}( [ 3.0 ] );

lib/node_modules/@stdlib/blas/ext/base/ddiff/docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface Routine {
4848
* var p = new Float64Array( [ 1.0 ] );
4949
* var a = new Float64Array( [ 22.0 ] );
5050
* var out = new Float64Array( 5 );
51-
* var w = new Float64Array( 6 )
51+
* var w = new Float64Array( 6 );
5252
*
5353
* ddiff( x.length, 2, x, 1, 1, p, 1, 1, a, 1, out, 1, w, 1 );
5454
*
@@ -88,14 +88,14 @@ interface Routine {
8888
* var p = new Float64Array( [ 1.0 ] );
8989
* var a = new Float64Array( [ 22.0 ] );
9090
* var out = new Float64Array( 5 );
91-
* var w = new Float64Array( 6 )
91+
* var w = new Float64Array( 6 );
9292
*
9393
* ddiff.ndarray( x.length, 2, x, 1, 0, 1, p, 1, 0, 1, a, 1, 0, out, 1, 0, w, 1, 0 );
9494
*
9595
* console.log( out );
9696
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
9797
*/
98-
ndarray ( N: number, k: number, x: Float64Array, strideX: number, offsetX: number, N1: number, prepend: Float64Array, strideP: number, offsetP: number, N2: number, append: Float64Array, strideA: number, offsetA: number, out: Float64Array, strideOut: number, offsetOut: number, workspace: Float64Array, strideW: number, offsetW: number ): Float64Array;
98+
ndarray( N: number, k: number, x: Float64Array, strideX: number, offsetX: number, N1: number, prepend: Float64Array, strideP: number, offsetP: number, N2: number, append: Float64Array, strideA: number, offsetA: number, out: Float64Array, strideOut: number, offsetOut: number, workspace: Float64Array, strideW: number, offsetW: number ): Float64Array;
9999
}
100100

101101
/**

lib/node_modules/@stdlib/blas/ext/base/ddiff/include/stdlib/blas/ext/base/ddiff.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 k-th discrete forward differences of a double-precision floating-point strided array.
3333
*/
34-
void API_SUFFIX(stdlib_strided_ddiff)( const CBLAS_INT N, const CBLAS_INT k, 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, double *workspace, const CBLAS_INT strideW );
34+
void API_SUFFIX(stdlib_strided_ddiff)( const CBLAS_INT N, const CBLAS_INT k, 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, double *Workspace, const CBLAS_INT strideW );
3535

3636
/**
3737
* Calculates the k-th discrete forward differences of a double-precision floating-point strided array using alternative indexing semantics.
3838
*/
39-
void API_SUFFIX(stdlib_strided_ddiff_ndarray)( const CBLAS_INT N, const CBLAS_INT k, 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, double *workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW );
39+
void API_SUFFIX(stdlib_strided_ddiff_ndarray)( const CBLAS_INT N, const CBLAS_INT k, 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, double *Workspace, const CBLAS_INT strideW, const CBLAS_INT offsetW );
4040

4141

4242
#ifdef __cplusplus

lib/node_modules/@stdlib/blas/ext/base/ddiff/lib/ddiff.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ var ndarray = require( './ndarray.js' );
5454
* var p = new Float64Array( [ 1.0 ] );
5555
* var a = new Float64Array( [ 22.0 ] );
5656
* var out = new Float64Array( 5 );
57-
* var w = new Float64Array( 6 )
57+
* var w = new Float64Array( 6 );
5858
*
5959
* ddiff( x.length, 2, x, 1, 1, p, 1, 1, a, 1, out, 1, w, 1 );
6060
*
6161
* console.log( out );
62-
* // out => <Float64Array>[ 1, 1, 1, 1, 1 ]
62+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
6363
*/
6464
function ddiff( N, k, x, strideX, N1, prepend, strideP, N2, append, strideA, out, strideOut, workspace, strideW ) {
6565
var ox = stride2offset( N, strideX );

lib/node_modules/@stdlib/blas/ext/base/ddiff/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* var p = new Float64Array( [ 1.0 ] );
3232
* var a = new Float64Array( [ 22.0 ] );
3333
* var out = new Float64Array( 5 );
34-
* var w = new Float64Array( 6 )
34+
* var w = new Float64Array( 6 );
3535
*
3636
* ddiff( x.length, 2, x, 1, 1, p, 1, 1, a, 1, out, 1, w, 1 );
3737
*

lib/node_modules/@stdlib/blas/ext/base/ddiff/lib/ndarray.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ function base( N, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append
102102
}
103103
} else if ( N > 0 ) {
104104
prev = x[ offsetX ];
105-
io = offsetX;
105+
io = offsetOut;
106106
} else {
107107
prev = append[ offsetA ];
108-
io = offsetA;
108+
io = offsetOut;
109109
}
110110

111111
// x
@@ -187,7 +187,7 @@ function base( N, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append
187187
* var p = new Float64Array( [ 1.0 ] );
188188
* var a = new Float64Array( [ 22.0 ] );
189189
* var out = new Float64Array( 5 );
190-
* var w = new Float64Array( 6 )
190+
* var w = new Float64Array( 6 );
191191
*
192192
* ddiff( x.length, 2, x, 1, 0, 1, p, 1, 0, 1, a, 1, 0, out, 1, 0, w, 1, 0 );
193193
*

0 commit comments

Comments
 (0)