Skip to content

Commit 3cba784

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: 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 4de2981 commit 3cba784

22 files changed

Lines changed: 475 additions & 248 deletions

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

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ limitations under the License.
3030
var dcartesianProduct = require( '@stdlib/blas/ext/base/dcartesian-product' );
3131
```
3232

33-
<!-- lint disable maximum-heading-length -->
33+
#### dcartesianProduct( M, N, x, strideX, y, strideY, out, LDO )
3434

35-
#### dcartesianProduct( M, N, x, strideX, y, strideY, out, strideOut1, strideOut2 )
36-
37-
Computes the Cartesian product for a double-precision floating-point strided array.
35+
Computes the Cartesian product for two double-precision floating-point strided arrays.
3836

3937
```javascript
4038
var Float64Array = require( '@stdlib/array/float64' );
@@ -44,7 +42,7 @@ var y = new Float64Array( [ 3.0, 4.0 ] );
4442
var out = new Float64Array( 8 );
4543

4644
// Compute the Cartesian product:
47-
dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2, 1 );
45+
dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2 );
4846
// out => <Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
4947
```
5048

@@ -57,10 +55,9 @@ The function has the following parameters:
5755
- **y**: input [`Float64Array`][@stdlib/array/float64].
5856
- **strideY**: stride length for `y`.
5957
- **out**: output [`Float64Array`][@stdlib/array/float64].
60-
- **strideOut1**: stride length between consecutive output pairs.
61-
- **strideOut2**: stride length between the two elements of each output pair.
58+
- **LDO**: stride of the leading dimension of `out`.
6259

63-
The `N`, `M` 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:
60+
The `M`, `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:
6461

6562
```javascript
6663
var Float64Array = require( '@stdlib/array/float64' );
@@ -70,7 +67,7 @@ var y = new Float64Array( [ 3.0, 0.0, 4.0, 0.0 ] );
7067
var out = new Float64Array( 8 );
7168

7269
// Compute the Cartesian product:
73-
dcartesianProduct( 2, 2, x, 2, y, 2, out, 2, 1 );
70+
dcartesianProduct( 2, 2, x, 2, y, 2, out, 2 );
7471
// out => <Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
7572
```
7673

@@ -90,7 +87,7 @@ var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd
9087
var out = new Float64Array( 8 );
9188

9289
// Compute the Cartesian product:
93-
dcartesianProduct( 2, 2, x1, 1, y1, 1, out, 2, 1 );
90+
dcartesianProduct( 2, 2, x1, 1, y1, 1, out, 2 );
9491
// out => <Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
9592
```
9693

@@ -100,7 +97,7 @@ dcartesianProduct( 2, 2, x1, 1, y1, 1, out, 2, 1 );
10097

10198
<!--lint enable maximum-heading-length-->
10299

103-
Computes the Cartesian product for a double-precision floating-point strided array using alternative indexing semantics.
100+
Computes the Cartesian product for two double-precision floating-point strided arrays using alternative indexing semantics.
104101

105102
```javascript
106103
var Float64Array = require( '@stdlib/array/float64' );
@@ -118,6 +115,8 @@ The function has the following additional parameters:
118115

119116
- **offsetX**: starting index for `x`.
120117
- **offsetY**: starting index for `y`.
118+
- **strideOut1**: stride length of the first dimension of `out`.
119+
- **strideOut2**: stride length of the second dimension of `out`.
121120
- **offsetOut**: starting index for `out`.
122121

123122
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:
@@ -142,7 +141,7 @@ dcartesianProduct.ndarray( 2, 2, x, 1, 2, y, 1, 2, out, 2, 1, 0 );
142141

143142
## Notes
144143

145-
- For an input array `x` of length `N`, the output array `out` must contain at least `M*N` pairs.
144+
- For an input array `x` of length `M` and an input array `y` of length `N`, the output array `out` must contain at least `M*N` pairs.
146145
- If `N <= 0` or `M <= 0`, both functions return `out` unchanged.
147146

148147
</section>
@@ -175,7 +174,7 @@ console.log( y );
175174
var out = new Float64Array( M * N * 2 );
176175

177176
// Compute the Cartesian product:
178-
dcartesianProduct( M, N, x, 1, y, 1, out, 2, 1 );
177+
dcartesianProduct( M, N, x, 1, y, 1, out, 2 );
179178
console.log( out );
180179
```
181180

@@ -209,20 +208,16 @@ console.log( out );
209208
#include "stdlib/blas/ext/base/dcartesianproduct.h"
210209
```
211210

