Skip to content

Commit 118cf33

Browse files
committed
refactor: 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: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: missing_dependencies - 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 6130af2 commit 118cf33

22 files changed

Lines changed: 374 additions & 200 deletions

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ limitations under the License.
3030
var dcartesianSquare = require( '@stdlib/blas/ext/base/dcartesian-square' );
3131
```
3232

33-
#### dcartesianSquare( N, x, strideX, out, strideOut1, strideOut2 )
33+
#### dcartesianSquare( N, x, strideX, out, LDO )
3434

3535
Computes the Cartesian square for a double-precision floating-point strided array.
3636

@@ -40,7 +40,7 @@ var Float64Array = require( '@stdlib/array/float64' );
4040
var x = new Float64Array( [ 1.0, 2.0 ] );
4141
var out = new Float64Array( 8 );
4242

43-
dcartesianSquare( x.length, x, 1, out, 2, 1 );
43+
dcartesianSquare( x.length, x, 1, out, 2 );
4444
// out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4545
```
4646

@@ -50,8 +50,7 @@ The function has the following parameters:
5050
- **x**: input [`Float64Array`][@stdlib/array/float64].
5151
- **strideX**: stride length for `x`.
5252
- **out**: output [`Float64Array`][@stdlib/array/float64].
53-
- **strideOut1**: stride length between consecutive output pairs.
54-
- **strideOut2**: stride length between the two elements of each output pair.
53+
- **LDO**: stride of the leading dimension of `out`.
5554

5655
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the Cartesian square of every other element:
5756

@@ -61,7 +60,7 @@ var Float64Array = require( '@stdlib/array/float64' );
6160
var x = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] );
6261
var out = new Float64Array( 8 );
6362

64-
dcartesianSquare( 2, x, 2, out, 2, 1 );
63+
dcartesianSquare( 2, x, 2, out, 2 );
6564
// out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
6665
```
6766

@@ -78,7 +77,7 @@ var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd
7877

7978
// Compute the Cartesian square of the first two elements of the view:
8079
var out = new Float64Array( 8 );
81-
dcartesianSquare( 2, x1, 1, out, 2, 1 );
80+
dcartesianSquare( 2, x1, 1, out, 2 );
8281
// out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
8382
```
8483

@@ -101,6 +100,8 @@ dcartesianSquare.ndarray( x.length, x, 1, 0, out, 2, 1, 0 );
101100
The function has the following additional parameters:
102101

103102
- **offsetX**: starting index for `x`.
103+
- **strideOut1**: stride length of the first dimension of `out`.
104+
- **strideOut2**: stride length of the second dimension of `out`.
104105
- **offsetOut**: starting index for `out`.
105106

