Skip to content

Commit 6130af2

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: na - 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 5c721ab commit 6130af2

14 files changed

Lines changed: 196 additions & 112 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ Computes the Cartesian square for a double-precision floating-point strided arra
3737
```javascript
3838
var Float64Array = require( '@stdlib/array/float64' );
3939

40-
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
41-
var out = new Float64Array( 18 );
40+
var x = new Float64Array( [ 1.0, 2.0 ] );
41+
var out = new Float64Array( 8 );
4242

4343
dcartesianSquare( x.length, x, 1, out, 2, 1 );
44-
// 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 ]
44+
// out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4545
```
4646

4747
The function has the following parameters:
@@ -91,11 +91,11 @@ Computes the Cartesian square for a double-precision floating-point strided arra
9191
```javascript
9292
var Float64Array = require( '@stdlib/array/float64' );
9393

94-
var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
95-
var out = new Float64Array( 18 );
94+
var x = new Float64Array( [ 1.0, 2.0 ] );
95+
var out = new Float64Array( 8 );
9696

9797
dcartesianSquare.ndarray( x.length, x, 1, 0, out, 2, 1, 0 );
98-
// 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 ]
98+
// out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
9999
```
100100

101101
The function has the following additional parameters:

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ interface Routine {
3636
* @example
3737
* var Float64Array = require( `@stdlib/array/float64` );
3838
*
39-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
40-
* var out = new Float64Array( 18 );
39+
* var x = new Float64Array( [ 1.0, 2.0 ] );
40+
* var out = new Float64Array( 8 );
4141
*
4242
* dcartesianSquare( x.length, x, 1, out, 2, 1 );
43-
* // 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 ]
43+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4444
*/
4545
( N: number, x: Float64Array, strideX: number, out: Float64Array, strideOut1: number, strideOut2: number ): Float64Array;
4646

@@ -60,11 +60,11 @@ interface Routine {
6060
* @example
6161
* var Float64Array = require( `@stdlib/array/float64` );
6262
*
63-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
64-
* var out = new Float64Array( 18 );
63+
* var x = new Float64Array( [ 1.0, 2.0 ] );
64+
* var out = new Float64Array( 8 );
6565
*
6666
* dcartesianSquare.ndarray( x.length, x, 1, 0, out, 2, 1, 0 );
67-
* // 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 ]
67+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
6868
*/
6969
ndarray( N: number, x: Float64Array, strideX: number, offsetX: number, out: Float64Array, strideOut1: number, strideOut2: number, offsetOut: number ): Float64Array;
7070
}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ var ndarray = require( './ndarray.js' );
4040
* @example
4141
* var Float64Array = require( '@stdlib/array/float64' );
4242
*
43-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
44-
* var out = new Float64Array( 18 );
43+
* var x = new Float64Array( [ 1.0, 2.0 ] );
44+
* var out = new Float64Array( 8 );
4545
*
46-
* dcartesianSquare( 3, x, 1, out, 2, 1 );
47-
* // 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 ]
46+
* dcartesianSquare( x.length, x, 1, out, 2, 1 );
47+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4848
*/
4949
function dcartesianSquare( N, x, strideX, out, strideOut1, strideOut2 ) {
50-
return ndarray( N, x, strideX, stride2offset( N, strideX ), out, strideOut1, strideOut2, stride2offset( N * N, strideOut1 ) + stride2offset( 2, strideOut2 ) ); // eslint-disable-line max-len
50+
var ox = stride2offset( N, strideX );
51+
var oo = stride2offset( N * N, strideOut1 ) + stride2offset( 2, strideOut2 ); // eslint-disable-line max-len
52+
return ndarray( N, x, strideX, ox, out, strideOut1, strideOut2, oo );
5153
}
5254

5355

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ var addon = require( './../src/addon.node' );
3939
* @example
4040
* var Float64Array = require( '@stdlib/array/float64' );
4141
*
42-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
43-
* var out = new Float64Array( 18 );
42+
* var x = new Float64Array( [ 1.0, 2.0 ] );
43+
* var out = new Float64Array( 8 );
4444
*
45-
* dcartesianSquare( 3, x, 1, out, 2, 1 );
46-
* // 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 ]
45+
* dcartesianSquare( x.length, x, 1, out, 2, 1 );
46+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4747
*/
4848
function dcartesianSquare( N, x, strideX, out, strideOut1, strideOut2 ) {
4949
addon( N, x, strideX, out, strideOut1, strideOut2 );

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@
2727
* var Float64Array = require( '@stdlib/array/float64' );
2828
* var dcartesianSquare = require( '@stdlib/blas/ext/base/dcartesian-square' );
2929
*
30-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
31-
* var out = new Float64Array( 18 );
30+
* var x = new Float64Array( [ 1.0, 2.0 ] );
31+
* var out = new Float64Array( 8 );
3232
*
3333
* dcartesianSquare( x.length, x, 1, out, 2, 1 );
34-
* // 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 ]
34+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
3535
*
3636
* @example
3737
* var Float64Array = require( '@stdlib/array/float64' );
3838
* var dcartesianSquare = require( '@stdlib/blas/ext/base/dcartesian-square' );
3939
*
40-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
41-
* var out = new Float64Array( 18 );
40+
* var x = new Float64Array( [ 1.0, 2.0 ] );
41+
* var out = new Float64Array( 8 );
4242
*
4343
* dcartesianSquare.ndarray( x.length, x, 1, 0, out, 2, 1, 0 );
44-
* // 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 ]
44+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4545
*/
4646

4747
// MODULES //

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MAIN //
2222

2323
/**
24-
* Computes the Cartesian square for a double-precision floating-point strided array using alternative indexing semantics.
24+
* Computes the Cartesian square for a double-precision floating-point strided array using alternative indeixng semantics.
2525
*
2626
* @param {NonNegativeInteger} N - number of indexed elements
2727
* @param {Float64Array} x - input array
@@ -36,15 +36,15 @@
3636
* @example
3737
* var Float64Array = require( '@stdlib/array/float64' );
3838
*
39-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
40-
* var out = new Float64Array( 18 );
39+
* var x = new Float64Array( [ 1.0, 2.0 ] );
40+
* var out = new Float64Array( 8 );
4141
*
42-
* dcartesianSquare( 3, x, 1, 0, out, 2, 1, 0 );
43-
* // 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 ]
42+
* dcartesianSquare( x.length, x, 1, 0, out, 2, 1, 0 );
43+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4444
*/
4545
function dcartesianSquare( N, x, strideX, offsetX, out, strideOut1, strideOut2, offsetOut ) { // eslint-disable-line max-len
46-
var xi;
47-
var xj;
46+
var ix;
47+
var jx;
4848
var io;
4949
var v;
5050
var i;
@@ -53,18 +53,18 @@ function dcartesianSquare( N, x, strideX, offsetX, out, strideOut1, strideOut2,
5353
if ( N <= 0 ) {
5454
return out;
5555
}
56-
xi = offsetX;
56+
ix = offsetX;
5757
io = offsetOut;
5858
for ( i = 0; i < N; i++ ) {
59-
v = x[ xi ];
60-
xj = offsetX;
59+
v = x[ ix ];
60+
jx = offsetX;
6161
for ( j = 0; j < N; j++ ) {
6262
out[ io ] = v;
63-
out[ io + strideOut2 ] = x[ xj ];
63+
out[ io + strideOut2 ] = x[ jx ];
6464
io += strideOut1;
65-
xj += strideX;
65+
jx += strideX;
6666
}
67-
xi += strideX;
67+
ix += strideX;
6868
}
6969
return out;
7070
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ var addon = require( './../src/addon.node' );
4141
* @example
4242
* var Float64Array = require( '@stdlib/array/float64' );
4343
*
44-
* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] );
45-
* var out = new Float64Array( 18 );
44+
* var x = new Float64Array( [ 1.0, 2.0 ] );
45+
* var out = new Float64Array( 8 );
4646
*
47-
* dcartesianSquare( 3, x, 1, 0, out, 2, 1, 0 );
48-
* // 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 ]
47+
* dcartesianSquare( x.length, x, 1, 0, out, 2, 1, 0 );
48+
* // out => <Float64Array>[ 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 2.0, 2.0 ]
4949
*/
5050
function dcartesianSquare( N, x, strideX, offsetX, out, strideOut1, strideOut2, offsetOut ) { // eslint-disable-line max-len
5151
addon.ndarray( N, x, strideX, offsetX, out, strideOut1, strideOut2, offsetOut ); // eslint-disable-line max-len

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
"@stdlib/strided/base/stride2offset",
4141
"@stdlib/napi/export",
4242
"@stdlib/napi/argv",
43-
"@stdlib/napi/argv-float64array",
4443
"@stdlib/napi/argv-int64",
45-
"@stdlib/napi/argv-strided-float64array"
44+
"@stdlib/napi/argv-strided-float64array",
45+
"@stdlib/napi/argv-strided-float64array2d"
4646
]
4747
},
4848
{

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/src/addon.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#include "stdlib/napi/export.h"
2222
#include "stdlib/napi/argv.h"
2323
#include "stdlib/napi/argv_int64.h"
24-
#include "stdlib/napi/argv_float64array.h"
2524
#include "stdlib/napi/argv_strided_float64array.h"
25+
#include "stdlib/napi/argv_strided_float64array2d.h"
2626
#include <node_api.h>
2727

2828
/**
@@ -39,8 +39,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
3939
STDLIB_NAPI_ARGV_INT64( env, strideOut1, argv, 4 );
4040
STDLIB_NAPI_ARGV_INT64( env, strideOut2, argv, 5 );
4141
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
42-
STDLIB_NAPI_ARGV_FLOAT64ARRAY( env, Out, out_len, argv, 3 );
43-
(void)out_len;
42+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, Out, N*N, 2, strideOut1, strideOut2, argv, 3 );
4443
API_SUFFIX(stdlib_strided_dcartesian_square)( N, X, strideX, Out, strideOut1, strideOut2 );
4544
return NULL;
4645
}
@@ -61,8 +60,7 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
6160
STDLIB_NAPI_ARGV_INT64( env, strideOut2, argv, 6 );
6261
STDLIB_NAPI_ARGV_INT64( env, offsetOut, argv, 7 );
6362
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
64-
STDLIB_NAPI_ARGV_FLOAT64ARRAY( env, Out, out_len, argv, 4 );
65-
(void)out_len;
63+
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, Out, N*N, 2, strideOut1, strideOut2, argv, 4 );
6664
API_SUFFIX(stdlib_strided_dcartesian_square_ndarray)( N, X, strideX, offsetX, Out, strideOut1, strideOut2, offsetOut );
6765
return NULL;
6866
}

lib/node_modules/@stdlib/blas/ext/base/dcartesian-square/src/main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void API_SUFFIX(stdlib_strided_dcartesian_square)( const CBLAS_INT N, const doub
3737
}
3838

3939
/**
40-
* Computes the Cartesian square for a double-precision floating-point strided array using alternative indexing semantics.
40+
* Computes the Cartesian square for a double-precision floating-point strided array using alternative indeixng semantics.
4141
*
4242
* @param N number of indexed elements
4343
* @param X input array
@@ -49,8 +49,8 @@ void API_SUFFIX(stdlib_strided_dcartesian_square)( const CBLAS_INT N, const doub
4949
* @param offsetOut starting index
5050
*/
5151
void API_SUFFIX(stdlib_strided_dcartesian_square_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *Out, const CBLAS_INT strideOut1, const CBLAS_INT strideOut2, const CBLAS_INT offsetOut ) {
52-
CBLAS_INT xi;
53-
CBLAS_INT xj;
52+
CBLAS_INT ix;
53+
CBLAS_INT jx;
5454
CBLAS_INT io;
5555
CBLAS_INT i;
5656
CBLAS_INT j;
@@ -59,17 +59,17 @@ void API_SUFFIX(stdlib_strided_dcartesian_square_ndarray)( const CBLAS_INT N, co
5959
if ( N <= 0 ) {
6060
return;
6161
}
62-
xi = offsetX;
62+
ix = offsetX;
6363
io = offsetOut;
6464
for ( i = 0; i < N; i++ ) {
65-
v = X[ xi ];
66-
xj = offsetX;
65+
v = X[ ix ];
66+
jx = offsetX;
6767
for ( j = 0; j < N; j++ ) {
6868
Out[ io ] = v;
69-
Out[ io + strideOut2 ] = X[ xj ];
69+
Out[ io + strideOut2 ] = X[ jx ];
7070
io += strideOut1;
71-
xj += strideX;
71+
jx += strideX;
7272
}
73-
xi += strideX;
73+
ix += strideX;
7474
}
7575
}

0 commit comments

Comments
 (0)