212-
<!--lint disable maximum-heading-length-->
213-
214-
#### stdlib_strided_dcartesian_product( M, N, \*X, strideX, \*Y, strideY, \*Out, strideOut1, strideOut2 )
215-
216-
<!--lint enable maximum-heading-length-->
211+
#### stdlib_strided_dcartesian_product( M, N, \*X, strideX, \*Y, strideY, \*Out, LDO )
217212

218-
Computes the Cartesian product for a double-precision floating-point strided array.
213+
Computes the Cartesian product for two double-precision floating-point strided arrays.
219214

220215
```c
221216
const double x[] = { 1.0, 2.0 };
222217
const double y[] = { 3.0, 4.0 };
223218
double out[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
224219

225-
stdlib_strided_dcartesian_product( 2, 2, x, 1, y, 1, out, 2, 1 );
220+
stdlib_strided_dcartesian_product( 2, 2, x, 1, y, 1, out, 2 );
226221
```
227222
228223
The function accepts the following arguments:
@@ -234,11 +229,10 @@ The function accepts the following arguments:
234229
- **Y**: `[in] double*` input array.
235230
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
236231
- **Out**: `[out] double*` output array.
237-
- **strideOut1**: `[in] CBLAS_INT` stride length between consecutive output pairs.
238-
- **strideOut2**: `[in] CBLAS_INT` stride length between elements of each output pair.
232+
- **LDO**: `[in] CBLAS_INT` stride of the leading dimension of `Out`.
239233
240234
```c
241-
void stdlib_strided_dcartesian_product( const CBLAS_INT M, const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *Out, const CBLAS_INT strideOut1, const CBLAS_INT strideOut2 );
235+
void stdlib_strided_dcartesian_product( const CBLAS_INT M, const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY, double *Out, const CBLAS_INT LDO );
242236
```
243237

244238
<!--lint disable maximum-heading-length-->
@@ -247,7 +241,7 @@ void stdlib_strided_dcartesian_product( const CBLAS_INT M, const CBLAS_INT N, co
247241

248242
<!--lint enable maximum-heading-length-->
249243

250-
Computes the Cartesian product for a double-precision floating-point strided array using alternative indexing semantics.
244+
Computes the Cartesian product for two double-precision floating-point strided arrays using alternative indexing semantics.
251245

252246
```c
253247
const double x[] = { 1.0, 2.0 };
@@ -268,8 +262,8 @@ The function accepts the following arguments:
268262
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
269263
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
270264
- **Out**: `[out] double*` output array.
271-
- **strideOut1**: `[in] CBLAS_INT` stride length between consecutive output pairs.
272-
- **strideOut2**: `[in] CBLAS_INT` stride length between elements of each output pair.
265+
- **strideOut1**: `[in] CBLAS_INT` stride length of the first dimension of `Out`.
266+
- **strideOut2**: `[in] CBLAS_INT` stride length of the second dimension of `Out`.
273267
- **offsetOut**: `[in] CBLAS_INT` starting index for `Out`.
274268
275269
```c
@@ -313,11 +307,10 @@ int main( void ) {
313307
// Specify strides:
314308
const int strideX = 1;
315309
const int strideY = 1;
316-
const int strideOut1 = 2;
317-
const int strideOut2 = 1;
310+
const int LDO = 2;
318311

319312
// Compute the Cartesian product:
320-
stdlib_strided_dcartesian_product( M, N, X, strideX, Y, strideY, out, strideOut1, strideOut2 );
313+
stdlib_strided_dcartesian_product( M, N, X, strideX, Y, strideY, out, LDO );
321314

322315
// Print the result:
323316
for ( int i = 0; i < M*N; i++ ) {

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

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

6969
b.tic();
7070
for ( i = 0; i < b.iterations; i++ ) {
71-
z = dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2, 1 );
71+
z = dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2 );
7272
if ( isnan( z[ 0 ] ) ) {
7373
b.fail( 'should not return NaN' );
7474
}

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

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

7474
b.tic();
7575
for ( i = 0; i < b.iterations; i++ ) {
76-
z = dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2, 1 );
76+
z = dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2 );
7777
if ( isnan( z[ 0 ] ) ) {
7878
b.fail( 'should not return NaN' );
7979
}

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

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

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

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

2-
{{alias}}( M, N, x, strideX, y, strideY, out, strideOut1, strideOut2 )
2+
{{alias}}( M, N, x, strideX, y, strideY, out, LDO )
33
Computes the Cartesian product for two double-precision floating-point
44
strided arrays.
55

@@ -31,11 +31,8 @@
3131
out: Float64Array
3232
Output array.
3333

34-
strideOut1: integer
35-
Stride length between consecutive output pairs.
36-
37-
strideOut2: integer
38-
Stride length between elements of each output pair.
34+
LDO: integer
35+
Stride of the leading dimension of `out`.
3936

4037
Returns
4138
-------
@@ -48,18 +45,18 @@
4845
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0 ] );
4946
> var y = new {{alias:@stdlib/array/float64}}( [ 3.0, 4.0 ] );
5047
> var out = new {{alias:@stdlib/array/float64}}( 8 );
51-
> {{alias}}( x.length, y.length, x, 1, y, 1, out, 2, 1 )
48+
> {{alias}}( x.length, y.length, x, 1, y, 1, out, 2 )
5249
<Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
5350