106107
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to access only the last two elements:
@@ -148,7 +149,7 @@ var x = discreteUniform( N, 1, 10, {
148149
console.log( x );
149150

150151
var out = new Float64Array( N * N * 2 );
151-
dcartesianSquare( N, x, 1, out, 2, 1 );
152+
dcartesianSquare( N, x, 1, out, 2 );
152153
console.log( out );
153154
```
154155

@@ -182,15 +183,15 @@ console.log( out );
182183
#include "stdlib/blas/ext/base/dcartesiansquare.h"
183184
```
184185

185-
#### stdlib_strided_dcartesian_square( N, \*X, strideX, \*Out, strideOut1, strideOut2 )
186+
#### stdlib_strided_dcartesian_square( N, \*X, strideX, \*Out, LDO )
186187

187188
Computes the Cartesian square for a double-precision floating-point strided array.
188189

189190
```c
190191
const double x[] = { 1.0, 2.0, 3.0, 4.0 };
191192
double out[ 32 ];
192193

193-
stdlib_strided_dcartesian_square( 4, x, 1, out, 2, 1 );
194+
stdlib_strided_dcartesian_square( 4, x, 1, out, 2 );
194195
```
195196
196197
The function accepts the following arguments:
@@ -199,11 +200,10 @@ The function accepts the following arguments:
199200
- **X**: `[in] double*` input array.
200201
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
201202
- **Out**: `[out] double*` output array.
202-
- **strideOut1**: `[in] CBLAS_INT` stride length between consecutive output pairs.
203-
- **strideOut2**: `[in] CBLAS_INT` stride length between elements of each output pair.
203+
- **LDO**: `[in] CBLAS_INT` stride of the leading dimension of `Out`.
204204
205205
```c
206-
void stdlib_strided_dcartesian_square( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Out, const CBLAS_INT strideOut1, const CBLAS_INT strideOut2 );
206+
void stdlib_strided_dcartesian_square( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, double *Out, const CBLAS_INT LDO );
207207
```
208208

209209
<!-- lint disable maximum-heading-length -->
@@ -226,8 +226,8 @@ The function accepts the following arguments:
226226
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
227227
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
228228
- **Out**: `[out] double*` output array.
229-
- **strideOut1**: `[in] CBLAS_INT` stride length between consecutive output pairs.
230-
- **strideOut2**: `[in] CBLAS_INT` stride length between elements of each output pair.
229+
- **strideOut1**: `[in] CBLAS_INT` stride length of the first dimension of `Out`.
230+
- **strideOut2**: `[in] CBLAS_INT` stride length of the second dimension of `Out`.
231231
- **offsetOut**: `[in] CBLAS_INT` starting index for `Out`.
232232
233233
```c
@@ -268,11 +268,10 @@ int main( void ) {
268268

269269
// Specify strides:
270270
const int strideX = 1;
271-
const int strideOut1 = 2;
272-
const int strideOut2 = 1;
271+
const int LDO = 2;
273272

274273
// Compute the Cartesian square:
275-
stdlib_strided_dcartesian_square( N, x, strideX, out, strideOut1, strideOut2 );
274+
stdlib_strided_dcartesian_square( N, x, strideX, out, LDO );
276275

277276
// Print the result:
278277
for ( int i = 0; i < N*N; i++ ) {

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function createBenchmark( len ) {
6666

6767
b.tic();
6868
for ( i = 0; i < b.iterations; i++ ) {
69-
y = dcartesianSquare( x.length, x, 1, out, 2, 1 );
69+
y = dcartesianSquare( x.length, x, 1, out, 2 );
7070
if ( isnan( y[ 0 ] ) ) {
7171
b.fail( 'should not return NaN' );
7272
}

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/benchmark/benchmark.native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function createBenchmark( len ) {
7171

7272
b.tic();
7373
for ( i = 0; i < b.iterations; i++ ) {
74-
y = dcartesianSquare( x.length, x, 1, out, 2, 1 );
74+
y = dcartesianSquare( x.length, x, 1, out, 2 );
7575
if ( isnan( y[ 0 ] ) ) {
7676
b.fail( 'should not return NaN' );
7777
}

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/benchmark/c/benchmark.length.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static double benchmark1( int iterations, int len ) {
108108
}
109109
t = tic();
110110
for ( i = 0; i < iterations; i++ ) {
111-
stdlib_strided_dcartesian_square( len, x, 1, out, 2, 1 );
111+
stdlib_strided_dcartesian_square( len, x, 1, out, 2 );
112112
if ( out[ 0 ] != out[ 0 ] ) {
113113
printf( "should not return NaN\n" );
114114
break;

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/docs/repl.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
{{alias}}( N, x, strideX, out, strideOut1, strideOut2 )
2+
{{alias}}( N, x, strideX, out, LDO )
33
Computes the Cartesian square for a double-precision floating-point strided
44
array.
55

@@ -22,11 +22,8 @@
2222
out: Float64Array
2323
Output array.
2424

25-
strideOut1: integer
26-
Stride length between consecutive output pairs.
27-
28-
strideOut2: integer
29-
Stride length between elements of each output pair.
25+
LDO: integer
26+
Stride of the leading dimension of `out`.
3027

3128
Returns
3229
-------
@@ -38,20 +35,20 @@
3835
// Standard Usage:
3936
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0 ] );
4037
> var out = new {{alias:@stdlib/array/float64}}( 8 );
41-
> {{alias}}( x.length, x, 1, out, 2, 1 )
38+
> {{alias}}( x.length, x, 1, out, 2 )
4239
<Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4340

4441
// Using `N` and stride parameters:
4542
> x = new {{alias:@stdlib/array/float64}}( [ 1.0, 0.0, 2.0, 0.0 ] );
4643
> out = new {{alias:@stdlib/array/float64}}( 8 );
47-
> {{alias}}( 2, x, 2, out, 2, 1 )
44+
> {{alias}}( 2, x, 2, out, 2 )
4845
<Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4946

5047
// Using view offsets:
5148
> var x0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 1.0, 2.0, 3.0 ] );
5249
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
5350
> out = new {{alias:@stdlib/array/float64}}( 8 );
54-
> {{alias}}( 2, x1, 1, out, 2, 1 )
51+
> {{alias}}( 2, x1, 1, out, 2 )
5552
<Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
5653

5754

@@ -81,10 +78,10 @@
8178
Output array.
8279

8380
strideOut1: integer
84-
Stride length between consecutive output pairs.
81+
Stride length of the first dimension of `out`.
8582

8683
strideOut2: integer
87-
Stride length between elements of each output pair.
84+
Stride length of the second dimension of `out`.
8885

8986
offsetOut: integer
9087
Starting index.

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/docs/types/index.d.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ interface Routine {
2929
* @param x - input array
3030
* @param strideX - stride length
3131
* @param out - output array
32-
* @param strideOut1 - stride length between consecutive output pairs
33-
* @param strideOut2 - stride length between elements of each output pair
32+
* @param LDO - stride of the leading dimension of `out`
3433
* @returns output array
3534
*
3635
* @example
@@ -39,10 +38,10 @@ interface Routine {
3938
* var x = new Float64Array( [ 1.0, 2.0 ] );
4039
* var out = new Float64Array( 8 );
4140
*
42-
* dcartesianSquare( x.length, x, 1, out, 2, 1 );
41+
* dcartesianSquare( x.length, x, 1, out, 2 );
4342
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4443
*/
45-
( N: number, x: Float64Array, strideX: number, out: Float64Array, strideOut1: number, strideOut2: number ): Float64Array;
44+
( N: number, x: Float64Array, strideX: number, out: Float64Array, LDO: number ): Float64Array;
4645

4746
/**
4847
* Computes the Cartesian square for a double-precision floating-point strided array using alternative indexing semantics.
@@ -52,8 +51,8 @@ interface Routine {
5251
* @param strideX - stride length
5352
* @param offsetX - starting index
5453
* @param out - output array
55-
* @param strideOut1 - stride length between consecutive output pairs
56-
* @param strideOut2 - stride length between elements of each output pair
54+
* @param strideOut1 - stride length of the first dimension of `out`
55+
* @param strideOut2 - stride length of the second dimension of `out`
5756
* @param offsetOut - starting index
5857
* @returns output array
5958
*
@@ -76,8 +75,7 @@ interface Routine {
7675
* @param x - input array
7776
* @param strideX - stride length
7877
* @param out - output array
79-
* @param strideOut1 - stride length between consecutive output pairs
80-
* @param strideOut2 - stride length between elements of each output pair
78+
* @param LDO - stride of the leading dimension of `out`
8179
* @returns output array
8280
*
8381
* @example
@@ -86,7 +84,7 @@ interface Routine {
8684
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
8785
* var out = new Float64Array( 18 );
8886
*
89-
* dcartesianSquare( x.length, x, 1, out, 2, 1 );
87+
* dcartesianSquare( x.length, x, 1, out, 2 );
9088
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 1.0, 3.0, 2.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 1.0, 3.0, 2.0, 3.0, 3.0 ]
9189
*
9290
* @example

0 commit comments

Comments
 (0)