5451
// Using `M`, `N`, and stride parameters:
5552
> x = new {{alias:@stdlib/array/float64}}( [ 1.0, 0.0, 2.0, 0.0 ] );
5653
> y = new {{alias:@stdlib/array/float64}}( [ 3.0, 4.0 ] );
5754
> out = new {{alias:@stdlib/array/float64}}( 8 );
58-
> {{alias}}( 2, y.length, x, 2, y, 1, out, 2, 1 )
55+
> {{alias}}( 2, y.length, x, 2, y, 1, out, 2 )
5956
<Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
6057

6158

62-
{{alias}}.ndarray(M,N,x,strideX,offsetX,y,strideY,offsetY,out,sO1,sO2,oO)
59+
{{alias}}.ndarray(M,N,x,strideX,offsetX,y,strideY,offsetY,out,so1,so2,oo)
6360
Computes the Cartesian product for two double-precision floating-point
6461
strided arrays using alternative indexing semantics.
6562

@@ -96,13 +93,13 @@
9693
out: Float64Array
9794
Output array.
9895

99-
sO1: integer
100-
Stride length between consecutive output pairs.
96+
so1: integer
97+
Stride length of the first dimension of `out`.
10198

102-
sO2: integer
103-
Stride length between elements of each output pair.
99+
so2: integer
100+
Stride length of the second dimension of `out`.
104101

105-
oO: integer
102+
oo: integer
106103
Starting index for `out`.
107104

108105
Returns

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ interface Routine {
3232
* @param y - second input array
3333
* @param strideY - stride length for `y`
3434
* @param out - output array
35-
* @param strideOut1 - stride length between consecutive output pairs
36-
* @param strideOut2 - stride length between elements of each output pair
35+
* @param LDO - stride of the leading dimension of `out`
3736
* @returns output array
3837
*
3938
* @example
@@ -43,10 +42,10 @@ interface Routine {
4342
* var y = new Float64Array( [ 3.0, 4.0 ] );
4443
* var out = new Float64Array( 8 );
4544
*
46-
* dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2, 1 );
45+
* dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2 );
4746
* // out => <Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
4847
*/
49-
( M: number, N: number, x: Float64Array, strideX: number, y: Float64Array, strideY: number, out: Float64Array, strideOut1: number, strideOut2: number ): Float64Array;
48+
( M: number, N: number, x: Float64Array, strideX: number, y: Float64Array, strideY: number, out: Float64Array, LDO: number ): Float64Array;
5049

5150
/**
5251
* Computes the Cartesian product for two double-precision floating-point strided arrays using alternative indexing semantics.
@@ -60,8 +59,8 @@ interface Routine {
6059
* @param strideY - stride length for `y`
6160
* @param offsetY - starting index for `y`
6261
* @param out - output array
63-
* @param strideOut1 - stride length between consecutive output pairs
64-
* @param strideOut2 - stride length between elements of each output pair
62+
* @param strideOut1 - stride length of the first dimension of `out`
63+
* @param strideOut2 - stride length of the second dimension of `out`
6564
* @param offsetOut - starting index for `out`
6665
* @returns output array
6766
*
@@ -88,8 +87,7 @@ interface Routine {
8887
* @param y - second input array
8988
* @param strideY - stride length for `y`
9089
* @param out - output array
91-
* @param strideOut1 - stride length between consecutive output pairs
92-
* @param strideOut2 - stride length between elements of each output pair
90+
* @param LDO - stride of the leading dimension of `out`
9391
* @returns output array
9492
*
9593
* @example
@@ -99,7 +97,7 @@ interface Routine {
9997
* var y = new Float64Array( [ 3.0, 4.0 ] );
10098
* var out = new Float64Array( 8 );
10199
*
102-
* dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2, 1 );
100+
* dcartesianProduct( x.length, y.length, x, 1, y, 1, out, 2 );
103101
* // out => <Float64Array>[ 1.0, 3.0, 1.0, 4.0, 2.0, 3.0, 2.0, 4.0 ]
104102
*
105103
* @example

0 commit comments

Comments
 (0)