From 0c4f9aeecde044444a98bcdb4dd9612a78980b93 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Mon, 13 Oct 2025 23:56:19 +0500 Subject: [PATCH 01/26] feat: add blas/ext/base/dcopy-within --- 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: passed - 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 --- --- .../blas/ext/base/dcopy-within/README.md | 302 ++++++++++++++++++ .../base/dcopy-within/benchmark/benchmark.js | 102 ++++++ .../benchmark/benchmark.native.js | 107 +++++++ .../benchmark/benchmark.ndarray.js | 102 ++++++ .../benchmark/benchmark.ndarray.native.js | 107 +++++++ .../base/dcopy-within/benchmark/c/Makefile | 146 +++++++++ .../benchmark/c/benchmark.length.c | 198 ++++++++++++ .../blas/ext/base/dcopy-within/binding.gyp | 170 ++++++++++ .../blas/ext/base/dcopy-within/docs/repl.txt | 110 +++++++ .../base/dcopy-within/docs/types/index.d.ts | 101 ++++++ .../ext/base/dcopy-within/docs/types/test.ts | 159 +++++++++ .../ext/base/dcopy-within/examples/c/Makefile | 146 +++++++++ .../base/dcopy-within/examples/c/example.c | 39 +++ .../ext/base/dcopy-within/examples/index.js | 35 ++ .../blas/ext/base/dcopy-within/include.gypi | 53 +++ .../stdlib/blas/ext/base/dcopy_within.h | 46 +++ .../ext/base/dcopy-within/lib/dcopy_within.js | 58 ++++ .../dcopy-within/lib/dcopy_within.native.js | 56 ++++ .../blas/ext/base/dcopy-within/lib/index.js | 68 ++++ .../blas/ext/base/dcopy-within/lib/main.js | 35 ++ .../blas/ext/base/dcopy-within/lib/native.js | 35 ++ .../blas/ext/base/dcopy-within/lib/ndarray.js | 95 ++++++ .../base/dcopy-within/lib/ndarray.native.js | 57 ++++ .../blas/ext/base/dcopy-within/manifest.json | 102 ++++++ .../blas/ext/base/dcopy-within/package.json | 74 +++++ .../blas/ext/base/dcopy-within/src/Makefile | 70 ++++ .../blas/ext/base/dcopy-within/src/addon.c | 66 ++++ .../blas/ext/base/dcopy-within/src/main.c | 103 ++++++ .../dcopy-within/test/test.dcopy_within.js | 139 ++++++++ .../test/test.dcopy_within.native.js | 151 +++++++++ .../blas/ext/base/dcopy-within/test/test.js | 82 +++++ .../base/dcopy-within/test/test.ndarray.js | 154 +++++++++ .../dcopy-within/test/test.ndarray.native.js | 165 ++++++++++ 33 files changed, 3433 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md new file mode 100644 index 000000000000..501f2b8b8afa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -0,0 +1,302 @@ + + +# dcopy-within + +> Perform an in-place copy of elements within a double-precision floating-point array. + +
+ +## Usage + +```javascript +var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); +``` + +#### dcopyWithin( N, target, x, strideX, start, end ) + +Performs an in-place copy of elements within a double-precision floating-point array. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +dcopyWithin( 3, 2, x, 1, 1, 2 ); +// x => [ 1.0, 2.0, 2.0, 4.0, 5.0, 6.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **target**: target index. +- **x**: input [`Float64Array`][@stdlib/array/float64]. +- **strideX**: stride length. +- **start**: source start index. +- **end**: source end index. + +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to copy every other element: + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + +dcopyWithin( 3, 0, x, 2, 1, 6 ); +// x => [ 3.0, 2.0, 5.0, 4.0, 7.0, 6.0, 7.0, 8.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial array... +var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +// Create an offset view... +var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +// Copy within the view... +dcopyWithin( 2, 0, x1, 1, 2, 5 ); +// x0 => [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] +``` + +#### dcopyWithin.ndarray( N, target, x, strideX, offsetX, start, end ) + +Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +dcopyWithin.ndarray( 2, 2, x, 1, 1, 0, 5 ); +// x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to copy elements starting from the second element: + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +dcopyWithin.ndarray( 2, 2, x, 1, 2, 0, 2 ); +// x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0 ] +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, both functions return the strided array unchanged. +- Both functions **mutate** the provided input strided array. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); + +var x = discreteUniform( 10, 0, 500, { + 'dtype': 'float64' +}); +console.log( x ); + +// Copy the first 3 elements to positions 5, 6, 7: +dcopyWithin( 3, 5, x, 1, 0, 3 ); +console.log( x ); + +// Copy every other element starting from the second element: +dcopyWithin( 5, 0, x, 1, 1, 9 ); +console.log( x ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/dcopy_within.h" +``` + +#### stdlib_strided_dcopy_within( N, target, \*x, strideX, start, end ) + +Performs an in-place copy of elements within a double-precision floating-point array. + +```c +const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; + +stdlib_strided_dcopy_within( 3, 3, x, 1, 1, 4 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **target**: `[in] CBLAS_INT` target index. +- **x**: `[inout] double*` input array. +- **strideX**: `[in] CBLAS_INT` stride length. +- **start**: `[in] CBLAS_INT` source start index. +- **end**: `[in] CBLAS_INT` source end index. + +```c +void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT start, const CBLAS_INT end ); +``` + + + +### stdlib_strided_dcopy_within_ndarray( N, target, \*x, strideX, offsetX, start, end ) + + + +Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; + +stdlib_strided_dcopy_within_ndarray( 2, 2, x, 1, 1, 0, 2 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **target**: `[in] CBLAS_INT` target index. +- **x**: `[inout] double*` input array. +- **strideX**: `[in] CBLAS_INT` stride length. +- **offsetX**: `[in] CBLAS_INT` starting index. +- **start**: `[in] CBLAS_INT` source start index. +- **end**: `[in] CBLAS_INT` source end index. + +```c +void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT start, const CBLAS_INT end ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/dcopy_within.h" +#include + +int main( void ) { + // Create a strided array: + double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + + // Specify the number of elements to copy: + const int N = 3; + + // Specify a stride: + const int strideX = 1; + + // Copy elements starting from index 1 to index 4: + stdlib_strided_dcopy_within( N, 4, x, strideX, 1, 4 ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js new file mode 100644 index 000000000000..ef85a070adce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var dcopyWithin = require( './../lib/dcopy_within.js' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = dcopyWithin( len, 0, x, 1, 0, len-1 ); + if ( isnan( y[ i%y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( x[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js new file mode 100644 index 000000000000..d03e014f45fd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dcopyWithin = tryRequire( resolve( __dirname, './../lib/dcopy_within.native.js' ) ); +var opts = { + 'skip': ( dcopyWithin instanceof Error ) +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = dcopyWithin( len, 0, x, 1, 0, len-1 ); + if ( isnan( y[ i%y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( x[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+'::native:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..b87a2c6452dc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var dcopyWithin = require( './../lib/ndarray.js' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = dcopyWithin( len, 0, x, 1, 0, 0, len-1 ); + if ( isnan( y[ i%y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( x[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js new file mode 100644 index 000000000000..3ab56ded3fcc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dcopyWithin = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dcopyWithin instanceof Error ) +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( len, -10.0, 10.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = dcopyWithin( len, 0, x, 1, 0, 0, len-1 ); + if ( isnan( y[ i%y.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( x[ i%x.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+'::native:ndarray:len='+len, opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile new file mode 100644 index 000000000000..cce2c865d7ad --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.length.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..1df29194406d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -0,0 +1,198 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/dcopy_within.h" +#include "stdlib/blas/base/shared.h" +#include +#include +#include +#include +#include + +#define NAME "dcopy_within" +#define ITERATIONS 10000000 +#define REPEATS 3 +#define MIN 1 +#define MAX 6 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmark results. +* +* @param prefix comment prefix +* @param elapsed elapsed time in seconds +*/ +static void print_results( const char* prefix, double elapsed ) { + double rate = (double)ITERATIONS / elapsed; + printf( "# %s\n", prefix ); + printf( " ---\n" ); + printf( " iterations: %d\n", ITERATIONS ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random double on the interval [-100,100). +* +* @return random double +*/ +static double rand_double( void ) { + int r = rand(); + return -100.0 + (r/(double)RAND_MAX)*200.0; +} + +/** +* Run a benchmark which tests `stdlib_strided_dcopy_within`. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark1( int iterations, int len ) { + double elapsed; + double x[ len ]; + double t; + int i; + + for ( i = 0; i < len; i++ ) { + x[ i ] = ( rand_double()*200.0 ) - 100.0; + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, x, 1, 0, len-1 ); + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Run a benchmark which tests `stdlib_strided_dcopy_within_ndarray`. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark2( int iterations, int len ) { + double elapsed; + double x[ len ]; + double t; + int i; + + for ( i = 0; i < len; i++ ) { + x[ i ] = ( rand_double()*200.0 ) - 100.0; + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, x, 1, 0, 0, len-1 ); + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int count; + int iter; + int len; + int i; + int j; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + count = 0; + + // Run benchmarks: + for ( i = MIN; i <= MAX; i++ ) { + len = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + if ( iter < 1 ) { + iter = 1; + } + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:len=%d\n", NAME, len ); + elapsed = benchmark1( iter, len ); + print_results( "dcopy_within:len", elapsed ); + printf( "ok %d benchmark finished\n", count ); + + count += 1; + printf( "# c::%s:ndarray:len=%d\n", NAME, len ); + elapsed = benchmark2( iter, len ); + print_results( "dcopy_within_ndarray:len", elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + print_summary( count, count ); + + return 0; +} + diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp new file mode 100644 index 000000000000..68a1ca11d160 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp @@ -0,0 +1,170 @@ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt new file mode 100644 index 000000000000..8d80ab800c68 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -0,0 +1,110 @@ + +{{alias}}( N, target, x, strideX, start, end ) + Performs an in-place copy of elements within a double-precision + floating-point strided array. + + The `N` and stride parameters determine which elements in the strided array + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + If `N <= 0`, the function returns the strided array unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + target: integer + Target index. + + x: Float64Array + Input array. + + strideX: integer + Stride length. + + start: integer + Source start index. + + end: integer + Source end index. + + Returns + ------- + x: Float64Array + Input array. + + Examples + -------- + // Standard Usage: + > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > {{alias}}( 3, 2, x, 1, 1, 2 ) + [ 1.0, 2.0, 2.0, 4.0, 5.0, 6.0 ] + + // Using `N` and stride parameters: + > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > {{alias}}( 3, 0, x, 2, 1, 6 ) + [ 3.0, 2.0, 5.0, 4.0, 7.0, 6.0, 7.0, 8.0 ] + + // Using view offsets: + > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > {{alias}}( 2, 0, x1, 1, 2, 5 ) + [ 4.0, 5.0, 4.0, 5.0, 6.0 ] + > x0 + [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] + + +{{alias}}.ndarray( N, target, x, strideX, offsetX, start, end ) + Performs an in-place copy of elements within a double-precision + floating-point strided array using alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameter supports indexing semantics based on a + starting index. + + Parameters + ---------- + N: integer + Number of indexed elements. + + target: integer + Target index. + + x: Float64Array + Input array. + + strideX: integer + Stride length. + + offsetX: integer + Starting index. + + start: integer + Source start index. + + end: integer + Source end index. + + Returns + ------- + x: Float64Array + Input array. + + Examples + -------- + // Standard Usage: + > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > {{alias}}.ndarray( 2, 2, x, 1, 1, 0, 5 ) + [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] + + // Using an index offset: + > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > {{alias}}.ndarray( 2, 3, x, 1, 2, 0, 5 ) + [ 1.0, 2.0, 3.0, 4.0, 5.0, 3.0 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts new file mode 100644 index 000000000000..ec14982fdb74 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -0,0 +1,101 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Interface describing `dcopyWithin`. +*/ +interface Routine { + /** + * Performs an in-place copy of elements within a double-precision floating-point array. + * + * @param N - number of indexed elements to copy + * @param target - target index + * @param x - input array + * @param strideX - stride length + * @param start - source start index + * @param end - source end index + * @returns input array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * dcopyWithin( 2, 2, x, 1, 1, 3 ); + * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] + */ + ( N: number, target: number, x: Float64Array, strideX: number, start: number, end: number ): Float64Array; + + /** + * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. + * + * @param N - number of indexed elements to copy + * @param target - target index + * @param x - input array + * @param strideX - stride length + * @param offsetX - starting index + * @param start - source start index + * @param end - source end index + * @returns input array + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * + * dcopyWithin.ndarray( 2, 2, x, 1, 0, 1, 3 ); + * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] + */ + ndarray( N: number, target: number, x: Float64Array, strideX: number, offsetX: number, start: number, end: number ): Float64Array; +} + +/** +* Performs an in-place copy of elements within a double-precision floating-point array. +* +* @param N - number of indexed elements to copy +* @param target - target index +* @param x - input array +* @param strideX - stride length +* @param start - source start index +* @param end - source end index +* @returns input array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin.ndarray( 2, 2, x, 1, 0, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +*/ +declare var dcopyWithin: Routine; + + +// EXPORTS // + +export = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts new file mode 100644 index 000000000000..87097baa76d3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts @@ -0,0 +1,159 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dcopyWithin = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( 3, 3, x, 1, 1, 2 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( '3', 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( true, 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( false, 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( null, 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( undefined, 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( [], 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( {}, 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( ( x: number ): number => x, 3, x, 1, 1, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( 3, '3', x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, true, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, false, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, null, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, undefined, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, [], x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, {}, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, ( x: number ): number => x, x, 1, 1, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + dcopyWithin( 3, 3, '3', 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, 3, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, true, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, false, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, null, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, undefined, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, [], 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, {}, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, ( x: number ): number => x, 1, 1, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( 3, 3, x, '1', 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, true, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, false, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, null, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, undefined, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, [], 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, {}, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, ( x: number ): number => x, 1, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( 3, 3, x, 1, '1', 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, true, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, false, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, null, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, undefined, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, [], 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, {}, 2 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, ( x: number ): number => x, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( 3, 3, x, 1, 1, '4' ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, true ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, false ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, null ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, [] ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, {} ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin(); // $ExpectError + dcopyWithin( 3 ); // $ExpectError + dcopyWithin( 3, 3 ); // $ExpectError + dcopyWithin( 3, 3, x ); // $ExpectError + dcopyWithin( 3, 3, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1 ); // $ExpectError + dcopyWithin( 3, 3, x, 1, 1, 2, {} ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( 3, 3, x, 1, 1, 1, 2 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( '2', 3, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( true, 3, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( false, 3, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( null, 3, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( undefined, 3, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( [], 2, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( {}, 2, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( ( x: number ): number => x, 2, x, 1, 1, 1, 2 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided insufficient arguments... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray(); // $ExpectError + dcopyWithin.ndarray( 2 ); // $ExpectError + dcopyWithin.ndarray( 2, 2 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, x ); // $ExpectError + dcopyWithin.ndarray( 2, 2, x, 1 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, x, 1, 1 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, x, 1, 1, 1 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, x, 1, 1, 1, 2, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile new file mode 100644 index 000000000000..ff5293d3059f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2020 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c new file mode 100644 index 000000000000..0988f49653fd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/dcopy_within.h" +#include + +int main( void ) { + // Create a strided array: + double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + + // Specify the number of elements to copy: + const int N = 3; + + // Specify a stride: + const int strideX = 1; + + // Copy elements starting from index 1 to index 4: + stdlib_strided_dcopy_within( N, 4, x, strideX, 1, 4 ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js new file mode 100644 index 000000000000..b6b3e5b2e69d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var dcopyWithin = require( './../lib' ); + +var x = discreteUniform( 10, 0, 500, { + 'dtype': 'float64' +}); +console.log( x ); + +// Copy the first 3 elements to positions 5, 6, 7: +dcopyWithin( 3, 5, x, 1, 0, 3 ); +console.log( x ); + +// Copy every other element starting from the second element: +dcopyWithin( 5, 0, x, 1, 1, 9 ); +console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi new file mode 100644 index 000000000000..ecfaf82a3279 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + ' [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +*/ +function dcopyWithin( N, target, x, strideX, start, end ) { + if ( N <= 0 ) { + return x; + } + return ndarray( N, target, x, strideX, stride2offset( N, strideX ), start, end ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js new file mode 100644 index 000000000000..9649571b6f0e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Performs an in-place copy of elements within a double-precision floating-point array. +* +* @private +* @param {PositiveInteger} N - number of indexed elements +* @param {integer} target - target index +* @param {Float64Array} x - input array +* @param {integer} strideX - stride length +* @param {integer} start - source start index +* @param {integer} end - source end index +* @returns {Float64Array} input array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +*/ +function dcopyWithin( N, target, x, strideX, start, end ) { + addon( N, target, x, strideX, start, end ); + return x; +} + + +// EXPORTS // + +module.exports = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js new file mode 100644 index 000000000000..dec0f111e234 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Perform an in-place copy of elements within a double-precision floating-point array. +* +* @module @stdlib/blas/ext/base/dcopy-within +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin.ndarray( 2, 2, x, 1, 0, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dcopyWithin; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dcopyWithin = main; +} else { + dcopyWithin = tmp; +} + + +// EXPORTS // + +module.exports = dcopyWithin; + +// exports: { "ndarray": "dcopyWithin.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js new file mode 100644 index 000000000000..4207d1135fd0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dcopyWithin = require( './dcopy_within.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dcopyWithin, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js new file mode 100644 index 000000000000..f6ea7782df7d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dcopyWithin = require( './dcopy_within.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( dcopyWithin, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js new file mode 100644 index 000000000000..cfd163b429f9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -0,0 +1,95 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var min = require( '@stdlib/math/base/special/min' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var Float64Array = require( '@stdlib/array/float64' ); + + +// MAIN // + +/** +* Performs an in-place copy of elements within a double-precision floating-point array. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {integer} target - target index +* @param {Float64Array} x - input array +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index +* @param {integer} start - source start index +* @param {integer} end - source end index +* @returns {Float64Array} input array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin( 2, 2, x, 1, 0, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +*/ +function dcopyWithin( N, target, x, strideX, offsetX, start, end ) { + var targetIdx; + var tmp; + var cl; + var o; + var i; + + if ( N <= 0 ) { + return x; + } + + // Resolve copy length: + cl = min( abs( end - start ), N ); + + // Create a temporary copy of source elements: + tmp = new Float64Array( cl ); + if ( strideX > 0 ) { + o = offsetX + ( start * strideX ); + } else { + o = start; + } + // Copy source elements to temporary array: + for ( i = 0; i < cl; i++ ) { + tmp[ i ] = x[ o ]; + o += strideX; + } + + // Resolve the target index: + if ( strideX > 0 ) { + targetIdx = offsetX + ( target * strideX ); + } else { + targetIdx = target; + } + + // Allocate elements to target position: + for ( i = 0; i < cl; i++ ) { + x[ targetIdx ] = tmp[ i ]; + targetIdx += strideX; + } + return x; +} + + +// EXPORTS // + +module.exports = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js new file mode 100644 index 000000000000..c24c38f49f1d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Performs an in-place copy of elements within a double-precision floating-point array. +* +* @private +* @param {PositiveInteger} N - number of indexed elements +* @param {integer} target - target index +* @param {Float64Array} x - input array +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index +* @param {integer} start - source start index +* @param {integer} end - source end index +* @returns {Float64Array} input array +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* dcopyWithin( 2, 2, x, 1, 0, 1, 3 ); +* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +*/ +function dcopyWithin( N, target, x, strideX, offsetX, start, end ) { + addon.ndarray( N, target, x, strideX, offsetX, start, end ); + return x; +} + + +// EXPORTS // + +module.exports = dcopyWithin; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json new file mode 100644 index 000000000000..ae3425297fdd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json @@ -0,0 +1,102 @@ +{ + "options": { + "task": "build", + "wasm": false + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/math/base/special/abs", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-float64array" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "build", + "wasm": true, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/math/base/special/abs" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json new file mode 100644 index 000000000000..76ffc0003087 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/blas/ext/base/dcopy-within", + "version": "0.0.0", + "description": "Perform an in-place copy of elements within a double-precision floating-point array.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "browser": "./lib/main.js", + "gypfile": true, + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "include": "./include", + "lib": "./lib", + "src": "./src", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "extended", + "copy", + "copywithin", + "within", + "move", + "strided", + "array", + "ndarray", + "float64", + "double", + "float64array" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile new file mode 100644 index 000000000000..7733b6180cb4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c new file mode 100644 index 000000000000..ab89b7953339 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c @@ -0,0 +1,66 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/dcopy_within.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_strided_float64array.h" +#include + +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 6 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, target, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, start, argv, 4 ); + STDLIB_NAPI_ARGV_INT64( env, end, argv, 5 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 2 ); + API_SUFFIX(stdlib_strided_dcopy_within)( N, target, x, strideX, start, end ); + return NULL; +} + +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon_method( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 7 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, target, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 ); + STDLIB_NAPI_ARGV_INT64( env, start, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, end, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 2 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, x, strideX, offsetX, start, end ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c new file mode 100644 index 000000000000..b565bd90e167 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -0,0 +1,103 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/ext/base/dcopy_within.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" +#include "stdlib/math/base/special/abs.h" +#include + +/** +* Performs an in-place copy of elements within a double-precision floating-point array. +* +* @param N number of indexed elements +* @param target target index +* @param x input array +* @param strideX stride length +* @param start source start index +* @param end source end index +*/ +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT start, const CBLAS_INT end ) { + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, x, strideX, ox, start, end ); +} + +/** +* Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. +* +* @param N number of indexed elements +* @param target target index +* @param x input array +* @param strideX stride length +* @param offsetX starting index +* @param start source start index +* @param end source end index +*/ +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT start, const CBLAS_INT end ) { + CBLAS_INT targetIdx; + double *tmp; + CBLAS_INT cl; + CBLAS_INT o; + CBLAS_INT i; + + if ( N <= 0 ) { + return; + } + + // Resolve copy length: + if ( stdlib_base_abs( end - start ) < N ) { + cl = stdlib_base_abs( end - start ); + } else { + cl = N; + } + + // Allocate temporary array and extract source elements: + tmp = (double *)malloc( cl * sizeof(double) ); + if ( tmp == NULL ) { + return; + } + + // Calculate source offset based on stride direction: + if ( strideX > 0 ) { + o = offsetX + ( start * strideX ); + } else { + o = start; + } + + // Copy source elements to temporary array: + for ( i = 0; i < cl; i++ ) { + tmp[ i ] = x[ o ]; + o += strideX; + } + + // Resolve the target index: + if ( strideX > 0 ) { + targetIdx = offsetX + ( target * strideX ); + } else { + targetIdx = target; + } + + // Allocate elements to target position: + for ( i = 0; i < cl; i++ ) { + x[ targetIdx ] = tmp[ i ]; + targetIdx += strideX; + } + + // Clean up memory: + free( tmp ); +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js new file mode 100644 index 000000000000..da54090ed181 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -0,0 +1,139 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dcopyWithin = require( './../lib/dcopy_within.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dcopyWithin, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 6', function test( t ) { + t.strictEqual( dcopyWithin.length, 6, 'returns expected value' ); + t.end(); +}); + +tape( 'the function copies values within the provided double-precision floating-point strided array', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 3, 3, x, 1, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, x, 1, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); + + actual = dcopyWithin( 4, 5, x, 1, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 3, 2, x, 1, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing a stride parameter', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 2, 0, x, 2, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing negative strides', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 2, x, -1, 5, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 2, 3, x, -1, 5, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 0, 3, x, 1, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( -1, 3, x, 1, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js new file mode 100644 index 000000000000..1f42bb3f0652 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -0,0 +1,151 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var isBrowser = require( '@stdlib/assert/is-browser' ); +var isError = require( '@stdlib/assert/is-error' ); +var Float64Array = require( '@stdlib/array/float64' ); + + +// VARIABLES // + +var dcopyWithin = tryRequire( resolve( __dirname, './../lib/dcopy_within.native.js' ) ); +var opts = { + 'skip': ( isBrowser || isError( dcopyWithin ) ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dcopyWithin, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 6', opts, function test( t ) { + t.strictEqual( dcopyWithin.length, 6, 'returns expected value' ); + t.end(); +}); + +tape( 'the function handles overlapping copy regions', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 3, 2, x, 1, 0, 3 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function copies values within the provided double-precision floating-point strided array', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 3, 3, x, 1, 1, 4 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + + // Test case where target >= N (should return unchanged): + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, x, 1, 0, 3 ); + t.strictEqual( actual, x, 'returns input array when target >= N' ); + t.deepEqual( x, expected, 'returns expected value when target >= N' ); + + actual = dcopyWithin( 6, 10, x, 1, 0, 3 ); + t.strictEqual( actual, x, 'returns input array when target > N' ); + t.deepEqual( x, expected, 'returns expected value when target > N' ); + + t.end(); +}); + +tape( 'the function supports providing a stride parameter', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 2, 0, x, 2, 1, 4 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing negative strides', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 2, x, -1, 5, 3 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 2, 3, x, -1, 5, 0 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 0, 3, x, 1, 1, 4 ); + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( -1, 3, x, 1, 1, 4 ); + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js new file mode 100644 index 000000000000..7ad0d8c87111 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var isBrowser = require( '@stdlib/assert/is-browser' ); +var dcopyWithin = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': isBrowser +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dcopyWithin, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof dcopyWithin.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var dcopyWithin = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dcopyWithin, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', function test( t ) { + var dcopyWithin; + var main; + + main = require( './../lib/main.js' ); + + dcopyWithin = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dcopyWithin, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot resolve module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js new file mode 100644 index 000000000000..6b4dd6b5f636 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dcopyWithin = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dcopyWithin, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( dcopyWithin.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function copies values within the provided double-precision floating-point strided array', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 3, 3, x, 1, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, x, 1, 0, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); + + actual = dcopyWithin( 4, 5, x, 1, 0, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 3, 2, x, 1, 0, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing an offset parameter', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 2, 3, x, 1, 1, 0, 2 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a stride parameter', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 2, 0, x, 2, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing negative strides', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 2, x, -1, 0, 5, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 2, 3, x, -1, 0, 5, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 0, 3, x, 1, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( -1, 3, x, 1, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js new file mode 100644 index 000000000000..f5f902784a76 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -0,0 +1,165 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var isBrowser = require( '@stdlib/assert/is-browser' ); +var isError = require( '@stdlib/assert/is-error' ); +var Float64Array = require( '@stdlib/array/float64' ); + + +// VARIABLES // + +var dcopyWithin = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( isBrowser || isError( dcopyWithin ) ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dcopyWithin, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', opts, function test( t ) { + t.strictEqual( dcopyWithin.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function copies values within the provided double-precision floating-point strided array', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 3, 3, x, 1, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, x, 1, 0, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); + + actual = dcopyWithin( 4, 5, x, 1, 0, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 3, 2, x, 1, 0, 0, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing an offset parameter', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 2, 3, x, 1, 1, 0, 2 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a stride parameter', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 2, 0, x, 2, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns input array' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing negative strides', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 2, x, -1, 0, 5, 3 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 2, 3, x, -1, 0, 5, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 0, 3, x, 1, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( -1, 3, x, 1, 0, 1, 4 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + t.end(); +}); From 9724d8bae9bb6328410647243d5a0d72074344a4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Mon, 13 Oct 2025 19:07:49 +0000 Subject: [PATCH 02/26] chore: update copyright years --- .../@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile index ff5293d3059f..25ced822f96a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2020 The Stdlib Authors. +# Copyright (c) 2025 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From bfff2d62a30102074d916f5ec6efc1c0cc045308 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 19 Oct 2025 13:42:30 +0500 Subject: [PATCH 03/26] 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 --- --- .../blas/ext/base/dcopy-within/README.md | 44 +++++++++---------- .../base/dcopy-within/benchmark/benchmark.js | 2 +- .../benchmark/benchmark.native.js | 2 +- .../benchmark/benchmark.ndarray.js | 2 +- .../benchmark/benchmark.ndarray.native.js | 2 +- .../benchmark/c/benchmark.length.c | 4 +- .../blas/ext/base/dcopy-within/docs/repl.txt | 38 ++++++++-------- .../base/dcopy-within/docs/types/index.d.ts | 24 +++++----- .../ext/base/dcopy-within/docs/types/test.ts | 6 +-- .../base/dcopy-within/examples/c/example.c | 2 +- .../ext/base/dcopy-within/examples/index.js | 4 +- .../stdlib/blas/ext/base/dcopy_within.h | 4 +- .../ext/base/dcopy-within/lib/dcopy_within.js | 10 ++--- .../dcopy-within/lib/dcopy_within.native.js | 10 ++--- .../blas/ext/base/dcopy-within/lib/index.js | 4 +- .../blas/ext/base/dcopy-within/lib/ndarray.js | 8 ++-- .../base/dcopy-within/lib/ndarray.native.js | 10 ++--- .../blas/ext/base/dcopy-within/src/addon.c | 22 +++++----- .../blas/ext/base/dcopy-within/src/main.c | 14 +++--- .../dcopy-within/test/test.dcopy_within.js | 18 ++++---- .../test/test.dcopy_within.native.js | 18 ++++---- .../base/dcopy-within/test/test.ndarray.js | 20 ++++----- .../dcopy-within/test/test.ndarray.native.js | 20 ++++----- 23 files changed, 144 insertions(+), 144 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 501f2b8b8afa..078520c1a69e 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -30,7 +30,7 @@ limitations under the License. var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); ``` -#### dcopyWithin( N, target, x, strideX, start, end ) +#### dcopyWithin( N, target, start, end, x, strideX ) Performs an in-place copy of elements within a double-precision floating-point array. @@ -39,7 +39,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin( 3, 2, x, 1, 1, 2 ); +dcopyWithin( 3, 2, 1, 2, x, 1 ); // x => [ 1.0, 2.0, 2.0, 4.0, 5.0, 6.0 ] ``` @@ -47,10 +47,10 @@ The function has the following parameters: - **N**: number of indexed elements. - **target**: target index. -- **x**: input [`Float64Array`][@stdlib/array/float64]. -- **strideX**: stride length. - **start**: source start index. - **end**: source end index. +- **x**: input [`Float64Array`][@stdlib/array/float64]. +- **strideX**: stride length. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to copy every other element: @@ -59,7 +59,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -dcopyWithin( 3, 0, x, 2, 1, 6 ); +dcopyWithin( 3, 0, 1, 6, x, 2 ); // x => [ 3.0, 2.0, 5.0, 4.0, 7.0, 6.0, 7.0, 8.0 ] ``` @@ -75,11 +75,11 @@ var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element // Copy within the view... -dcopyWithin( 2, 0, x1, 1, 2, 5 ); +dcopyWithin( 2, 0, 2, 5, x1, 1 ); // x0 => [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] ``` -#### dcopyWithin.ndarray( N, target, x, strideX, offsetX, start, end ) +#### dcopyWithin.ndarray( N, target, start, end, x, strideX, offsetX ) Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. @@ -88,7 +88,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin.ndarray( 2, 2, x, 1, 1, 0, 5 ); +dcopyWithin.ndarray( 2, 2, 0, 5, x, 1, 1 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ``` @@ -103,7 +103,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin.ndarray( 2, 2, x, 1, 2, 0, 2 ); +dcopyWithin.ndarray( 2, 2, 0, 2, x, 1, 2 ); // x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0 ] ``` @@ -138,11 +138,11 @@ var x = discreteUniform( 10, 0, 500, { console.log( x ); // Copy the first 3 elements to positions 5, 6, 7: -dcopyWithin( 3, 5, x, 1, 0, 3 ); +dcopyWithin( 3, 5, 0, 3, x, 1 ); console.log( x ); // Copy every other element starting from the second element: -dcopyWithin( 5, 0, x, 1, 1, 9 ); +dcopyWithin( 5, 0, 1, 9, x, 1 ); console.log( x ); ``` @@ -176,32 +176,32 @@ console.log( x ); #include "stdlib/blas/ext/base/dcopy_within.h" ``` -#### stdlib_strided_dcopy_within( N, target, \*x, strideX, start, end ) +#### stdlib_strided_dcopy_within( N, target, start, end, \*x, strideX ) Performs an in-place copy of elements within a double-precision floating-point array. ```c const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; -stdlib_strided_dcopy_within( 3, 3, x, 1, 1, 4 ); +stdlib_strided_dcopy_within( 3, 3, 1, 4, x, 1 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **target**: `[in] CBLAS_INT` target index. -- **x**: `[inout] double*` input array. -- **strideX**: `[in] CBLAS_INT` stride length. - **start**: `[in] CBLAS_INT` source start index. - **end**: `[in] CBLAS_INT` source end index. +- **x**: `[inout] double*` input array. +- **strideX**: `[in] CBLAS_INT` stride length. ```c -void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT start, const CBLAS_INT end ); +void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX ); ``` -### stdlib_strided_dcopy_within_ndarray( N, target, \*x, strideX, offsetX, start, end ) +### stdlib_strided_dcopy_within_ndarray( N, target, start, end, \*x, strideX, offsetX ) @@ -210,21 +210,21 @@ Performs an in-place copy of elements within a double-precision floating-point a ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; -stdlib_strided_dcopy_within_ndarray( 2, 2, x, 1, 1, 0, 2 ); +stdlib_strided_dcopy_within_ndarray( 2, 2, 0, 2, x, 1, 1 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **target**: `[in] CBLAS_INT` target index. +- **start**: `[in] CBLAS_INT` source start index. +- **end**: `[in] CBLAS_INT` source end index. - **x**: `[inout] double*` input array. - **strideX**: `[in] CBLAS_INT` stride length. - **offsetX**: `[in] CBLAS_INT` starting index. -- **start**: `[in] CBLAS_INT` source start index. -- **end**: `[in] CBLAS_INT` source end index. ```c -void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT start, const CBLAS_INT end ); +void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ); ``` @@ -260,7 +260,7 @@ int main( void ) { const int strideX = 1; // Copy elements starting from index 1 to index 4: - stdlib_strided_dcopy_within( N, 4, x, strideX, 1, 4 ); + stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX ); // Print the result: for ( int i = 0; i < 8; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js index ef85a070adce..3bc2c56c035c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js @@ -60,7 +60,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, x, 1, 0, len-1 ); + y = dcopyWithin( len, 0, 0, len-1, x, 1 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js index d03e014f45fd..b1e46310b9e2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js @@ -65,7 +65,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, x, 1, 0, len-1 ); + y = dcopyWithin( len, 0, 0, len-1, x, 1 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js index b87a2c6452dc..64e015a22977 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js @@ -60,7 +60,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, x, 1, 0, 0, len-1 ); + y = dcopyWithin( len, 0, 0, len-1, x, 1, 0 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js index 3ab56ded3fcc..7fe3a55ffeed 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js @@ -65,7 +65,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, x, 1, 0, 0, len-1 ); + y = dcopyWithin( len, 0, 0, len-1, x, 1, 0 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index 1df29194406d..22c5e767d879 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -108,7 +108,7 @@ static double benchmark1( int iterations, int len ) { t = tic(); for ( i = 0; i < iterations; i++ ) { // cppcheck-suppress uninitvar - API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, x, 1, 0, len-1 ); + API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, 0, len-1, x, 1 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; @@ -140,7 +140,7 @@ static double benchmark2( int iterations, int len ) { t = tic(); for ( i = 0; i < iterations; i++ ) { // cppcheck-suppress uninitvar - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, x, 1, 0, 0, len-1 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, 0, len-1, x, 1, 0 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index 8d80ab800c68..5b504843febb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -1,5 +1,5 @@ -{{alias}}( N, target, x, strideX, start, end ) +{{alias}}( N, target, start, end, x, strideX ) Performs an in-place copy of elements within a double-precision floating-point strided array. @@ -19,18 +19,18 @@ target: integer Target index. - x: Float64Array - Input array. - - strideX: integer - Stride length. - start: integer Source start index. end: integer Source end index. + x: Float64Array + Input array. + + strideX: integer + Stride length. + Returns ------- x: Float64Array @@ -40,24 +40,24 @@ -------- // Standard Usage: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}( 3, 2, x, 1, 1, 2 ) + > {{alias}}( 3, 2, 1, 2, x, 1 ) [ 1.0, 2.0, 2.0, 4.0, 5.0, 6.0 ] // Using `N` and stride parameters: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - > {{alias}}( 3, 0, x, 2, 1, 6 ) + > {{alias}}( 3, 0, 1, 6, x, 2 ) [ 3.0, 2.0, 5.0, 4.0, 7.0, 6.0, 7.0, 8.0 ] // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > {{alias}}( 2, 0, x1, 1, 2, 5 ) + > {{alias}}( 2, 0, 2, 5, x1, 1 ) [ 4.0, 5.0, 4.0, 5.0, 6.0 ] > x0 [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] -{{alias}}.ndarray( N, target, x, strideX, offsetX, start, end ) +{{alias}}.ndarray( N, target, start, end, x, strideX, offsetX ) Performs an in-place copy of elements within a double-precision floating-point strided array using alternative indexing semantics. @@ -73,6 +73,12 @@ target: integer Target index. + start: integer + Source start index. + + end: integer + Source end index. + x: Float64Array Input array. @@ -82,12 +88,6 @@ offsetX: integer Starting index. - start: integer - Source start index. - - end: integer - Source end index. - Returns ------- x: Float64Array @@ -97,12 +97,12 @@ -------- // Standard Usage: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 2, 2, x, 1, 1, 0, 5 ) + > {{alias}}.ndarray( 2, 2, 0, 5, x, 1, 1 ) [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] // Using an index offset: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 2, 3, x, 1, 2, 0, 5 ) + > {{alias}}.ndarray( 2, 3, 0, 5, x, 1, 2 ) [ 1.0, 2.0, 3.0, 4.0, 5.0, 3.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts index ec14982fdb74..622876cbf649 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -27,10 +27,10 @@ interface Routine { * * @param N - number of indexed elements to copy * @param target - target index - * @param x - input array - * @param strideX - stride length * @param start - source start index * @param end - source end index + * @param x - input array + * @param strideX - stride length * @returns input array * * @example @@ -38,21 +38,21 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * - * dcopyWithin( 2, 2, x, 1, 1, 3 ); + * dcopyWithin( 2, 2, 1, 3, x, 1 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ - ( N: number, target: number, x: Float64Array, strideX: number, start: number, end: number ): Float64Array; + ( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number ): Float64Array; /** * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. * * @param N - number of indexed elements to copy * @param target - target index + * @param start - source start index + * @param end - source end index * @param x - input array * @param strideX - stride length * @param offsetX - starting index - * @param start - source start index - * @param end - source end index * @returns input array * * @example @@ -60,10 +60,10 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * - * dcopyWithin.ndarray( 2, 2, x, 1, 0, 1, 3 ); + * dcopyWithin.ndarray( 2, 2, 1, 3, x, 1, 0 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ - ndarray( N: number, target: number, x: Float64Array, strideX: number, offsetX: number, start: number, end: number ): Float64Array; + ndarray( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; } /** @@ -71,10 +71,10 @@ interface Routine { * * @param N - number of indexed elements to copy * @param target - target index -* @param x - input array -* @param strideX - stride length * @param start - source start index * @param end - source end index +* @param x - input array +* @param strideX - stride length * @returns input array * * @example @@ -82,7 +82,7 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* dcopyWithin( 2, 2, 1, 3, x, 1 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] * * @example @@ -90,7 +90,7 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin.ndarray( 2, 2, x, 1, 0, 1, 3 ); +* dcopyWithin.ndarray( 2, 2, 1, 3, x, 1, 0 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ declare var dcopyWithin: Routine; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts index 87097baa76d3..5617082870d9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts @@ -25,7 +25,7 @@ import dcopyWithin = require( './index' ); { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin( 3, 3, x, 1, 1, 2 ); // $ExpectType Float64Array + dcopyWithin( 3, 3, 1, 2, x, 1 ); // $ExpectType Float64Array } // The compiler throws an error if the function is provided a first argument which is not a number... @@ -56,7 +56,7 @@ import dcopyWithin = require( './index' ); dcopyWithin( 3, ( x: number ): number => x, x, 1, 1, 2 ); // $ExpectError } -// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... { dcopyWithin( 3, 3, '3', 1, 1, 2 ); // $ExpectError dcopyWithin( 3, 3, 3, 1, 1, 2 ); // $ExpectError @@ -127,7 +127,7 @@ import dcopyWithin = require( './index' ); { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin.ndarray( 3, 3, x, 1, 1, 1, 2 ); // $ExpectType Float64Array + dcopyWithin.ndarray( 3, 3, 1, 2, x, 1, 1 ); // $ExpectType Float64Array } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c index 0988f49653fd..dcc7f72971c7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c @@ -30,7 +30,7 @@ int main( void ) { const int strideX = 1; // Copy elements starting from index 1 to index 4: - stdlib_strided_dcopy_within( N, 4, x, strideX, 1, 4 ); + stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX ); // Print the result: for ( int i = 0; i < 8; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js index b6b3e5b2e69d..1fc78bbf7632 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -27,9 +27,9 @@ var x = discreteUniform( 10, 0, 500, { console.log( x ); // Copy the first 3 elements to positions 5, 6, 7: -dcopyWithin( 3, 5, x, 1, 0, 3 ); +dcopyWithin( 3, 5, 0, 3, x, 1 ); console.log( x ); // Copy every other element starting from the second element: -dcopyWithin( 5, 0, x, 1, 1, 9 ); +dcopyWithin( 5, 0, 1, 9, x, 1 ); console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h index 1935bfd4f806..aa4f8daa0c57 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h @@ -31,12 +31,12 @@ extern "C" { /** * Performs an in-place copy of elements within a double-precision floating-point array. */ -void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT start, const CBLAS_INT end ); +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX ); /** * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. */ -void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT start, const CBLAS_INT end ); +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index 5b18061ceba6..22eebe247a58 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -31,10 +31,10 @@ var ndarray = require( './ndarray.js' ); * * @param {PositiveInteger} N - number of indexed elements * @param {integer} target - target index -* @param {Float64Array} x - input array -* @param {integer} strideX - stride length * @param {integer} start - source start index * @param {integer} end - source end index +* @param {Float64Array} x - input array +* @param {integer} strideX - stride length * @returns {Float64Array} input array * * @example @@ -42,14 +42,14 @@ var ndarray = require( './ndarray.js' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* dcopyWithin( 2, 2, 1, 3, x, 1 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ -function dcopyWithin( N, target, x, strideX, start, end ) { +function dcopyWithin( N, target, start, end, x, strideX ) { if ( N <= 0 ) { return x; } - return ndarray( N, target, x, strideX, stride2offset( N, strideX ), start, end ); // eslint-disable-line max-len + return ndarray( N, target, start, end, x, strideX, stride2offset( N, strideX ) ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index 9649571b6f0e..2ca2a7a591b1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -31,10 +31,10 @@ var addon = require( './../src/addon.node' ); * @private * @param {PositiveInteger} N - number of indexed elements * @param {integer} target - target index -* @param {Float64Array} x - input array -* @param {integer} strideX - stride length * @param {integer} start - source start index * @param {integer} end - source end index +* @param {Float64Array} x - input array +* @param {integer} strideX - stride length * @returns {Float64Array} input array * * @example @@ -42,11 +42,11 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* dcopyWithin( 2, 2, 1, 3, x, 1 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ -function dcopyWithin( N, target, x, strideX, start, end ) { - addon( N, target, x, strideX, start, end ); +function dcopyWithin( N, target, start, end, x, strideX ) { + addon( N, target, start, end, x, strideX ); return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js index dec0f111e234..48124c574f41 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -29,7 +29,7 @@ * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, x, 1, 1, 3 ); +* dcopyWithin( 2, 2, 1, 3, x, 1 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] * * @example @@ -38,7 +38,7 @@ * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin.ndarray( 2, 2, x, 1, 0, 1, 3 ); +* dcopyWithin.ndarray( 2, 2, 1, 3, x, 1, 0 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index cfd163b429f9..cc00c9c4cbd6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -32,11 +32,11 @@ var Float64Array = require( '@stdlib/array/float64' ); * * @param {PositiveInteger} N - number of indexed elements * @param {integer} target - target index +* @param {integer} start - source start index +* @param {integer} end - source end index * @param {Float64Array} x - input array * @param {integer} strideX - stride length * @param {NonNegativeInteger} offsetX - starting index -* @param {integer} start - source start index -* @param {integer} end - source end index * @returns {Float64Array} input array * * @example @@ -44,10 +44,10 @@ var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, x, 1, 0, 1, 3 ); +* dcopyWithin( 2, 2, 1, 3, x, 1, 0 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ -function dcopyWithin( N, target, x, strideX, offsetX, start, end ) { +function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { var targetIdx; var tmp; var cl; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index c24c38f49f1d..3b0cdaadd14d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -31,11 +31,11 @@ var addon = require( './../src/addon.node' ); * @private * @param {PositiveInteger} N - number of indexed elements * @param {integer} target - target index +* @param {integer} start - source start index +* @param {integer} end - source end index * @param {Float64Array} x - input array * @param {integer} strideX - stride length * @param {NonNegativeInteger} offsetX - starting index -* @param {integer} start - source start index -* @param {integer} end - source end index * @returns {Float64Array} input array * * @example @@ -43,11 +43,11 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, x, 1, 0, 1, 3 ); +* dcopyWithin( 2, 2, 1, 3, x, 1, 0 ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ -function dcopyWithin( N, target, x, strideX, offsetX, start, end ) { - addon.ndarray( N, target, x, strideX, offsetX, start, end ); +function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { + addon.ndarray( N, target, start, end, x, strideX, offsetX ); return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c index ab89b7953339..a199606194bf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c @@ -35,11 +35,11 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV( env, info, argv, argc, 6 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_INT64( env, target, argv, 1 ); - STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); - STDLIB_NAPI_ARGV_INT64( env, start, argv, 4 ); - STDLIB_NAPI_ARGV_INT64( env, end, argv, 5 ); - STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 2 ); - API_SUFFIX(stdlib_strided_dcopy_within)( N, target, x, strideX, start, end ); + STDLIB_NAPI_ARGV_INT64( env, start, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, end, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 4 ); + API_SUFFIX(stdlib_strided_dcopy_within)( N, target, start, end, x, strideX ); return NULL; } @@ -54,12 +54,12 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV( env, info, argv, argc, 7 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_INT64( env, target, argv, 1 ); - STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); - STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 ); - STDLIB_NAPI_ARGV_INT64( env, start, argv, 5 ); - STDLIB_NAPI_ARGV_INT64( env, end, argv, 6 ); - STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 2 ); - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, x, strideX, offsetX, start, end ); + STDLIB_NAPI_ARGV_INT64( env, start, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, end, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 4 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, x, strideX, offsetX ); return NULL; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index b565bd90e167..7418626530a0 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -27,14 +27,14 @@ * * @param N number of indexed elements * @param target target index -* @param x input array -* @param strideX stride length * @param start source start index * @param end source end index +* @param x input array +* @param strideX stride length */ -void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT start, const CBLAS_INT end ) { +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX ) { CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, x, strideX, ox, start, end ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, x, strideX, ox ); } /** @@ -42,13 +42,13 @@ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT * * @param N number of indexed elements * @param target target index +* @param start source start index +* @param end source end index * @param x input array * @param strideX stride length * @param offsetX starting index -* @param start source start index -* @param end source end index */ -void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, const CBLAS_INT start, const CBLAS_INT end ) { +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { CBLAS_INT targetIdx; double *tmp; CBLAS_INT cl; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index da54090ed181..de6071e63841 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -46,7 +46,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, x, 1, 1, 4 ); + actual = dcopyWithin( 3, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -54,7 +54,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, x, 1, 0, 3 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -62,7 +62,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); - actual = dcopyWithin( 4, 5, x, 1, 0, 3 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -70,7 +70,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, x, 1, 0, 3 ); + actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -86,7 +86,7 @@ tape( 'the function supports providing a stride parameter', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 2, 0, x, 2, 1, 4 ); + actual = dcopyWithin( 2, 0, 1, 4, x, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -101,7 +101,7 @@ tape( 'the function supports providing negative strides', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 2, x, -1, 5, 3 ); + actual = dcopyWithin( 3, 2, 5, 3, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -109,7 +109,7 @@ tape( 'the function supports providing negative strides', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, x, -1, 5, 0 ); + actual = dcopyWithin( 2, 3, 5, 0, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -125,12 +125,12 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, x, 1, 1, 4 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, x, 1, 1, 4 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 1f42bb3f0652..7a5374375f3f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -57,7 +57,7 @@ tape( 'the function handles overlapping copy regions', opts, function test( t ) x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, x, 1, 0, 3 ); + actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -72,7 +72,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, x, 1, 1, 4 ); + actual = dcopyWithin( 3, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -81,11 +81,11 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, x, 1, 0, 3 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns input array when target >= N' ); t.deepEqual( x, expected, 'returns expected value when target >= N' ); - actual = dcopyWithin( 6, 10, x, 1, 0, 3 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns input array when target > N' ); t.deepEqual( x, expected, 'returns expected value when target > N' ); @@ -100,7 +100,7 @@ tape( 'the function supports providing a stride parameter', opts, function test( x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 2, 0, x, 2, 1, 4 ); + actual = dcopyWithin( 2, 0, 1, 4, x, 2 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -115,7 +115,7 @@ tape( 'the function supports providing negative strides', opts, function test( t x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 2, x, -1, 5, 3 ); + actual = dcopyWithin( 3, 2, 5, 3, x, -1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -123,7 +123,7 @@ tape( 'the function supports providing negative strides', opts, function test( t x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, x, -1, 5, 0 ); + actual = dcopyWithin( 2, 3, 5, 0, x, -1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -139,11 +139,11 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, x, 1, 1, 4 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, x, 1, 1, 4 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 6b4dd6b5f636..219fc7ad3480 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -46,7 +46,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, x, 1, 0, 1, 4 ); + actual = dcopyWithin( 3, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -54,7 +54,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, x, 1, 0, 0, 3 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -62,7 +62,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); - actual = dcopyWithin( 4, 5, x, 1, 0, 0, 3 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -70,7 +70,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, x, 1, 0, 0, 3 ); + actual = dcopyWithin( 3, 2, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -86,7 +86,7 @@ tape( 'the function supports providing an offset parameter', function test( t ) x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 2, 3, x, 1, 1, 0, 2 ); + actual = dcopyWithin( 2, 3, 0, 2, x, 1, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -101,7 +101,7 @@ tape( 'the function supports providing a stride parameter', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 2, 0, x, 2, 0, 1, 4 ); + actual = dcopyWithin( 2, 0, 1, 4, x, 2, 0 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -116,7 +116,7 @@ tape( 'the function supports providing negative strides', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 2, x, -1, 0, 5, 3 ); + actual = dcopyWithin( 3, 2, 5, 3, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -124,7 +124,7 @@ tape( 'the function supports providing negative strides', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, x, -1, 0, 5, 0 ); + actual = dcopyWithin( 2, 3, 5, 0, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -140,12 +140,12 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, x, 1, 0, 1, 4 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, x, 1, 0, 1, 4 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index f5f902784a76..3d454da6badb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -57,7 +57,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, x, 1, 0, 1, 4 ); + actual = dcopyWithin( 3, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -65,7 +65,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, x, 1, 0, 0, 3 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -73,7 +73,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); - actual = dcopyWithin( 4, 5, x, 1, 0, 0, 3 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -81,7 +81,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, x, 1, 0, 0, 3 ); + actual = dcopyWithin( 3, 2, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -97,7 +97,7 @@ tape( 'the function supports providing an offset parameter', opts, function test x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 2, 3, x, 1, 1, 0, 2 ); + actual = dcopyWithin( 2, 3, 0, 2, x, 1, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -112,7 +112,7 @@ tape( 'the function supports providing a stride parameter', opts, function test( x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 2, 0, x, 2, 0, 1, 4 ); + actual = dcopyWithin( 2, 0, 1, 4, x, 2, 0 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -127,7 +127,7 @@ tape( 'the function supports providing negative strides', opts, function test( t x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 2, x, -1, 0, 5, 3 ); + actual = dcopyWithin( 3, 2, 5, 3, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -135,7 +135,7 @@ tape( 'the function supports providing negative strides', opts, function test( t x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, x, -1, 0, 5, 0 ); + actual = dcopyWithin( 2, 3, 5, 0, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -151,12 +151,12 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, x, 1, 0, 1, 4 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, x, 1, 0, 1, 4 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); From 1b523b0fc7609611d514f375c03626c0f98829e9 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 19 Oct 2025 21:02:37 +0500 Subject: [PATCH 04/26] 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: na - 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: 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 --- --- .../blas/ext/base/dcopy-within/lib/ndarray.js | 54 +++++++++------ .../blas/ext/base/dcopy-within/manifest.json | 18 ++++- .../blas/ext/base/dcopy-within/src/main.c | 68 +++++++++++-------- 3 files changed, 87 insertions(+), 53 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index cc00c9c4cbd6..21a54c571ff6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -21,8 +21,10 @@ // MODULES // var min = require( '@stdlib/math/base/special/min' ); +var max = require( '@stdlib/math/base/special/max' ); var abs = require( '@stdlib/math/base/special/abs' ); var Float64Array = require( '@stdlib/array/float64' ); +var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; // MAIN // @@ -48,43 +50,53 @@ var Float64Array = require( '@stdlib/array/float64' ); * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] */ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { - var targetIdx; + var FLG; + var tei; + var sei; + var tsi; + var ssi; var tmp; var cl; - var o; - var i; if ( N <= 0 ) { return x; } + FLG = false; + // Resolve copy length: cl = min( abs( end - start ), N ); - // Create a temporary copy of source elements: - tmp = new Float64Array( cl ); + // Calculate source and target indices: if ( strideX > 0 ) { - o = offsetX + ( start * strideX ); + ssi = offsetX + ( start * strideX ); + sei = ssi + ( ( cl - 1 ) * strideX ); + tsi = offsetX + ( target * strideX ); + tei = tsi + ( ( cl - 1 ) * strideX ); } else { - o = start; - } - // Copy source elements to temporary array: - for ( i = 0; i < cl; i++ ) { - tmp[ i ] = x[ o ]; - o += strideX; + ssi = offsetX + start; + sei = ssi + ( ( cl - 1 ) * strideX ); + tsi = offsetX + target; + tei = tsi + ( ( cl - 1 ) * strideX ); } - // Resolve the target index: - if ( strideX > 0 ) { - targetIdx = offsetX + ( target * strideX ); - } else { - targetIdx = target; + // Check if source and target regions overlap: + if ( + !( max( ssi, sei ) < min( tsi, tei ) || + max( tsi, tei ) < min( ssi, sei ) ) + ) { + FLG = true; } - // Allocate elements to target position: - for ( i = 0; i < cl; i++ ) { - x[ targetIdx ] = tmp[ i ]; - targetIdx += strideX; + if ( FLG ) { + // Create a temporary copy of source elements: + tmp = new Float64Array( cl ); + dcopy( cl, x, strideX, ssi, tmp, 1, 0 ); + + // Copy from temporary array to target position: + dcopy( cl, tmp, 1, 0, x, strideX, tsi ); + } else { + dcopy( cl, x, strideX, ssi, x, strideX, tsi ); } return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json index ae3425297fdd..6080680bca90 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json @@ -39,8 +39,11 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/max", + "@stdlib/math/base/special/min", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", @@ -60,8 +63,11 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs" + "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/max", + "@stdlib/math/base/special/min" ] }, { @@ -77,8 +83,11 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs" + "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/max", + "@stdlib/math/base/special/min" ] }, { @@ -94,8 +103,11 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs" + "@stdlib/math/base/special/abs", + "@stdlib/math/base/special/max", + "@stdlib/math/base/special/min" ] } ] diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index 7418626530a0..20e82da89452 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -18,8 +18,11 @@ #include "stdlib/blas/ext/base/dcopy_within.h" #include "stdlib/blas/base/shared.h" +#include "stdlib/blas/base/dcopy.h" #include "stdlib/strided/base/stride2offset.h" #include "stdlib/math/base/special/abs.h" +#include "stdlib/math/base/special/max.h" +#include "stdlib/math/base/special/min.h" #include /** @@ -49,16 +52,20 @@ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT * @param offsetX starting index */ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { - CBLAS_INT targetIdx; double *tmp; + CBLAS_INT ssi; + CBLAS_INT sei; + CBLAS_INT tsi; + CBLAS_INT tei; + CBLAS_INT FLG; CBLAS_INT cl; - CBLAS_INT o; - CBLAS_INT i; if ( N <= 0 ) { return; } + FLG = 0; + // Resolve copy length: if ( stdlib_base_abs( end - start ) < N ) { cl = stdlib_base_abs( end - start ); @@ -66,38 +73,41 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C cl = N; } - // Allocate temporary array and extract source elements: - tmp = (double *)malloc( cl * sizeof(double) ); - if ( tmp == NULL ) { - return; - } - - // Calculate source offset based on stride direction: + // Calculate source and target indices: if ( strideX > 0 ) { - o = offsetX + ( start * strideX ); + ssi = offsetX + ( start * strideX ); + sei = ssi + ( ( cl - 1 ) * strideX ); + tsi = offsetX + ( target * strideX ); + tei = tsi + ( ( cl - 1 ) * strideX ); } else { - o = start; + ssi = offsetX + start; + sei = ssi + ( ( cl - 1 ) * strideX ); + tsi = offsetX + target; + tei = tsi + ( ( cl - 1 ) * strideX ); } - // Copy source elements to temporary array: - for ( i = 0; i < cl; i++ ) { - tmp[ i ] = x[ o ]; - o += strideX; + // Check if source and target regions overlap: + if ( + !( stdlib_base_max( ssi, sei ) < stdlib_base_min( tsi, tei ) || + stdlib_base_max( tsi, tei ) < stdlib_base_min( ssi, sei ) ) + ) { + FLG = 1; } - // Resolve the target index: - if ( strideX > 0 ) { - targetIdx = offsetX + ( target * strideX ); - } else { - targetIdx = target; - } + if ( FLG ) { + // Create a temporary copy of source elements: + tmp = (double *)malloc( cl * sizeof(double) ); + if ( tmp == NULL ) { + return; + } + c_dcopy_ndarray( cl, x, strideX, ssi, tmp, 1, 0 ); - // Allocate elements to target position: - for ( i = 0; i < cl; i++ ) { - x[ targetIdx ] = tmp[ i ]; - targetIdx += strideX; - } + // Copy from temporary array to target position: + c_dcopy_ndarray( cl, tmp, 1, 0, x, strideX, tsi ); - // Clean up memory: - free( tmp ); + // Clean up memory: + free( tmp ); + } else { + c_dcopy_ndarray( cl, x, strideX, ssi, x, strideX, tsi ); + } } From 99281641d0e943ba5e8df9c57167156ca8912609 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 19 Oct 2025 21:11:56 +0500 Subject: [PATCH 05/26] docs: apply suggestions from code review --- .../blas/ext/base/dcopy-within/README.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 078520c1a69e..aaf98a95b02d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -39,8 +39,8 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin( 3, 2, 1, 2, x, 1 ); -// x => [ 1.0, 2.0, 2.0, 4.0, 5.0, 6.0 ] +dcopyWithin( 3, 3, 1, 4, x, 1 ); +// x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ``` The function has the following parameters: @@ -57,10 +57,10 @@ The `N` and stride parameters determine which elements in the strided array are ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var x = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 5.0, 0.0, 7.0, 0.0 ] ); dcopyWithin( 3, 0, 1, 6, x, 2 ); -// x => [ 3.0, 2.0, 5.0, 4.0, 7.0, 6.0, 7.0, 8.0 ] +// x => [ 3.0, 0.0, 5.0, 0.0, 7.0, 0.0, 7.0, 0.0 ] ``` Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. @@ -69,14 +69,14 @@ Note that indexing is relative to the first index. To introduce an offset, use [ var Float64Array = require( '@stdlib/array/float64' ); // Initial array... -var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); // Create an offset view... var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element // Copy within the view... -dcopyWithin( 2, 0, 2, 5, x1, 1 ); -// x0 => [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] +dcopyWithin( 3, 0, 2, 5, x1, 1 ); +// x0 => [ 1.0, 4.0, 5.0, 6.0, 5.0, 6.0, 7.0, 8.0 ] ``` #### dcopyWithin.ndarray( N, target, start, end, x, strideX, offsetX ) @@ -88,7 +88,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin.ndarray( 2, 2, 0, 5, x, 1, 1 ); +dcopyWithin.ndarray( 2, 2, 0, 2, x, 1, 1 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ``` @@ -101,10 +101,10 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -dcopyWithin.ndarray( 2, 2, 0, 2, x, 1, 2 ); -// x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0 ] +dcopyWithin.ndarray( 3, 4, 0, 3, x, 1, 2 ); +// x => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 3.0, 4.0 ] ``` From 49f2ef52632f3374387dbb6c60c5f5a3b79895d8 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 19 Oct 2025 23:16:11 +0500 Subject: [PATCH 06/26] refactor: negative test cases --- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: na - 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 --- --- .../blas/ext/base/dcopy-within/test/test.dcopy_within.js | 6 +++--- .../ext/base/dcopy-within/test/test.dcopy_within.native.js | 6 +++--- .../@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js | 6 +++--- .../blas/ext/base/dcopy-within/test/test.ndarray.native.js | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index de6071e63841..d1c908771992 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -99,9 +99,9 @@ tape( 'the function supports providing negative strides', function test( t ) { var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 5, 3, x, -1 ); + actual = dcopyWithin( 3, 3, 0, 2, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -109,7 +109,7 @@ tape( 'the function supports providing negative strides', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, 5, 0, x, -1 ); + actual = dcopyWithin( 3, 1, 3, 5, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 7a5374375f3f..9b5d1f474038 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -113,9 +113,9 @@ tape( 'the function supports providing negative strides', opts, function test( t var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 5, 3, x, -1 ); + actual = dcopyWithin( 3, 3, 0, 2, x, -1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -123,7 +123,7 @@ tape( 'the function supports providing negative strides', opts, function test( t x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, 5, 0, x, -1 ); + actual = dcopyWithin( 3, 1, 3, 5, x, -1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 219fc7ad3480..c578d38d81c1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -114,9 +114,9 @@ tape( 'the function supports providing negative strides', function test( t ) { var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 5, 3, x, -1, 0 ); + actual = dcopyWithin( 3, 3, 0, 2, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -124,7 +124,7 @@ tape( 'the function supports providing negative strides', function test( t ) { x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, 5, 0, x, -1, 0 ); + actual = dcopyWithin( 3, 1, 3, 5, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index 3d454da6badb..956370373449 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -125,9 +125,9 @@ tape( 'the function supports providing negative strides', opts, function test( t var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 5.0, 6.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 5, 3, x, -1, 0 ); + actual = dcopyWithin( 3, 3, 0, 2, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -135,7 +135,7 @@ tape( 'the function supports providing negative strides', opts, function test( t x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 3, 5, 0, x, -1, 0 ); + actual = dcopyWithin( 3, 1, 3, 5, x, -1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); From 106602ce6943fe47bad3732ebf35ce8eb1cce149 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 7 Mar 2026 21:41:01 +0500 Subject: [PATCH 07/26] 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 --- --- .../blas/ext/base/dcopy-within/README.md | 4 +- .../base/dcopy-within/benchmark/benchmark.js | 5 +- .../benchmark/benchmark.native.js | 5 +- .../benchmark/benchmark.ndarray.js | 5 +- .../benchmark/benchmark.ndarray.native.js | 5 +- .../base/dcopy-within/benchmark/c/Makefile | 2 +- .../benchmark/c/benchmark.length.c | 2 +- .../blas/ext/base/dcopy-within/binding.gyp | 97 +++++++++++- .../blas/ext/base/dcopy-within/docs/repl.txt | 2 - .../base/dcopy-within/docs/types/index.d.ts | 2 +- .../ext/base/dcopy-within/docs/types/test.ts | 140 +++++++++--------- .../ext/base/dcopy-within/examples/c/Makefile | 2 +- .../base/dcopy-within/examples/c/example.c | 2 +- .../ext/base/dcopy-within/examples/index.js | 2 +- .../blas/ext/base/dcopy-within/include.gypi | 2 +- .../stdlib/blas/ext/base/dcopy_within.h | 3 +- .../ext/base/dcopy-within/lib/dcopy_within.js | 2 +- .../dcopy-within/lib/dcopy_within.native.js | 2 +- .../blas/ext/base/dcopy-within/lib/index.js | 2 +- .../blas/ext/base/dcopy-within/lib/main.js | 2 +- .../blas/ext/base/dcopy-within/lib/native.js | 2 +- .../blas/ext/base/dcopy-within/lib/ndarray.js | 17 +-- .../base/dcopy-within/lib/ndarray.native.js | 2 +- .../blas/ext/base/dcopy-within/manifest.json | 4 - .../blas/ext/base/dcopy-within/src/Makefile | 2 +- .../blas/ext/base/dcopy-within/src/addon.c | 2 +- .../blas/ext/base/dcopy-within/src/main.c | 25 ++-- .../dcopy-within/test/test.dcopy_within.js | 21 ++- .../test/test.dcopy_within.native.js | 13 +- .../blas/ext/base/dcopy-within/test/test.js | 2 +- .../base/dcopy-within/test/test.ndarray.js | 16 +- .../dcopy-within/test/test.ndarray.native.js | 12 +- 32 files changed, 245 insertions(+), 161 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index aaf98a95b02d..25f2045ae988 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -181,7 +181,7 @@ console.log( x ); Performs an in-place copy of elements within a double-precision floating-point array. ```c -const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; +double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; stdlib_strided_dcopy_within( 3, 3, 1, 4, x, 1 ); ``` diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js index 3bc2c56c035c..a98fd6917f73 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); var dcopyWithin = require( './../lib/dcopy_within.js' ); var pkg = require( './../package.json' ).name; @@ -95,7 +96,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+':len='+len, f ); + bench( format( '%s:len=%d', pkg, len ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js index b1e46310b9e2..e745cfe22047 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -100,7 +101,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+'::native:len='+len, opts, f ); + bench( format( '%s::native:len=%d', pkg, len ), opts, f ); } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js index 64e015a22977..63cef9350618 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); var dcopyWithin = require( './../lib/ndarray.js' ); var pkg = require( './../package.json' ).name; @@ -95,7 +96,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+':ndarray:len='+len, f ); + bench( format( '%s:ndarray:len=%d', pkg, len ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js index 7fe3a55ffeed..b65c018c1cd3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -100,7 +101,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+'::native:ndarray:len='+len, opts, f ); + bench( format( '%s::native:ndarray:len=%d', pkg, len ), opts, f ); } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile index cce2c865d7ad..0756dc7da20a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index 22c5e767d879..e821b309366d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp index 68a1ca11d160..60dce9d0b31a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/binding.gyp @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,6 +29,39 @@ # Target name should match the add-on export name: 'addon_target_name%': 'addon', + # Fortran compiler (to override -Dfortran_compiler=): + 'fortran_compiler%': 'gfortran', + + # Fortran compiler flags: + 'fflags': [ + # Specify the Fortran standard to which a program is expected to conform: + '-std=f95', + + # Indicate that the layout is free-form source code: + '-ffree-form', + + # Aggressive optimization: + '-O3', + + # Enable commonly used warning options: + '-Wall', + + # Warn if source code contains problematic language features: + '-Wextra', + + # Warn if a procedure is called without an explicit interface: + '-Wimplicit-interface', + + # Do not transform names of entities specified in Fortran source files by appending underscores (i.e., don't mangle names, thus allowing easier usage in C wrappers): + '-fno-underscoring', + + # Warn if source code contains Fortran 95 extensions and C-language constructs: + '-pedantic', + + # Compile but do not link (output is an object file): + '-c', + ], + # Set variables based on the host OS: 'conditions': [ [ @@ -128,6 +161,68 @@ }, ], # end condition (OS!="win") ], # end conditions + + # Define custom build actions for particular inputs: + 'rules': [ + { + # Define a rule for processing Fortran files: + 'extension': 'f', + + # Define the pathnames to be used as inputs when performing processing: + 'inputs': [ + # Full path of the current input: + '<(RULE_INPUT_PATH)' + ], + + # Define the outputs produced during processing: + 'outputs': [ + # Store an output object file in a directory for placing intermediate results (only accessible within a single target): + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).<(obj)' + ], + + # Define the rule for compiling Fortran based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + + # Rule to compile Fortran on Windows: + { + 'rule_name': 'compile_fortran_windows', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Windows...', + + 'process_outputs_as_sources': 0, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + }, + + # Rule to compile Fortran on non-Windows: + { + 'rule_name': 'compile_fortran_linux', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Linux...', + + 'process_outputs_as_sources': 1, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '-fPIC', # generate platform-independent code + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + } + ], # end condition (OS=="win") + ], # end conditions + }, # end rule (extension=="f") + ], # end rules }, # end target <(addon_target_name) # Target to copy a generated add-on to a standard location: diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index 5b504843febb..227d4963bc7c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -1,4 +1,3 @@ - {{alias}}( N, target, start, end, x, strideX ) Performs an in-place copy of elements within a double-precision floating-point strided array. @@ -107,4 +106,3 @@ See Also -------- - diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts index 622876cbf649..40d337c8d3a1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts index 5617082870d9..c811791c6b0d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,82 +32,82 @@ import dcopyWithin = require( './index' ); { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin( '3', 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( true, 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( false, 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( null, 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( undefined, 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( [], 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( {}, 3, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( ( x: number ): number => x, 3, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( '3', 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( true, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( false, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( null, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( undefined, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( [], 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( {}, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( ( x: number ): number => x, 3, 1, 2, x, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a number... { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin( 3, '3', x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, true, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, false, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, null, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, undefined, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, [], x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, {}, x, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, ( x: number ): number => x, x, 1, 1, 2 ); // $ExpectError + dcopyWithin( 3, '3', 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, true, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, false, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, null, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, undefined, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, [], 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, {}, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, ( x: number ): number => x, 1, 2, x, 1 ); // $ExpectError } -// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... +// The compiler throws an error if the function is provided a third argument which is not a number... { - dcopyWithin( 3, 3, '3', 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, 3, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, true, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, false, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, null, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, undefined, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, [], 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, {}, 1, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, ( x: number ): number => x, 1, 1, 2 ); // $ExpectError + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin( 3, 3, '1', 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, true, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, false, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, null, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, undefined, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, [], 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, {}, 2, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, ( x: number ): number => x, 2, x, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a fourth argument which is not a number... { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin( 3, 3, x, '1', 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, true, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, false, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, null, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, undefined, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, [], 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, {}, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, ( x: number ): number => x, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, 1, '2', x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, true, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, false, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, null, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, undefined, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, [], x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, {}, x, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, ( x: number ): number => x, x, 1 ); // $ExpectError } -// The compiler throws an error if the function is provided a fifth argument which is not a number... +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin( 3, 3, x, 1, '1', 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, true, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, false, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, null, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, undefined, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, [], 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, {}, 2 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, ( x: number ): number => x, 2 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, '3', 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, 3, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, true, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, false, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, null, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, undefined, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, [], 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, {}, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, ( x: number ): number => x, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a sixth argument which is not a number... { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin( 3, 3, x, 1, 1, '4' ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, true ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, false ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, null ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, [] ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, {} ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, ( x: number ): number => x ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, '4' ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, true ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, false ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, null ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, [] ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, {} ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... @@ -117,10 +117,10 @@ import dcopyWithin = require( './index' ); dcopyWithin(); // $ExpectError dcopyWithin( 3 ); // $ExpectError dcopyWithin( 3, 3 ); // $ExpectError - dcopyWithin( 3, 3, x ); // $ExpectError - dcopyWithin( 3, 3, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1 ); // $ExpectError - dcopyWithin( 3, 3, x, 1, 1, 2, {} ); // $ExpectError + dcopyWithin( 3, 3, 1 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2 ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, 1, {} ); // $ExpectError } // Attached to main export is an `ndarray` method which returns a Float64Array... @@ -134,14 +134,14 @@ import dcopyWithin = require( './index' ); { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - dcopyWithin.ndarray( '2', 3, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( true, 3, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( false, 3, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( null, 3, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( undefined, 3, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( [], 2, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( {}, 2, x, 1, 1, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( ( x: number ): number => x, 2, x, 1, 1, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( '2', 3, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( true, 3, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( false, 3, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( null, 3, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( undefined, 3, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( [], 2, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( {}, 2, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( ( x: number ): number => x, 2, 1, 2, x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided insufficient arguments... @@ -151,9 +151,9 @@ import dcopyWithin = require( './index' ); dcopyWithin.ndarray(); // $ExpectError dcopyWithin.ndarray( 2 ); // $ExpectError dcopyWithin.ndarray( 2, 2 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, x ); // $ExpectError - dcopyWithin.ndarray( 2, 2, x, 1 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, x, 1, 1 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, x, 1, 1, 1 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, x, 1, 1, 1, 2, {} ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, 0, {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile index 25ced822f96a..c8f8e9a1517b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c index dcc7f72971c7..9fc647b2f9af 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js index 1fc78bbf7632..dcc1ee176138 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi index ecfaf82a3279..bee8d41a2caf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h index aa4f8daa0c57..5a73683fbcea 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,4 +43,3 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C #endif #endif // !STDLIB_BLAS_EXT_BASE_DCOPY_WITHIN_H - diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index 22eebe247a58..17c3bc97e18f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index 2ca2a7a591b1..174175a2b2d7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js index 48124c574f41..f5c842c9965c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js index 4207d1135fd0..b6e4630b77cc 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js index f6ea7782df7d..7ebab36bfd23 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index 21a54c571ff6..357fd4530598 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,17 +68,10 @@ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { cl = min( abs( end - start ), N ); // Calculate source and target indices: - if ( strideX > 0 ) { - ssi = offsetX + ( start * strideX ); - sei = ssi + ( ( cl - 1 ) * strideX ); - tsi = offsetX + ( target * strideX ); - tei = tsi + ( ( cl - 1 ) * strideX ); - } else { - ssi = offsetX + start; - sei = ssi + ( ( cl - 1 ) * strideX ); - tsi = offsetX + target; - tei = tsi + ( ( cl - 1 ) * strideX ); - } + ssi = offsetX + ( start * strideX ); + sei = ssi + ( ( cl - 1 ) * strideX ); + tsi = offsetX + ( target * strideX ); + tei = tsi + ( ( cl - 1 ) * strideX ); // Check if source and target regions overlap: if ( diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index 3b0cdaadd14d..a1a98aa3d9b6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json index 6080680bca90..bd71aa12bb4f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json @@ -41,7 +41,6 @@ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs", "@stdlib/math/base/special/max", "@stdlib/math/base/special/min", "@stdlib/napi/export", @@ -65,7 +64,6 @@ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs", "@stdlib/math/base/special/max", "@stdlib/math/base/special/min" ] @@ -85,7 +83,6 @@ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs", "@stdlib/math/base/special/max", "@stdlib/math/base/special/min" ] @@ -105,7 +102,6 @@ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/abs", "@stdlib/math/base/special/max", "@stdlib/math/base/special/min" ] diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile index 7733b6180cb4..2caf905cedbe 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c index a199606194bf..a32b3f1fc681 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index 20e82da89452..f19241142c85 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,9 @@ #include "stdlib/blas/base/shared.h" #include "stdlib/blas/base/dcopy.h" #include "stdlib/strided/base/stride2offset.h" -#include "stdlib/math/base/special/abs.h" #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/special/min.h" +#include #include /** @@ -57,8 +57,8 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C CBLAS_INT sei; CBLAS_INT tsi; CBLAS_INT tei; - CBLAS_INT FLG; CBLAS_INT cl; + int8_t FLG; if ( N <= 0 ) { return; @@ -67,24 +67,17 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C FLG = 0; // Resolve copy length: - if ( stdlib_base_abs( end - start ) < N ) { - cl = stdlib_base_abs( end - start ); + if ( abs( end - start ) < N ) { + cl = abs( end - start ); } else { cl = N; } // Calculate source and target indices: - if ( strideX > 0 ) { - ssi = offsetX + ( start * strideX ); - sei = ssi + ( ( cl - 1 ) * strideX ); - tsi = offsetX + ( target * strideX ); - tei = tsi + ( ( cl - 1 ) * strideX ); - } else { - ssi = offsetX + start; - sei = ssi + ( ( cl - 1 ) * strideX ); - tsi = offsetX + target; - tei = tsi + ( ( cl - 1 ) * strideX ); - } + ssi = offsetX + ( start * strideX ); + sei = ssi + ( ( cl - 1 ) * strideX ); + tsi = offsetX + ( target * strideX ); + tei = tsi + ( ( cl - 1 ) * strideX ); // Check if source and target regions overlap: if ( diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index d1c908771992..8639f2abc7f1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,6 +67,14 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function handles overlapping copy regions', function test( t ) { + var expected; + var actual; + var x; + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); @@ -74,7 +82,6 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); }); @@ -99,17 +106,17 @@ tape( 'the function supports providing negative strides', function test( t ) { var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 3, 0, 2, x, -1 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 3, 1, 3, 5, x, -1 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 9b5d1f474038..34633196a678 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,6 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); - // Test case where target >= N (should return unchanged): x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); @@ -113,17 +112,17 @@ tape( 'the function supports providing negative strides', opts, function test( t var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 3, 0, 2, x, -1 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 3, 1, 3, 5, x, -1 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js index 7ad0d8c87111..c599de2d5d6e 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index c578d38d81c1..2e689f907b60 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,7 +88,7 @@ tape( 'the function supports providing an offset parameter', function test( t ) actual = dcopyWithin( 2, 3, 0, 2, x, 1, 1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -103,7 +103,7 @@ tape( 'the function supports providing a stride parameter', function test( t ) { actual = dcopyWithin( 2, 0, 1, 4, x, 2, 0 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -114,17 +114,17 @@ tape( 'the function supports providing negative strides', function test( t ) { var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 3, 0, 2, x, -1, 0 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 3, 1, 3, 5, x, -1, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index 956370373449..b7246347f305 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,17 +125,17 @@ tape( 'the function supports providing negative strides', opts, function test( t var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 3, 0, 2, x, -1, 0 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 5.0, 6.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 3, 1, 3, 5, x, -1, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); From 5f284da7f5e2408f67995e245d500bd0d07f97b3 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 7 Mar 2026 22:29:30 +0500 Subject: [PATCH 08/26] 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: 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 --- --- .../blas/ext/base/dcopy-within/README.md | 17 +++++++++-------- .../blas/ext/base/dcopy-within/docs/repl.txt | 6 ++++-- .../ext/base/dcopy-within/docs/types/index.d.ts | 16 ++++++++-------- .../ext/base/dcopy-within/examples/index.js | 2 +- .../ext/base/dcopy-within/lib/dcopy_within.js | 4 ++-- .../blas/ext/base/dcopy-within/lib/ndarray.js | 7 +++++-- .../blas/ext/base/dcopy-within/src/main.c | 3 +++ .../base/dcopy-within/test/test.dcopy_within.js | 2 +- .../ext/base/dcopy-within/test/test.ndarray.js | 2 +- .../dcopy-within/test/test.ndarray.native.js | 2 +- 10 files changed, 35 insertions(+), 26 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 25f2045ae988..bc4118ab7e59 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -39,7 +39,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin( 3, 3, 1, 4, x, 1 ); +dcopyWithin( 6, 3, 1, 4, x, 1 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ``` @@ -88,7 +88,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin.ndarray( 2, 2, 0, 2, x, 1, 1 ); +dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 1 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ``` @@ -103,8 +103,8 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -dcopyWithin.ndarray( 3, 4, 0, 3, x, 1, 2 ); -// x => [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 3.0, 4.0 ] +dcopyWithin.ndarray( 3, 2, 0, 3, x, 1, 2 ); +// x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 5.0, 8.0 ] ``` @@ -116,6 +116,7 @@ dcopyWithin.ndarray( 3, 4, 0, 3, x, 1, 2 ); ## Notes - If `N <= 0`, both functions return the strided array unchanged. +- If `target >= N`, both functions return the strided array unchanged. - Both functions **mutate** the provided input strided array. @@ -138,7 +139,7 @@ var x = discreteUniform( 10, 0, 500, { console.log( x ); // Copy the first 3 elements to positions 5, 6, 7: -dcopyWithin( 3, 5, 0, 3, x, 1 ); +dcopyWithin( 10, 5, 0, 3, x, 1 ); console.log( x ); // Copy every other element starting from the second element: @@ -183,7 +184,7 @@ Performs an in-place copy of elements within a double-precision floating-point a ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; -stdlib_strided_dcopy_within( 3, 3, 1, 4, x, 1 ); +stdlib_strided_dcopy_within( 6, 3, 1, 4, x, 1 ); ``` The function accepts the following arguments: @@ -210,7 +211,7 @@ Performs an in-place copy of elements within a double-precision floating-point a ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; -stdlib_strided_dcopy_within_ndarray( 2, 2, 0, 2, x, 1, 1 ); +stdlib_strided_dcopy_within_ndarray( 4, 2, 0, 2, x, 1, 1 ); ``` The function accepts the following arguments: @@ -254,7 +255,7 @@ int main( void ) { double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; // Specify the number of elements to copy: - const int N = 3; + const int N = 8; // Specify a stride: const int strideX = 1; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index 227d4963bc7c..5ee40b987c36 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -10,6 +10,8 @@ If `N <= 0`, the function returns the strided array unchanged. + If `target >= N`, the function returns the strided array unchanged. + Parameters ---------- N: integer @@ -96,12 +98,12 @@ -------- // Standard Usage: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 2, 2, 0, 5, x, 1, 1 ) + > {{alias}}.ndarray( 4, 2, 0, 2, x, 1, 1 ) [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] // Using an index offset: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 2, 3, 0, 5, x, 1, 2 ) + > {{alias}}.ndarray( 4, 3, 0, 1, x, 1, 2 ) [ 1.0, 2.0, 3.0, 4.0, 5.0, 3.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts index 40d337c8d3a1..282324b4a3b7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -38,8 +38,8 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * - * dcopyWithin( 2, 2, 1, 3, x, 1 ); - * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] + * dcopyWithin( 6, 3, 1, 4, x, 1 ); + * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ ( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number ): Float64Array; @@ -60,8 +60,8 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * - * dcopyWithin.ndarray( 2, 2, 1, 3, x, 1, 0 ); - * // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] + * dcopyWithin.ndarray( 6, 3, 1, 4, x, 1, 0 ); + * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ ndarray( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; } @@ -82,16 +82,16 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, 1, 3, x, 1 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin.ndarray( 2, 2, 1, 3, x, 1, 0 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin.ndarray( 6, 3, 1, 4, x, 1, 0 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ declare var dcopyWithin: Routine; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js index dcc1ee176138..d943f71c2c37 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -27,7 +27,7 @@ var x = discreteUniform( 10, 0, 500, { console.log( x ); // Copy the first 3 elements to positions 5, 6, 7: -dcopyWithin( 3, 5, 0, 3, x, 1 ); +dcopyWithin( 10, 5, 0, 3, x, 1 ); console.log( x ); // Copy every other element starting from the second element: diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index 17c3bc97e18f..2994e53efcc5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -42,8 +42,8 @@ var ndarray = require( './ndarray.js' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, 1, 3, x, 1 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX ) { if ( N <= 0 ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index 357fd4530598..07226bf68c7c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -46,8 +46,8 @@ var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, 1, 3, x, 1, 0 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { var FLG; @@ -61,6 +61,9 @@ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { if ( N <= 0 ) { return x; } + if ( target >= N ) { + return x; + } FLG = false; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index f19241142c85..cf069a47fed4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -63,6 +63,9 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C if ( N <= 0 ) { return; } + if ( target >= N ) { + return; + } FLG = 0; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index 8639f2abc7f1..380433853668 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -60,7 +60,7 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 2e689f907b60..8d78feb964dd 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -60,7 +60,7 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index b7246347f305..f59c3e4d50f1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -71,7 +71,7 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 1.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); From b9f2837d945f9c4b3c16ccfdfd5acd054cff796a Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 7 Mar 2026 22:33:46 +0500 Subject: [PATCH 09/26] fix: failing tests --- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: na - 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 --- --- .../blas/ext/base/dcopy-within/test/test.dcopy_within.js | 2 +- .../blas/ext/base/dcopy-within/test/test.dcopy_within.native.js | 2 +- .../@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js | 2 +- .../blas/ext/base/dcopy-within/test/test.ndarray.native.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index 380433853668..edf72ea93630 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -46,7 +46,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 34633196a678..49b56d6191e5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -72,7 +72,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 8d78feb964dd..8846e92a296e 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -46,7 +46,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index f59c3e4d50f1..ebaa139f057e 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -57,7 +57,7 @@ tape( 'the function copies values within the provided double-precision floating- x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 3, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); From 69812714c6a621485a89dde8976d48152fcff2eb Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 7 Mar 2026 22:37:09 +0500 Subject: [PATCH 10/26] fix: failing tests --- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: na - 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 --- --- .../@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js | 2 +- .../blas/ext/base/dcopy-within/test/test.ndarray.native.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 8846e92a296e..b4c4a2e45e31 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -86,7 +86,7 @@ tape( 'the function supports providing an offset parameter', function test( t ) x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 2, 3, 0, 2, x, 1, 1 ); + actual = dcopyWithin( 4, 3, 0, 2, x, 1, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index ebaa139f057e..c1c200e47422 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -97,7 +97,7 @@ tape( 'the function supports providing an offset parameter', opts, function test x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 2, 3, 0, 2, x, 1, 1 ); + actual = dcopyWithin( 4, 3, 0, 2, x, 1, 1 ); t.strictEqual( actual, x, 'returns input array' ); t.deepEqual( x, expected, 'returns expected value' ); From c86fb4652ff9ac5d521a92eb356212094c07ea82 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 7 Mar 2026 22:46:26 +0500 Subject: [PATCH 11/26] fix: lint errors --- 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: na - 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: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - 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 --- --- .../blas/ext/base/dcopy-within/lib/dcopy_within.native.js | 4 ++-- .../@stdlib/blas/ext/base/dcopy-within/lib/index.js | 8 ++++---- .../blas/ext/base/dcopy-within/lib/ndarray.native.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index 174175a2b2d7..e5197af2be1a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -42,8 +42,8 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, 1, 3, x, 1 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX ) { addon( N, target, start, end, x, strideX ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js index f5c842c9965c..074c18a03731 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -29,8 +29,8 @@ * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, 1, 3, x, 1 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -38,8 +38,8 @@ * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin.ndarray( 2, 2, 1, 3, x, 1, 0 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin.ndarray( 6, 3, 1, 4, x, 1, 0 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index a1a98aa3d9b6..3a6f230c8746 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -43,8 +43,8 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 2, 2, 1, 3, x, 1, 0 ); -* // x => [ 1.0, 2.0, 2.0, 3.0, 5.0, 6.0 ] +* dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); +* // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { addon.ndarray( N, target, start, end, x, strideX, offsetX ); From de38b295e25586417b3dbc765b8ea1b59b88c4c6 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Tue, 10 Mar 2026 17:09:46 +0500 Subject: [PATCH 12/26] 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: passed - 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: 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 --- --- .../blas/ext/base/dcopy-within/README.md | 6 +- .../benchmark/c/benchmark.length.c | 5 +- .../base/dcopy-within/docs/types/index.d.ts | 14 ++-- .../ext/base/dcopy-within/docs/types/test.ts | 83 +++++++++++++++++++ .../base/dcopy-within/examples/c/example.c | 2 +- .../ext/base/dcopy-within/examples/index.js | 2 +- .../ext/base/dcopy-within/lib/dcopy_within.js | 2 +- .../blas/ext/base/dcopy-within/lib/index.js | 4 +- .../blas/ext/base/dcopy-within/lib/ndarray.js | 13 +-- .../blas/ext/base/dcopy-within/src/main.c | 23 +++-- .../dcopy-within/test/test.dcopy_within.js | 45 ++++++++++ .../test/test.dcopy_within.native.js | 67 ++++++++++++--- .../base/dcopy-within/test/test.ndarray.js | 53 ++++++++++++ .../dcopy-within/test/test.ndarray.native.js | 49 ++++++++++- 14 files changed, 323 insertions(+), 45 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index bc4118ab7e59..1827ea68ed8c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -39,7 +39,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin( 6, 3, 1, 4, x, 1 ); +dcopyWithin( x.length, 3, 1, 4, x, 1 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ``` @@ -88,8 +88,8 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 1 ); -// x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] +dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); +// x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ``` The function has the following additional parameters: diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index e821b309366d..ea6ff61c7242 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -179,13 +179,13 @@ int main( void ) { } for ( j = 0; j < REPEATS; j++ ) { count += 1; - printf( "# c::%s:len=%d\n", NAME, len ); + printf( "# c::native::%s:len=%d\n", NAME, len ); elapsed = benchmark1( iter, len ); print_results( "dcopy_within:len", elapsed ); printf( "ok %d benchmark finished\n", count ); count += 1; - printf( "# c::%s:ndarray:len=%d\n", NAME, len ); + printf( "# c::native::%s:ndarray:len=%d\n", NAME, len ); elapsed = benchmark2( iter, len ); print_results( "dcopy_within_ndarray:len", elapsed ); printf( "ok %d benchmark finished\n", count ); @@ -195,4 +195,3 @@ int main( void ) { return 0; } - diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts index 282324b4a3b7..bcab4731ab31 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -25,7 +25,7 @@ interface Routine { /** * Performs an in-place copy of elements within a double-precision floating-point array. * - * @param N - number of indexed elements to copy + * @param N - number of indexed elements * @param target - target index * @param start - source start index * @param end - source end index @@ -38,7 +38,7 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * - * dcopyWithin( 6, 3, 1, 4, x, 1 ); + * dcopyWithin( x.length, 3, 1, 4, x, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ ( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number ): Float64Array; @@ -46,7 +46,7 @@ interface Routine { /** * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. * - * @param N - number of indexed elements to copy + * @param N - number of indexed elements * @param target - target index * @param start - source start index * @param end - source end index @@ -60,7 +60,7 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * - * dcopyWithin.ndarray( 6, 3, 1, 4, x, 1, 0 ); + * dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ ndarray( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; @@ -69,7 +69,7 @@ interface Routine { /** * Performs an in-place copy of elements within a double-precision floating-point array. * -* @param N - number of indexed elements to copy +* @param N - number of indexed elements * @param target - target index * @param start - source start index * @param end - source end index @@ -82,7 +82,7 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] * * @example @@ -90,7 +90,7 @@ interface Routine { * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin.ndarray( 6, 3, 1, 4, x, 1, 0 ); +* dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ declare var dcopyWithin: Routine; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts index c811791c6b0d..4a440a319402 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts @@ -144,6 +144,89 @@ import dcopyWithin = require( './index' ); dcopyWithin.ndarray( ( x: number ): number => x, 2, 1, 2, x, 1, 0 ); // $ExpectError } +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( 2, '2', 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, true, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, false, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, null, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, undefined, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, [], 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, {}, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, ( x: number ): number => x, 1, 2, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( 2, 2, '1', 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, true, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, false, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, null, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, undefined, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, [], 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, {}, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, ( x: number ): number => x, 2, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( 2, 2, 1, '2', x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, true, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, false, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, null, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, undefined, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, [], x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, {}, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, ( x: number ): number => x, x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Float64Array... +{ + dcopyWithin.ndarray( 2, 2, 1, 2, '5', 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, 5, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, true, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, false, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, null, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, undefined, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, [], 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, {}, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( 2, 2, 1, 2, x, '1', 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, true, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, false, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, null, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, undefined, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, [], 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, {}, 0 ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, '0' ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, true ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, false ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, null ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, undefined ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, [] ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, {} ); // $ExpectError + dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, ( x: number ): number => x ); // $ExpectError +} + // The compiler throws an error if the `ndarray` method is provided insufficient arguments... { const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c index 9fc647b2f9af..044a873b5a21 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c @@ -24,7 +24,7 @@ int main( void ) { double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; // Specify the number of elements to copy: - const int N = 3; + const int N = 8; // Specify a stride: const int strideX = 1; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js index d943f71c2c37..d7b0ae25acbe 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -30,6 +30,6 @@ console.log( x ); dcopyWithin( 10, 5, 0, 3, x, 1 ); console.log( x ); -// Copy every other element starting from the second element: +// Copy elements starting from index 1 to position 0: dcopyWithin( 5, 0, 1, 9, x, 1 ); console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index 2994e53efcc5..a910abc2ea68 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -42,7 +42,7 @@ var ndarray = require( './ndarray.js' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js index 074c18a03731..f506c2c9bc23 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -29,7 +29,7 @@ * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] * * @example @@ -38,7 +38,7 @@ * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin.ndarray( 6, 3, 1, 4, x, 1, 0 ); +* dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index 07226bf68c7c..eb347abef3b9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -46,11 +46,11 @@ var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { - var FLG; + var flg; var tei; var sei; var tsi; @@ -65,10 +65,13 @@ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { return x; } - FLG = false; + flg = false; // Resolve copy length: cl = min( abs( end - start ), N ); + if ( cl <= 0 ) { + return x; + } // Calculate source and target indices: ssi = offsetX + ( start * strideX ); @@ -81,10 +84,10 @@ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { !( max( ssi, sei ) < min( tsi, tei ) || max( tsi, tei ) < min( ssi, sei ) ) ) { - FLG = true; + flg = true; } - if ( FLG ) { + if ( flg ) { // Create a temporary copy of source elements: tmp = new Float64Array( cl ); dcopy( cl, x, strideX, ssi, tmp, 1, 0 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index cf069a47fed4..b6348c9f3530 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -22,7 +22,7 @@ #include "stdlib/strided/base/stride2offset.h" #include "stdlib/math/base/special/max.h" #include "stdlib/math/base/special/min.h" -#include +#include #include /** @@ -52,13 +52,13 @@ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT * @param offsetX starting index */ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { - double *tmp; CBLAS_INT ssi; CBLAS_INT sei; CBLAS_INT tsi; CBLAS_INT tei; CBLAS_INT cl; - int8_t FLG; + double *tmp; + bool flg; if ( N <= 0 ) { return; @@ -67,14 +67,19 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C return; } - FLG = 0; + flg = false; // Resolve copy length: - if ( abs( end - start ) < N ) { - cl = abs( end - start ); - } else { + cl = end - start; + if ( cl < 0 ) { + cl = -cl; + } + if ( cl > N ) { cl = N; } + if ( cl <= 0 ) { + return; + } // Calculate source and target indices: ssi = offsetX + ( start * strideX ); @@ -87,10 +92,10 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C !( stdlib_base_max( ssi, sei ) < stdlib_base_min( tsi, tei ) || stdlib_base_max( tsi, tei ) < stdlib_base_min( ssi, sei ) ) ) { - FLG = 1; + flg = true; } - if ( FLG ) { + if ( flg ) { // Create a temporary copy of source elements: tmp = (double *)malloc( cl * sizeof(double) ); if ( tmp == NULL ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index edf72ea93630..7802c2e7ea08 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -124,6 +124,51 @@ tape( 'the function supports providing negative strides', function test( t ) { t.end(); }); +tape( 'the function supports a reversed source range (start > end)', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 3, 1, x, 1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `start` equals `end`', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a stride of zero', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', function test( t ) { var expected; var actual; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 49b56d6191e5..8c930e9727ca 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -59,7 +59,7 @@ tape( 'the function handles overlapping copy regions', opts, function test( t ) actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -74,19 +74,19 @@ tape( 'the function copies values within the provided double-precision floating- actual = dcopyWithin( 6, 3, 1, 4, x, 1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); - t.strictEqual( actual, x, 'returns input array when target >= N' ); - t.deepEqual( x, expected, 'returns expected value when target >= N' ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); - t.strictEqual( actual, x, 'returns input array when target > N' ); - t.deepEqual( x, expected, 'returns expected value when target > N' ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -101,7 +101,7 @@ tape( 'the function supports providing a stride parameter', opts, function test( actual = dcopyWithin( 2, 0, 1, 4, x, 2 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -116,7 +116,7 @@ tape( 'the function supports providing negative strides', opts, function test( t actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); @@ -124,12 +124,57 @@ tape( 'the function supports providing negative strides', opts, function test( t actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); +tape( 'the function supports a reversed source range (start > end)', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 3, 1, x, 1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `start` equals `end`', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a stride of zero', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', opts, function test( t ) { var expected; var actual; @@ -139,11 +184,11 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index b4c4a2e45e31..27e2326ac63a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -67,6 +67,14 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function handles overlapping copy regions', function test( t ) { + var expected; + var actual; + var x; + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); @@ -132,6 +140,51 @@ tape( 'the function supports providing negative strides', function test( t ) { t.end(); }); +tape( 'the function supports a reversed source range (start > end)', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `start` equals `end`', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a stride of zero', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', function test( t ) { var expected; var actual; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index c1c200e47422..3c29f5858f3f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -99,7 +99,7 @@ tape( 'the function supports providing an offset parameter', opts, function test actual = dcopyWithin( 4, 3, 0, 2, x, 1, 1 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -114,7 +114,7 @@ tape( 'the function supports providing a stride parameter', opts, function test( actual = dcopyWithin( 2, 0, 1, 4, x, 2, 0 ); - t.strictEqual( actual, x, 'returns input array' ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); @@ -143,6 +143,51 @@ tape( 'the function supports providing negative strides', opts, function test( t t.end(); }); +tape( 'the function supports a reversed source range (start > end)', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the strided array unchanged if `start` equals `end`', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a stride of zero', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', opts, function test( t ) { var expected; var actual; From 8361acf13eaaa748f7dae6131bd40ec0751fb607 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Thu, 12 Mar 2026 03:04:18 +0500 Subject: [PATCH 13/26] 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: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - 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 --- --- .../blas/ext/base/dcopy-within/README.md | 4 ++-- .../base/dcopy-within/benchmark/benchmark.js | 2 +- .../benchmark/benchmark.native.js | 2 +- .../benchmark/benchmark.ndarray.js | 2 +- .../benchmark/benchmark.ndarray.native.js | 2 +- .../benchmark/c/benchmark.length.c | 8 +++++-- .../blas/ext/base/dcopy-within/docs/repl.txt | 2 +- .../ext/base/dcopy-within/docs/types/test.ts | 1 + .../ext/base/dcopy-within/lib/dcopy_within.js | 3 --- .../dcopy-within/test/test.dcopy_within.js | 13 ++++------ .../test/test.dcopy_within.native.js | 24 +++++++------------ .../base/dcopy-within/test/test.ndarray.js | 9 +------ .../dcopy-within/test/test.ndarray.native.js | 1 + 13 files changed, 30 insertions(+), 43 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 1827ea68ed8c..48186a3159b9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -18,7 +18,7 @@ limitations under the License. --> -# dcopy-within +# dcopyWithin > Perform an in-place copy of elements within a double-precision floating-point array. @@ -142,7 +142,7 @@ console.log( x ); dcopyWithin( 10, 5, 0, 3, x, 1 ); console.log( x ); -// Copy every other element starting from the second element: +// Copy elements starting from source index 1 to target index 0: dcopyWithin( 5, 0, 1, 9, x, 1 ); console.log( x ); ``` diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js index a98fd6917f73..e69d448eb48f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js @@ -61,7 +61,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len-1, x, 1 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js index e745cfe22047..11ccf89c6851 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js @@ -66,7 +66,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len-1, x, 1 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js index 63cef9350618..b2f74bf75844 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js @@ -61,7 +61,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len-1, x, 1, 0 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1, 0 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js index b65c018c1cd3..7de1a096a52d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js @@ -66,7 +66,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len-1, x, 1, 0 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1, 0 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index ea6ff61c7242..4eed9d9d907b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -98,10 +98,11 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double t; int i; + x = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; } @@ -118,6 +119,7 @@ static double benchmark1( int iterations, int len ) { if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -130,10 +132,11 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x; double t; int i; + x = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; } @@ -150,6 +153,7 @@ static double benchmark2( int iterations, int len ) { if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index 5ee40b987c36..9ac34d8d39cf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}( N, target, start, end, x, strideX ) Performs an in-place copy of elements within a double-precision - floating-point strided array. + floating-point array. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts index 4a440a319402..299cf267377a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts @@ -105,6 +105,7 @@ import dcopyWithin = require( './index' ); dcopyWithin( 3, 3, 1, 2, x, true ); // $ExpectError dcopyWithin( 3, 3, 1, 2, x, false ); // $ExpectError dcopyWithin( 3, 3, 1, 2, x, null ); // $ExpectError + dcopyWithin( 3, 3, 1, 2, x, undefined ); // $ExpectError dcopyWithin( 3, 3, 1, 2, x, [] ); // $ExpectError dcopyWithin( 3, 3, 1, 2, x, {} ); // $ExpectError dcopyWithin( 3, 3, 1, 2, x, ( x: number ): number => x ); // $ExpectError diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index a910abc2ea68..13b0e1506bf5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -46,9 +46,6 @@ var ndarray = require( './ndarray.js' ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX ) { - if ( N <= 0 ) { - return x; - } return ndarray( N, target, start, end, x, strideX, stride2offset( N, strideX ) ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index 7802c2e7ea08..ff7fefa0480a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -55,7 +55,10 @@ tape( 'the function copies values within the provided double-precision floating- expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -67,14 +70,7 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles overlapping copy regions', function test( t ) { - var expected; - var actual; - var x; - + // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); @@ -82,6 +78,7 @@ tape( 'the function handles overlapping copy regions', function test( t ) { t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 8c930e9727ca..13c9368a0cb6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -49,21 +49,6 @@ tape( 'the function has an arity of 6', opts, function test( t ) { t.end(); }); -tape( 'the function handles overlapping copy regions', opts, function test( t ) { - var expected; - var actual; - var x; - - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - - actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); - - t.strictEqual( actual, x, 'returns expected value' ); - t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - tape( 'the function copies values within the provided double-precision floating-point strided array', opts, function test( t ) { var expected; var actual; @@ -88,6 +73,15 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + // Supports overlapping copy regions: + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); + + actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 27e2326ac63a..530005a79673 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -67,14 +67,7 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles overlapping copy regions', function test( t ) { - var expected; - var actual; - var x; - + // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index 3c29f5858f3f..93beb6c9b301 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -78,6 +78,7 @@ tape( 'the function copies values within the provided double-precision floating- t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); From bac137e16245c8dc0ffc1f05431f60def0e68c96 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Wed, 22 Jul 2026 00:21:14 +0500 Subject: [PATCH 14/26] 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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: 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: 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: na - task: lint_license_headers status: passed --- --- .../blas/ext/base/dcopy-within/README.md | 29 +++-- .../benchmark/c/benchmark.length.c | 4 +- .../blas/ext/base/dcopy-within/docs/repl.txt | 22 ++-- .../ext/base/dcopy-within/examples/index.js | 4 - .../stdlib/blas/ext/base/dcopy_within.h | 4 +- .../ext/base/dcopy-within/lib/dcopy_within.js | 6 +- .../dcopy-within/lib/dcopy_within.native.js | 8 +- .../blas/ext/base/dcopy-within/lib/ndarray.js | 50 +++------ .../base/dcopy-within/lib/ndarray.native.js | 8 +- .../blas/ext/base/dcopy-within/manifest.json | 14 +-- .../blas/ext/base/dcopy-within/src/addon.c | 8 +- .../blas/ext/base/dcopy-within/src/main.c | 67 ++++------- .../dcopy-within/test/test.dcopy_within.js | 99 ++++++++++------- .../test/test.dcopy_within.native.js | 93 ++++++++++------ .../base/dcopy-within/test/test.ndarray.js | 104 +++++++++++------- .../dcopy-within/test/test.ndarray.native.js | 104 +++++++++++------- 16 files changed, 325 insertions(+), 299 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 48186a3159b9..905a2e496cc4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -60,7 +60,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 5.0, 0.0, 7.0, 0.0 ] ); dcopyWithin( 3, 0, 1, 6, x, 2 ); -// x => [ 3.0, 0.0, 5.0, 0.0, 7.0, 0.0, 7.0, 0.0 ] +// x => [ 3.0, 0.0, 5.0, 0.0, 5.0, 0.0, 7.0, 0.0 ] ``` Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. @@ -75,8 +75,8 @@ var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element // Copy within the view... -dcopyWithin( 3, 0, 2, 5, x1, 1 ); -// x0 => [ 1.0, 4.0, 5.0, 6.0, 5.0, 6.0, 7.0, 8.0 ] +dcopyWithin( 6, 0, 3, 6, x1, 1 ); +// x0 => [ 1.0, 5.0, 6.0, 7.0, 5.0, 6.0, 7.0, 8.0 ] ``` #### dcopyWithin.ndarray( N, target, start, end, x, strideX, offsetX ) @@ -96,15 +96,15 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to copy elements starting from the second element: +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to copy elements starting from the third element: ```javascript var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -dcopyWithin.ndarray( 3, 2, 0, 3, x, 1, 2 ); -// x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 5.0, 8.0 ] +dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 2 ); +// x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 7.0, 8.0 ] ``` @@ -117,6 +117,7 @@ dcopyWithin.ndarray( 3, 2, 0, 3, x, 1, 2 ); - If `N <= 0`, both functions return the strided array unchanged. - If `target >= N`, both functions return the strided array unchanged. +- If `start >= end`, both functions return the strided array unchanged. - Both functions **mutate** the provided input strided array. @@ -141,10 +142,6 @@ console.log( x ); // Copy the first 3 elements to positions 5, 6, 7: dcopyWithin( 10, 5, 0, 3, x, 1 ); console.log( x ); - -// Copy elements starting from source index 1 to target index 0: -dcopyWithin( 5, 0, 1, 9, x, 1 ); -console.log( x ); ``` @@ -177,7 +174,7 @@ console.log( x ); #include "stdlib/blas/ext/base/dcopy_within.h" ``` -#### stdlib_strided_dcopy_within( N, target, start, end, \*x, strideX ) +#### stdlib_strided_dcopy_within( N, target, start, end, \*X, strideX ) Performs an in-place copy of elements within a double-precision floating-point array. @@ -193,16 +190,16 @@ The function accepts the following arguments: - **target**: `[in] CBLAS_INT` target index. - **start**: `[in] CBLAS_INT` source start index. - **end**: `[in] CBLAS_INT` source end index. -- **x**: `[inout] double*` input array. +- **X**: `[inout] double*` input array. - **strideX**: `[in] CBLAS_INT` stride length. ```c -void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX ); +void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX ); ``` -### stdlib_strided_dcopy_within_ndarray( N, target, start, end, \*x, strideX, offsetX ) +### stdlib_strided_dcopy_within_ndarray( N, target, start, end, \*X, strideX, offsetX ) @@ -220,12 +217,12 @@ The function accepts the following arguments: - **target**: `[in] CBLAS_INT` target index. - **start**: `[in] CBLAS_INT` source start index. - **end**: `[in] CBLAS_INT` source end index. -- **x**: `[inout] double*` input array. +- **X**: `[inout] double*` input array. - **strideX**: `[in] CBLAS_INT` stride length. - **offsetX**: `[in] CBLAS_INT` starting index. ```c -void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); ``` diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index 4eed9d9d907b..649e0cd535bf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -109,7 +109,7 @@ static double benchmark1( int iterations, int len ) { t = tic(); for ( i = 0; i < iterations; i++ ) { // cppcheck-suppress uninitvar - API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, 0, len-1, x, 1 ); + API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, 0, len - 1, x, 1 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; @@ -143,7 +143,7 @@ static double benchmark2( int iterations, int len ) { t = tic(); for ( i = 0; i < iterations; i++ ) { // cppcheck-suppress uninitvar - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, 0, len-1, x, 1, 0 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, 0, len - 1, x, 1, 0 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index 9ac34d8d39cf..fde19140fe3a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}( N, target, start, end, x, strideX ) - Performs an in-place copy of elements within a double-precision - floating-point array. + Performs an in-place copy of elements within a double-precision floating- + point array. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. @@ -12,6 +12,8 @@ If `target >= N`, the function returns the strided array unchanged. + If `start >= end`, the function returns the strided array unchanged. + Parameters ---------- N: integer @@ -41,26 +43,26 @@ -------- // Standard Usage: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}( 3, 2, 1, 2, x, 1 ) - [ 1.0, 2.0, 2.0, 4.0, 5.0, 6.0 ] + > {{alias}}( 6, 3, 1, 4, x, 1 ) + [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] // Using `N` and stride parameters: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); > {{alias}}( 3, 0, 1, 6, x, 2 ) - [ 3.0, 2.0, 5.0, 4.0, 7.0, 6.0, 7.0, 8.0 ] + [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > {{alias}}( 2, 0, 2, 5, x1, 1 ) + > {{alias}}( 4, 0, 2, 4, x1, 1 ) [ 4.0, 5.0, 4.0, 5.0, 6.0 ] > x0 [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] {{alias}}.ndarray( N, target, start, end, x, strideX, offsetX ) - Performs an in-place copy of elements within a double-precision - floating-point strided array using alternative indexing semantics. + Performs an in-place copy of elements within a double-precision floating- + point array using alternative indexing semantics. While typed array views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a @@ -103,8 +105,8 @@ // Using an index offset: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 4, 3, 0, 1, x, 1, 2 ) - [ 1.0, 2.0, 3.0, 4.0, 5.0, 3.0 ] + > {{alias}}.ndarray( 3, 1, 0, 2, x, 1, 2 ) + [ 1.0, 2.0, 3.0, 3.0, 4.0, 6.0 ] See Also -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js index d7b0ae25acbe..2b3b7493843d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -29,7 +29,3 @@ console.log( x ); // Copy the first 3 elements to positions 5, 6, 7: dcopyWithin( 10, 5, 0, 3, x, 1 ); console.log( x ); - -// Copy elements starting from index 1 to position 0: -dcopyWithin( 5, 0, 1, 9, x, 1 ); -console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h index 5a73683fbcea..8e22a5534331 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h @@ -31,12 +31,12 @@ extern "C" { /** * Performs an in-place copy of elements within a double-precision floating-point array. */ -void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX ); +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX ); /** * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. */ -void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index 13b0e1506bf5..4ac44db76230 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -30,9 +30,9 @@ var ndarray = require( './ndarray.js' ); * Performs an in-place copy of elements within a double-precision floating-point array. * * @param {PositiveInteger} N - number of indexed elements -* @param {integer} target - target index -* @param {integer} start - source start index -* @param {integer} end - source end index +* @param {NonNegativeInteger} target - target index +* @param {NonNegativeInteger} start - source start index +* @param {NonNegativeInteger} end - source end index * @param {Float64Array} x - input array * @param {integer} strideX - stride length * @returns {Float64Array} input array diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index e5197af2be1a..8872690f0274 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -30,9 +30,9 @@ var addon = require( './../src/addon.node' ); * * @private * @param {PositiveInteger} N - number of indexed elements -* @param {integer} target - target index -* @param {integer} start - source start index -* @param {integer} end - source end index +* @param {NonNegativeInteger} target - target index +* @param {NonNegativeInteger} start - source start index +* @param {NonNegativeInteger} end - source end index * @param {Float64Array} x - input array * @param {integer} strideX - stride length * @returns {Float64Array} input array @@ -42,7 +42,7 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 6, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index eb347abef3b9..544830be0f4a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -21,8 +21,6 @@ // MODULES // var min = require( '@stdlib/math/base/special/min' ); -var max = require( '@stdlib/math/base/special/max' ); -var abs = require( '@stdlib/math/base/special/abs' ); var Float64Array = require( '@stdlib/array/float64' ); var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; @@ -33,9 +31,9 @@ var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; * Performs an in-place copy of elements within a double-precision floating-point array. * * @param {PositiveInteger} N - number of indexed elements -* @param {integer} target - target index -* @param {integer} start - source start index -* @param {integer} end - source end index +* @param {NonNegativeInteger} target - target index +* @param {NonNegativeInteger} start - source start index +* @param {NonNegativeInteger} end - source end index * @param {Float64Array} x - input array * @param {integer} strideX - stride length * @param {NonNegativeInteger} offsetX - starting index @@ -50,53 +48,31 @@ var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { - var flg; - var tei; - var sei; - var tsi; - var ssi; var tmp; + var ssi; + var tsi; var cl; - if ( N <= 0 ) { + if ( N <= 0 || strideX === 0 || target >= N ) { return x; } - if ( target >= N ) { - return x; - } - - flg = false; - - // Resolve copy length: - cl = min( abs( end - start ), N ); + // Resolve the number of elements to copy: + cl = min( min( end, N ) - start, N - target ); if ( cl <= 0 ) { return x; } - - // Calculate source and target indices: + // Resolve the starting source and target indices... ssi = offsetX + ( start * strideX ); - sei = ssi + ( ( cl - 1 ) * strideX ); tsi = offsetX + ( target * strideX ); - tei = tsi + ( ( cl - 1 ) * strideX ); - - // Check if source and target regions overlap: - if ( - !( max( ssi, sei ) < min( tsi, tei ) || - max( tsi, tei ) < min( ssi, sei ) ) - ) { - flg = true; - } - if ( flg ) { - // Create a temporary copy of source elements: + // When the source and target index ranges overlap, copying directly could overwrite source elements before they are read, and, thus, we first copy the source elements to a temporary array: + if ( start < target + cl && target < start + cl ) { tmp = new Float64Array( cl ); dcopy( cl, x, strideX, ssi, tmp, 1, 0 ); - - // Copy from temporary array to target position: dcopy( cl, tmp, 1, 0, x, strideX, tsi ); - } else { - dcopy( cl, x, strideX, ssi, x, strideX, tsi ); + return x; } + dcopy( cl, x, strideX, ssi, x, strideX, tsi ); return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index 3a6f230c8746..eaf5a15fb819 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -30,9 +30,9 @@ var addon = require( './../src/addon.node' ); * * @private * @param {PositiveInteger} N - number of indexed elements -* @param {integer} target - target index -* @param {integer} start - source start index -* @param {integer} end - source end index +* @param {NonNegativeInteger} target - target index +* @param {NonNegativeInteger} start - source start index +* @param {NonNegativeInteger} end - source end index * @param {Float64Array} x - input array * @param {integer} strideX - stride length * @param {NonNegativeInteger} offsetX - starting index @@ -43,7 +43,7 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); * -* dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json index bd71aa12bb4f..62ddb130850e 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/manifest.json @@ -41,8 +41,6 @@ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/max", - "@stdlib/math/base/special/min", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", @@ -63,9 +61,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", - "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/max", - "@stdlib/math/base/special/min" + "@stdlib/strided/base/stride2offset" ] }, { @@ -82,9 +78,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", - "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/max", - "@stdlib/math/base/special/min" + "@stdlib/strided/base/stride2offset" ] }, { @@ -101,9 +95,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/blas/base/dcopy", - "@stdlib/strided/base/stride2offset", - "@stdlib/math/base/special/max", - "@stdlib/math/base/special/min" + "@stdlib/strided/base/stride2offset" ] } ] diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c index a32b3f1fc681..cc21a847440d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c @@ -38,8 +38,8 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, start, argv, 2 ); STDLIB_NAPI_ARGV_INT64( env, end, argv, 3 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); - STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 4 ); - API_SUFFIX(stdlib_strided_dcopy_within)( N, target, start, end, x, strideX ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); + API_SUFFIX(stdlib_strided_dcopy_within)( N, target, start, end, X, strideX ); return NULL; } @@ -58,8 +58,8 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, end, argv, 3 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 6 ); - STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, x, N, strideX, argv, 4 ); - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, x, strideX, offsetX ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, X, strideX, offsetX ); return NULL; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index b6348c9f3530..314eac7960ec 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -20,9 +20,6 @@ #include "stdlib/blas/base/shared.h" #include "stdlib/blas/base/dcopy.h" #include "stdlib/strided/base/stride2offset.h" -#include "stdlib/math/base/special/max.h" -#include "stdlib/math/base/special/min.h" -#include #include /** @@ -32,12 +29,12 @@ * @param target target index * @param start source start index * @param end source end index -* @param x input array +* @param X input array * @param strideX stride length */ -void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX ) { +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX ) { CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, x, strideX, ox ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, X, strideX, ox ); } /** @@ -47,68 +44,42 @@ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT * @param target target index * @param start source start index * @param end source end index -* @param x input array +* @param X input array * @param strideX stride length * @param offsetX starting index */ -void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { CBLAS_INT ssi; - CBLAS_INT sei; CBLAS_INT tsi; - CBLAS_INT tei; CBLAS_INT cl; double *tmp; - bool flg; - if ( N <= 0 ) { + if ( N <= 0 || strideX == 0 || target >= N ) { return; } - if ( target >= N ) { - return; - } - - flg = false; - - // Resolve copy length: - cl = end - start; - if ( cl < 0 ) { - cl = -cl; - } - if ( cl > N ) { - cl = N; + // Resolve the number of elements to copy: + cl = ( ( end < N ) ? end : N ) - start; + if ( cl > N - target ) { + cl = N - target; } if ( cl <= 0 ) { return; } - - // Calculate source and target indices: + // Resolve the starting source and target indices... ssi = offsetX + ( start * strideX ); - sei = ssi + ( ( cl - 1 ) * strideX ); tsi = offsetX + ( target * strideX ); - tei = tsi + ( ( cl - 1 ) * strideX ); - // Check if source and target regions overlap: - if ( - !( stdlib_base_max( ssi, sei ) < stdlib_base_min( tsi, tei ) || - stdlib_base_max( tsi, tei ) < stdlib_base_min( ssi, sei ) ) - ) { - flg = true; - } - - if ( flg ) { - // Create a temporary copy of source elements: - tmp = (double *)malloc( cl * sizeof(double) ); + // When the source and target index ranges overlap, copying directly could overwrite source elements before they are read, and, thus, we first copy the source elements to a temporary array: + if ( start < target + cl && target < start + cl ) { + tmp = (double *)malloc( cl * sizeof( double ) ); if ( tmp == NULL ) { return; } - c_dcopy_ndarray( cl, x, strideX, ssi, tmp, 1, 0 ); - - // Copy from temporary array to target position: - c_dcopy_ndarray( cl, tmp, 1, 0, x, strideX, tsi ); - - // Clean up memory: + API_SUFFIX(c_dcopy_ndarray)( cl, X, strideX, ssi, tmp, 1, 0 ); + API_SUFFIX(c_dcopy_ndarray)( cl, tmp, 1, 0, X, strideX, tsi ); free( tmp ); - } else { - c_dcopy_ndarray( cl, x, strideX, ssi, x, strideX, tsi ); + return; } + API_SUFFIX(c_dcopy_ndarray)( cl, X, strideX, ssi, X, strideX, tsi ); + return; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index ff7fefa0480a..dcbc1e6747d6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -52,29 +52,17 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); - t.strictEqual( actual, x, 'returns expected value' ); - t.deepEqual( x, expected, 'returns expected value' ); - - actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); - t.strictEqual( actual, x, 'returns expected value' ); - t.deepEqual( x, expected, 'returns expected value' ); - - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -82,38 +70,43 @@ tape( 'the function copies values within the provided double-precision floating- t.end(); }); -tape( 'the function supports providing a stride parameter', function test( t ) { +tape( 'if provided `target` parameter is greater than or equal to the `N` parameter, the function returns the strided array unchanged', function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 2, 0, 1, 4, x, 2 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports providing negative strides', function test( t ) { +tape( 'if provided `N` parameter is less than or equal to `0`, the function returns the strided array unchanged', function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - - actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -121,68 +114,94 @@ tape( 'the function supports providing negative strides', function test( t ) { t.end(); }); -tape( 'the function supports a reversed source range (start > end)', function test( t ) { +tape( 'if provided `start` parameter is greater than or equal to the `end` parameter, the function returns the strided array unchanged', function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 6, 0, 3, 1, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns the strided array unchanged if `start` equals `end`', function test( t ) { +tape( 'if provided `end` parameter is greater than the number of indexed elements, the function copies elements up to the last indexed element', function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports a stride of zero', function test( t ) { +tape( 'the function supports providing a stride parameter', function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', function test( t ) { +tape( 'the function supports providing negative strides', function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); + +tape( 'the function supports a stride of zero', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 13c9368a0cb6..7ae59e6c55f1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -63,21 +63,17 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); - t.strictEqual( actual, x, 'returns expected value' ); - t.deepEqual( x, expected, 'returns expected value' ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1 ); - actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 0, 3, x, 1 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -85,38 +81,43 @@ tape( 'the function copies values within the provided double-precision floating- t.end(); }); -tape( 'the function supports providing a stride parameter', opts, function test( t ) { +tape( 'if provided `target` parameter is greater than or equal to the `N` parameter, the function returns the strided array unchanged', opts, function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 2, 0, 1, 4, x, 2 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports providing negative strides', opts, function test( t ) { +tape( 'if provided `N` parameter is less than or equal to `0`, the function returns the strided array unchanged', opts, function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - - actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -124,66 +125,94 @@ tape( 'the function supports providing negative strides', opts, function test( t t.end(); }); -tape( 'the function supports a reversed source range (start > end)', opts, function test( t ) { +tape( 'if provided `start` parameter is greater than or equal to the `end` parameter, the function returns the strided array unchanged', opts, function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); actual = dcopyWithin( 6, 0, 3, 1, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns the strided array unchanged if `start` equals `end`', opts, function test( t ) { +tape( 'if provided `end` parameter is greater than the number of indexed elements, the function copies elements up to the last indexed element', opts, function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports a stride of zero', opts, function test( t ) { +tape( 'the function supports providing a stride parameter', opts, function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', opts, function test( t ) { +tape( 'the function supports providing negative strides', opts, function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); + t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); + +tape( 'the function supports a stride of zero', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 530005a79673..6bed43043c69 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -52,26 +52,17 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); - - t.strictEqual( actual, x, 'returns expected value' ); - t.deepEqual( x, expected, 'returns expected value' ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -79,106 +70,128 @@ tape( 'the function copies values within the provided double-precision floating- t.end(); }); -tape( 'the function supports providing an offset parameter', function test( t ) { +tape( 'if provided `target` parameter is greater than or equal to the `N` parameter, the function returns the strided array unchanged', function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 4, 3, 0, 2, x, 1, 1 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1, 0 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports providing a stride parameter', function test( t ) { +tape( 'if provided `N` parameter is less than or equal to `0`, the function returns the strided array unchanged', function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); - actual = dcopyWithin( 2, 0, 1, 4, x, 2, 0 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports providing negative strides', function test( t ) { +tape( 'if provided `start` parameter is greater than or equal to the `end` parameter, the function returns the strided array unchanged', function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); + actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); + actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); }); -tape( 'the function supports a reversed source range (start > end)', function test( t ) { +tape( 'if provided `end` parameter is greater than the number of indexed elements, the function copies elements up to the last indexed element', function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns the strided array unchanged if `start` equals `end`', function test( t ) { +tape( 'the function supports providing a stride parameter', function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports a stride of zero', function test( t ) { +tape( 'the function supports providing negative strides', function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', function test( t ) { +tape( 'the function supports a stride of zero', function test( t ) { var expected; var actual; var x; @@ -186,15 +199,24 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); - actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); +tape( 'the function supports providing an offset parameter', function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ); + + actual = dcopyWithin( 4, 2, 0, 2, x, 1, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index 93beb6c9b301..2e93ee7d8f33 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -63,26 +63,17 @@ tape( 'the function copies values within the provided double-precision floating- t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); - - t.strictEqual( actual, x, 'returns expected value' ); - t.deepEqual( x, expected, 'returns expected value' ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - // Supports overlapping copy regions: x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 3, 2, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -90,106 +81,128 @@ tape( 'the function copies values within the provided double-precision floating- t.end(); }); -tape( 'the function supports providing an offset parameter', opts, function test( t ) { +tape( 'if provided `target` parameter is greater than or equal to the `N` parameter, the function returns the strided array unchanged', opts, function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 3.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 4, 3, 0, 2, x, 1, 1 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1, 0 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports providing a stride parameter', opts, function test( t ) { +tape( 'if provided `N` parameter is less than or equal to `0`, the function returns the strided array unchanged', opts, function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); - actual = dcopyWithin( 2, 0, 1, 4, x, 2, 0 ); + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports providing negative strides', opts, function test( t ) { +tape( 'if provided `start` parameter is greater than or equal to the `end` parameter, the function returns the strided array unchanged', opts, function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); + actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); + actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); }); -tape( 'the function supports a reversed source range (start > end)', opts, function test( t ) { +tape( 'if provided `end` parameter is greater than the number of indexed elements, the function copies elements up to the last indexed element', opts, function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 4.0, 5.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function returns the strided array unchanged if `start` equals `end`', opts, function test( t ) { +tape( 'the function supports providing a stride parameter', opts, function test( t ) { var expected; var actual; var x; - x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports a stride of zero', opts, function test( t ) { +tape( 'the function supports providing negative strides', opts, function test( t ) { var expected; var actual; var x; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); + + actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function returns the strided array unchanged if `N` is less than or equal to `0`', opts, function test( t ) { +tape( 'the function supports a stride of zero', opts, function test( t ) { var expected; var actual; var x; @@ -197,15 +210,24 @@ tape( 'the function returns the strided array unchanged if `N` is less than or e x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); - actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); +tape( 'the function supports providing an offset parameter', opts, function test( t ) { + var expected; + var actual; + var x; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ); + + actual = dcopyWithin( 4, 2, 0, 2, x, 1, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - t.end(); }); From 606115f85fbd4f79dd1a468602d3908b5184f1b7 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 2 Aug 2026 14:53:35 +0500 Subject: [PATCH 15/26] 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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 --- --- .../blas/ext/base/dcopy-within/README.md | 85 ++-- .../base/dcopy-within/benchmark/benchmark.js | 9 +- .../benchmark/benchmark.native.js | 9 +- .../benchmark/benchmark.ndarray.js | 9 +- .../benchmark/benchmark.ndarray.native.js | 9 +- .../benchmark/c/benchmark.length.c | 18 +- .../blas/ext/base/dcopy-within/docs/repl.txt | 61 ++- .../base/dcopy-within/docs/types/index.d.ts | 61 ++- .../ext/base/dcopy-within/docs/types/test.ts | 391 +++++++++++------- .../base/dcopy-within/examples/c/example.c | 8 +- .../ext/base/dcopy-within/examples/index.js | 5 +- .../stdlib/blas/ext/base/dcopy_within.h | 4 +- .../ext/base/dcopy-within/lib/dcopy_within.js | 21 +- .../dcopy-within/lib/dcopy_within.native.js | 15 +- .../blas/ext/base/dcopy-within/lib/index.js | 6 +- .../blas/ext/base/dcopy-within/lib/ndarray.js | 33 +- .../base/dcopy-within/lib/ndarray.native.js | 18 +- .../blas/ext/base/dcopy-within/src/addon.c | 13 +- .../blas/ext/base/dcopy-within/src/main.c | 43 +- .../dcopy-within/test/test.dcopy_within.js | 124 +++++- .../test/test.dcopy_within.native.js | 124 +++++- .../base/dcopy-within/test/test.ndarray.js | 115 +++++- .../dcopy-within/test/test.ndarray.native.js | 115 +++++- 23 files changed, 923 insertions(+), 373 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 905a2e496cc4..f117a4bc7191 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -30,7 +30,7 @@ limitations under the License. var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); ``` -#### dcopyWithin( N, target, start, end, x, strideX ) +#### dcopyWithin( N, target, start, end, x, strideX, workspace, strideW ) Performs an in-place copy of elements within a double-precision floating-point array. @@ -38,8 +38,9 @@ Performs an in-place copy of elements within a double-precision floating-point a var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var w = new Float64Array( x.length ); -dcopyWithin( x.length, 3, 1, 4, x, 1 ); +dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ``` @@ -47,10 +48,12 @@ The function has the following parameters: - **N**: number of indexed elements. - **target**: target index. -- **start**: source start index. -- **end**: source end index. +- **start**: source start index (inclusive). +- **end**: source end index (exclusive). - **x**: input [`Float64Array`][@stdlib/array/float64]. -- **strideX**: stride length. +- **strideX**: stride length for `x`. +- **workspace**: workspace [`Float64Array`][@stdlib/array/float64]. Must have at least `N` indexed elements. +- **strideW**: stride length for `workspace`. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to copy every other element: @@ -58,8 +61,9 @@ The `N` and stride parameters determine which elements in the strided array are var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 5.0, 0.0, 7.0, 0.0 ] ); +var w = new Float64Array( 3 ); -dcopyWithin( 3, 0, 1, 6, x, 2 ); +dcopyWithin( 3, 0, 1, 6, x, 2, w, 1 ); // x => [ 3.0, 0.0, 5.0, 0.0, 5.0, 0.0, 7.0, 0.0 ] ``` @@ -74,12 +78,17 @@ var x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); // Create an offset view... var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +// Create a workspace array... +var w = new Float64Array( 6 ); + // Copy within the view... -dcopyWithin( 6, 0, 3, 6, x1, 1 ); +dcopyWithin( 6, 0, 3, 6, x1, 1, w, 1 ); // x0 => [ 1.0, 5.0, 6.0, 7.0, 5.0, 6.0, 7.0, 8.0 ] ``` -#### dcopyWithin.ndarray( N, target, start, end, x, strideX, offsetX ) + + +#### dcopyWithin.ndarray( N, target, start, end, x, strideX, offsetX, workspace, strideW, offsetW ) Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. @@ -87,23 +96,26 @@ Performs an in-place copy of elements within a double-precision floating-point a var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var w = new Float64Array( x.length ); -dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); +dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ``` The function has the following additional parameters: - **offsetX**: starting index for `x`. +- **offsetW**: starting index for `workspace`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to copy elements starting from the third element: +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 copy elements starting from the third element: ```javascript var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var w = new Float64Array( 4 ); -dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 2 ); +dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 2, w, 1, 0 ); // x => [ 1.0, 2.0, 3.0, 4.0, 3.0, 4.0, 7.0, 8.0 ] ``` @@ -118,6 +130,7 @@ dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 2 ); - If `N <= 0`, both functions return the strided array unchanged. - If `target >= N`, both functions return the strided array unchanged. - If `start >= end`, both functions return the strided array unchanged. +- If the `start` and `target` index ranges do not overlap, the `workspace` array is unused and thus ignored. - Both functions **mutate** the provided input strided array. @@ -132,6 +145,7 @@ dcopyWithin.ndarray( 4, 2, 0, 2, x, 1, 2 ); ```javascript var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); var x = discreteUniform( 10, 0, 500, { @@ -139,8 +153,10 @@ var x = discreteUniform( 10, 0, 500, { }); console.log( x ); +var w = zeros( 10, 'float64' ); + // Copy the first 3 elements to positions 5, 6, 7: -dcopyWithin( 10, 5, 0, 3, x, 1 ); +dcopyWithin( 10, 5, 0, 3, x, 1, w, 1 ); console.log( x ); ``` @@ -174,55 +190,58 @@ console.log( x ); #include "stdlib/blas/ext/base/dcopy_within.h" ``` -#### stdlib_strided_dcopy_within( N, target, start, end, \*X, strideX ) +#### stdlib_strided_dcopy_within( N, target, start, end, \*X, strideX, \*W, strideW ) Performs an in-place copy of elements within a double-precision floating-point array. ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; +double w[ 6 ]; -stdlib_strided_dcopy_within( 6, 3, 1, 4, x, 1 ); +stdlib_strided_dcopy_within( 6, 3, 1, 4, x, 1, w, 1 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **target**: `[in] CBLAS_INT` target index. -- **start**: `[in] CBLAS_INT` source start index. -- **end**: `[in] CBLAS_INT` source end index. +- **start**: `[in] CBLAS_INT` source start index (inclusive). +- **end**: `[in] CBLAS_INT` source end index (exclusive). - **X**: `[inout] double*` input array. -- **strideX**: `[in] CBLAS_INT` stride length. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **W**: `[out] double*` workspace array. Must have at least `N` indexed elements. +- **strideW**: `[in] CBLAS_INT` stride length for `W`. ```c -void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX ); +void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, double *W, const CBLAS_INT strideW ); ``` - - -### stdlib_strided_dcopy_within_ndarray( N, target, start, end, \*X, strideX, offsetX ) - - +#### stdlib_strided_dcopy_within_ndarray( N, target, start, end, \*X, strideX, offsetX, \*W, strideW, offsetW ) Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; +double w[ 6 ]; -stdlib_strided_dcopy_within_ndarray( 4, 2, 0, 2, x, 1, 1 ); +stdlib_strided_dcopy_within_ndarray( 4, 2, 0, 2, x, 1, 1, w, 1, 0 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **target**: `[in] CBLAS_INT` target index. -- **start**: `[in] CBLAS_INT` source start index. -- **end**: `[in] CBLAS_INT` source end index. +- **start**: `[in] CBLAS_INT` source start index (inclusive). +- **end**: `[in] CBLAS_INT` source end index (exclusive). - **X**: `[inout] double*` input array. -- **strideX**: `[in] CBLAS_INT` stride length. -- **offsetX**: `[in] CBLAS_INT` starting index. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **W**: `[out] double*` workspace array. Must have at least `N` indexed elements. +- **strideW**: `[in] CBLAS_INT` stride length for `W`. +- **offsetW**: `[in] CBLAS_INT` starting index for `W`. ```c -void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void stdlib_strided_dcopy_within_ndarray( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *W, const CBLAS_INT strideW, const CBLAS_INT offsetW ); ``` @@ -251,14 +270,18 @@ int main( void ) { // Create a strided array: double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + // Create a workspace array: + double w[ 8 ]; + // Specify the number of elements to copy: const int N = 8; - // Specify a stride: + // Specify strides: const int strideX = 1; + const int strideW = 1; // Copy elements starting from index 1 to index 4: - stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX ); + stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX, w, strideW ); // Print the result: for ( int i = 0; i < 8; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js index e69d448eb48f..3fa4391dc3fd 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); @@ -46,7 +47,11 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x = uniform( len, -10.0, 10.0, options ); + var x; + var w; + + x = uniform( len, -10.0, 10.0, options ); + w = zeros( len, options.dtype ); return benchmark; /** @@ -61,7 +66,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len - 1, x, 1 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1, w, 1 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js index 11ccf89c6851..234f4911a289 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.native.js @@ -23,6 +23,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); @@ -51,7 +52,11 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x = uniform( len, -10.0, 10.0, options ); + var x; + var w; + + x = uniform( len, -10.0, 10.0, options ); + w = zeros( len, options.dtype ); return benchmark; /** @@ -66,7 +71,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len - 1, x, 1 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1, w, 1 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js index b2f74bf75844..2e59c4635389 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); @@ -46,7 +47,11 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x = uniform( len, -10.0, 10.0, options ); + var x; + var w; + + x = uniform( len, -10.0, 10.0, options ); + w = zeros( len, options.dtype ); return benchmark; /** @@ -61,7 +66,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len - 1, x, 1, 0 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1, 0, w, 1, 0 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js index 7de1a096a52d..47a8c681cb2f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.native.js @@ -23,6 +23,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); @@ -51,7 +52,11 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x = uniform( len, -10.0, 10.0, options ); + var x; + var w; + + x = uniform( len, -10.0, 10.0, options ); + w = zeros( len, options.dtype ); return benchmark; /** @@ -66,7 +71,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dcopyWithin( len, 0, 0, len - 1, x, 1, 0 ); + y = dcopyWithin( len, 0, 0, len - 1, x, 1, 0, w, 1, 0 ); if ( isnan( y[ i%y.length ] ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index 649e0cd535bf..493e8c0a2467 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -99,17 +99,19 @@ static double rand_double( void ) { static double benchmark1( int iterations, int len ) { double elapsed; double *x; + double *w; double t; int i; x = (double *)malloc( len * sizeof( double ) ); + w = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; + w[ i ] = 0.0; } t = tic(); for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, 0, len - 1, x, 1 ); + API_SUFFIX(stdlib_strided_dcopy_within)( len, 0, 0, len - 1, x, 1, w, 1 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; @@ -120,6 +122,7 @@ static double benchmark1( int iterations, int len ) { printf( "should not return NaN\n" ); } free( x ); + free( w ); return elapsed; } @@ -133,17 +136,19 @@ static double benchmark1( int iterations, int len ) { static double benchmark2( int iterations, int len ) { double elapsed; double *x; + double *w; double t; int i; x = (double *)malloc( len * sizeof( double ) ); + w = (double *)malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*200.0 ) - 100.0; + w[ i ] = 0.0; } t = tic(); for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, 0, len - 1, x, 1, 0 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( len, 0, 0, len - 1, x, 1, 0, w, 1, 0 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; @@ -154,6 +159,7 @@ static double benchmark2( int iterations, int len ) { printf( "should not return NaN\n" ); } free( x ); + free( w ); return elapsed; } @@ -183,13 +189,13 @@ int main( void ) { } for ( j = 0; j < REPEATS; j++ ) { count += 1; - printf( "# c::native::%s:len=%d\n", NAME, len ); + printf( "# c::%s:len=%d\n", NAME, len ); elapsed = benchmark1( iter, len ); print_results( "dcopy_within:len", elapsed ); printf( "ok %d benchmark finished\n", count ); count += 1; - printf( "# c::native::%s:ndarray:len=%d\n", NAME, len ); + printf( "# c::%s:ndarray:len=%d\n", NAME, len ); elapsed = benchmark2( iter, len ); print_results( "dcopy_within_ndarray:len", elapsed ); printf( "ok %d benchmark finished\n", count ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index fde19140fe3a..a6f5a4f43597 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -1,12 +1,13 @@ -{{alias}}( N, target, start, end, x, strideX ) + +{{alias}}( N, target, start, end, x, strideX, w, strideW ) Performs an in-place copy of elements within a double-precision floating- point array. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. - Indexing is relative to the first index. To introduce an offset, use typed - array views. + Indexing is relative to the first index. To introduce an offset, use a typed + array view. If `N <= 0`, the function returns the strided array unchanged. @@ -14,6 +15,9 @@ If `start >= end`, the function returns the strided array unchanged. + If the `start` and `target` index ranges do not overlap, the `workspace` + array is unused and thus ignored. + Parameters ---------- N: integer @@ -23,16 +27,22 @@ Target index. start: integer - Source start index. + Source start index (inclusive). end: integer - Source end index. + Source end index (exclusive). x: Float64Array Input array. strideX: integer - Stride length. + Stride length for `x`. + + w: Float64Array + Workspace array. Must have at least `N` indexed elements. + + strideW: integer + Stride length for `w`. Returns ------- @@ -43,30 +53,33 @@ -------- // Standard Usage: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}( 6, 3, 1, 4, x, 1 ) + > var w = new {{alias:@stdlib/array/float64}}( 6 ); + > {{alias}}( 6, 3, 1, 4, x, 1, w, 1 ) [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] // Using `N` and stride parameters: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - > {{alias}}( 3, 0, 1, 6, x, 2 ) + > w = new {{alias:@stdlib/array/float64}}( 3 ); + > {{alias}}( 3, 0, 1, 6, x, 2, w, 1 ) [ 3.0, 2.0, 5.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > {{alias}}( 4, 0, 2, 4, x1, 1 ) + > var w0 = new {{alias:@stdlib/array/float64}}( 4 ); + > {{alias}}( 4, 0, 2, 4, x1, 1, w0, 1 ) [ 4.0, 5.0, 4.0, 5.0, 6.0 ] > x0 [ 1.0, 4.0, 5.0, 4.0, 5.0, 6.0 ] -{{alias}}.ndarray( N, target, start, end, x, strideX, offsetX ) +{{alias}}.ndarray( N, target, start, end, x,strideX,offsetX, w,strideW,offsetW ) Performs an in-place copy of elements within a double-precision floating- point array using alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the offset parameter supports indexing semantics based on a - starting index. + buffer, the offset parameters support indexing semantics based on starting + indices. Parameters ---------- @@ -77,19 +90,28 @@ Target index. start: integer - Source start index. + Source start index (inclusive). end: integer - Source end index. + Source end index (exclusive). x: Float64Array Input array. strideX: integer - Stride length. + Stride length for `x`. offsetX: integer - Starting index. + Starting index for `x`. + + w: Float64Array + Workspace array. Must have at least `N` indexed elements. + + strideW: integer + Stride length for `w`. + + offsetW: integer + Starting index for `w`. Returns ------- @@ -100,13 +122,16 @@ -------- // Standard Usage: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 4, 2, 0, 2, x, 1, 1 ) + > var w = new {{alias:@stdlib/array/float64}}( 4 ); + > {{alias}}.ndarray( 4, 2, 0, 2, x, 1, 1, w, 1, 0 ) [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] // Using an index offset: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > {{alias}}.ndarray( 3, 1, 0, 2, x, 1, 2 ) + > w = new {{alias:@stdlib/array/float64}}( 3 ); + > {{alias}}.ndarray( 3, 1, 0, 2, x, 1, 2, w, 1, 0 ) [ 1.0, 2.0, 3.0, 3.0, 4.0, 6.0 ] See Also -------- + diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts index bcab4731ab31..dbe3336198b1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -25,72 +25,95 @@ interface Routine { /** * Performs an in-place copy of elements within a double-precision floating-point array. * + * ## Notes + * + * - If the `start` and `target` index ranges do not overlap, the `workspace` array is unused and thus ignored. + * * @param N - number of indexed elements * @param target - target index - * @param start - source start index - * @param end - source end index + * @param start - source start index (inclusive) + * @param end - source end index (exclusive) * @param x - input array - * @param strideX - stride length - * @returns input array + * @param strideX - stride length for `x` + * @param workspace - workspace array + * @param strideW - stride length for `workspace` + * @returns `x` * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var w = new Float64Array( x.length ); * - * dcopyWithin( x.length, 3, 1, 4, x, 1 ); + * dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ - ( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number ): Float64Array; + ( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, workspace: Float64Array, strideW: number ): Float64Array; /** * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. * + * ## Notes + * + * - If the `start` and `target` index ranges do not overlap, the `workspace` array is unused and thus ignored. + * * @param N - number of indexed elements * @param target - target index - * @param start - source start index - * @param end - source end index + * @param start - source start index (inclusive) + * @param end - source end index (exclusive) * @param x - input array - * @param strideX - stride length - * @param offsetX - starting index - * @returns input array + * @param strideX - stride length for `x` + * @param offsetX - starting index for `x` + * @param workspace - workspace array + * @param strideW - stride length for `workspace` + * @param offsetW - starting index for `workspace` + * @returns `x` * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var w = new Float64Array( x.length ); * - * dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); + * dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ - ndarray( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; + ndarray( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, offsetX: number, workspace: Float64Array, strideW: number, offsetW: number ): Float64Array; } /** * Performs an in-place copy of elements within a double-precision floating-point array. * +* ## Notes +* +* - If the `start` and `target` index ranges do not overlap, the `workspace` array is unused and thus ignored. +* * @param N - number of indexed elements * @param target - target index -* @param start - source start index -* @param end - source end index +* @param start - source start index (inclusive) +* @param end - source end index (exclusive) * @param x - input array -* @param strideX - stride length -* @returns input array +* @param strideX - stride length for `x` +* @param workspace - workspace array +* @param strideW - stride length for `workspace` +* @returns `x` * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin( x.length, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); +* dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ declare var dcopyWithin: Routine; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts index 299cf267377a..03151283db36 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/test.ts @@ -23,221 +23,322 @@ import dcopyWithin = require( './index' ); // The function returns a Float64Array... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); - dcopyWithin( 3, 3, 1, 2, x, 1 ); // $ExpectType Float64Array + dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); // $ExpectType Float64Array } // The compiler throws an error if the function is provided a first argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin( '3', 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( true, 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( false, 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( null, 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( undefined, 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( [], 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( {}, 3, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( ( x: number ): number => x, 3, 1, 2, x, 1 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( '3', 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( true, 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( false, 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( null, 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( undefined, 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( [], 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( {}, 3, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( ( x: number ): number => x, 3, 1, 2, x, 1, w, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin( 3, '3', 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, true, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, false, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, null, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, undefined, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, [], 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, {}, 1, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, ( x: number ): number => x, 1, 2, x, 1 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( x.length, '3', 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, true, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, false, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, null, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, undefined, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, [], 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, {}, 1, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, ( x: number ): number => x, 1, 2, x, 1, w, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin( 3, 3, '1', 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, true, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, false, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, null, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, undefined, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, [], 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, {}, 2, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, ( x: number ): number => x, 2, x, 1 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( x.length, 3, '1', 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, true, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, false, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, null, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, undefined, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, [], 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, {}, 2, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, ( x: number ): number => x, 2, x, 1, w, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a fourth argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin( 3, 3, 1, '2', x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, true, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, false, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, null, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, undefined, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, [], x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, {}, x, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, ( x: number ): number => x, x, 1 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( x.length, 3, 1, '2', x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, true, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, false, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, null, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, undefined, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, [], x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, {}, x, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, ( x: number ): number => x, x, 1, w, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... { - dcopyWithin( 3, 3, 1, 2, '3', 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, 3, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, true, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, false, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, null, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, undefined, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, [], 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, {}, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, ( x: number ): number => x, 1 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( x.length, 3, 1, 2, '5', 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, 5, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, true, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, false, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, null, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, undefined, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, [], 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, {}, 1, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, ( x: number ): number => x, 1, w, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a sixth argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( x.length, 3, 1, 2, x, '4', w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, true, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, false, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, null, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, undefined, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, [], w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, {}, w, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, ( x: number ): number => x, w, 1 ); // $ExpectError +} - dcopyWithin( 3, 3, 1, 2, x, '4' ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, true ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, false ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, null ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, undefined ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, [] ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, {} ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, ( x: number ): number => x ); // $ExpectError +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const x = new Float64Array( 10 ); + + dcopyWithin( x.length, 3, 1, 2, x, 1, '5', 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, 5, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, true, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, false, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, null, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, undefined, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, [], 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, {}, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin( x.length, 3, 1, 2, x, 1, w, '1' ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, true ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, false ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, null ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, undefined ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, [] ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, {} ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided insufficient arguments... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); dcopyWithin(); // $ExpectError - dcopyWithin( 3 ); // $ExpectError - dcopyWithin( 3, 3 ); // $ExpectError - dcopyWithin( 3, 3, 1 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2 ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x ); // $ExpectError - dcopyWithin( 3, 3, 1, 2, x, 1, {} ); // $ExpectError + dcopyWithin( x.length ); // $ExpectError + dcopyWithin( x.length, 3 ); // $ExpectError + dcopyWithin( x.length, 3, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w ); // $ExpectError + dcopyWithin( x.length, 3, 1, 2, x, 1, w, 1, {} ); // $ExpectError } // Attached to main export is an `ndarray` method which returns a Float64Array... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); - dcopyWithin.ndarray( 3, 3, 1, 2, x, 1, 1 ); // $ExpectType Float64Array + dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); // $ExpectType Float64Array } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin.ndarray( '2', 3, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( true, 3, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( false, 3, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( null, 3, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( undefined, 3, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( [], 2, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( {}, 2, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( ( x: number ): number => x, 2, 1, 2, x, 1, 0 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( '2', 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( true, 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( false, 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( null, 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( undefined, 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( [], 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( {}, 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( ( x: number ): number => x, 3, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin.ndarray( 2, '2', 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, true, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, false, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, null, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, undefined, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, [], 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, {}, 1, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, ( x: number ): number => x, 1, 2, x, 1, 0 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, '3', 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, true, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, false, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, null, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, undefined, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, [], 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, {}, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, ( x: number ): number => x, 1, 2, x, 1, 0, w, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin.ndarray( 2, 2, '1', 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, true, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, false, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, null, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, undefined, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, [], 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, {}, 2, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, ( x: number ): number => x, 2, x, 1, 0 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, '1', 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, true, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, false, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, null, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, undefined, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, [], 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, {}, 2, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, ( x: number ): number => x, 2, x, 1, 0, w, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin.ndarray( 2, 2, 1, '2', x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, true, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, false, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, null, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, undefined, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, [], x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, {}, x, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, ( x: number ): number => x, x, 1, 0 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, '2', x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, true, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, false, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, null, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, undefined, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, [], x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, {}, x, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, ( x: number ): number => x, x, 1, 0, w, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Float64Array... { - dcopyWithin.ndarray( 2, 2, 1, 2, '5', 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, 5, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, true, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, false, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, null, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, undefined, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, [], 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, {}, 1, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, ( x: number ): number => x, 1, 0 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, 2, '5', 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, 5, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, true, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, false, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, null, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, undefined, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, [], 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, {}, 1, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, ( x: number ): number => x, 1, 0, w, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - - dcopyWithin.ndarray( 2, 2, 1, 2, x, '1', 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, true, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, false, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, null, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, undefined, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, [], 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, {}, 0 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, ( x: number ): number => x, 0 ); // $ExpectError + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, 2, x, '4', 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, true, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, false, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, null, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, undefined, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, [], 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, {}, 0, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, ( x: number ): number => x, 0, w, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, '0', w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, true, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, false, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, null, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, undefined, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, [], w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, {}, w, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, ( x: number ): number => x, w, 1, 0 ); // $ExpectError +} - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, '0' ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, true ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, false ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, null ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, undefined ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, [] ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, {} ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, ( x: number ): number => x ); // $ExpectError +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a Float64Array... +{ + const x = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, '5', 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, 5, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, true, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, false, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, null, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, undefined, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, [], 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, {}, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, '1', 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, true, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, false, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, null, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, undefined, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, [], 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, {}, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a number... +{ + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); + + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, '0' ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, true ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, false ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, null ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, undefined ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, [] ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, {} ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided insufficient arguments... { - const x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const x = new Float64Array( 10 ); + const w = new Float64Array( 10 ); dcopyWithin.ndarray(); // $ExpectError - dcopyWithin.ndarray( 2 ); // $ExpectError - dcopyWithin.ndarray( 2, 2 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1 ); // $ExpectError - dcopyWithin.ndarray( 2, 2, 1, 2, x, 1, 0, {} ); // $ExpectError + dcopyWithin.ndarray( x.length ); // $ExpectError + dcopyWithin.ndarray( x.length, 3 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1 ); // $ExpectError + dcopyWithin.ndarray( x.length, 3, 1, 2, x, 1, 0, w, 1, 0, {} ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c index 044a873b5a21..8f68740e96f3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c @@ -23,14 +23,18 @@ int main( void ) { // Create a strided array: double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + // Create a workspace array: + double w[ 8 ]; + // Specify the number of elements to copy: const int N = 8; - // Specify a stride: + // Specify strides: const int strideX = 1; + const int strideW = 1; // Copy elements starting from index 1 to index 4: - stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX ); + stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX, w, strideW ); // Print the result: for ( int i = 0; i < 8; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js index 2b3b7493843d..3ff97d69e986 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/index.js @@ -19,6 +19,7 @@ 'use strict'; var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var dcopyWithin = require( './../lib' ); var x = discreteUniform( 10, 0, 500, { @@ -26,6 +27,8 @@ var x = discreteUniform( 10, 0, 500, { }); console.log( x ); +var w = zeros( 10, 'float64' ); + // Copy the first 3 elements to positions 5, 6, 7: -dcopyWithin( 10, 5, 0, 3, x, 1 ); +dcopyWithin( 10, 5, 0, 3, x, 1, w, 1 ); console.log( x ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h index 8e22a5534331..b2abcd17ea7c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h @@ -31,12 +31,12 @@ extern "C" { /** * Performs an in-place copy of elements within a double-precision floating-point array. */ -void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX ); +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, double *W, const CBLAS_INT strideW ); /** * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. */ -void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *W, const CBLAS_INT strideW, const CBLAS_INT offsetW ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index 4ac44db76230..de02da30dec5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -29,24 +29,33 @@ var ndarray = require( './ndarray.js' ); /** * Performs an in-place copy of elements within a double-precision floating-point array. * +* ## Notes +* +* - If the `start` and `target` index ranges do not overlap, the `workspace` array is unused and thus ignored. +* * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} target - target index -* @param {NonNegativeInteger} start - source start index -* @param {NonNegativeInteger} end - source end index +* @param {NonNegativeInteger} start - source start index (inclusive) +* @param {NonNegativeInteger} end - source end index (exclusive) * @param {Float64Array} x - input array -* @param {integer} strideX - stride length +* @param {integer} strideX - stride length for `x` +* @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` * @returns {Float64Array} input array * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin( x.length, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ -function dcopyWithin( N, target, start, end, x, strideX ) { - return ndarray( N, target, start, end, x, strideX, stride2offset( N, strideX ) ); // eslint-disable-line max-len +function dcopyWithin( N, target, start, end, x, strideX, workspace, strideW ) { + var ox = stride2offset( N, strideX ); + var ow = stride2offset( N, strideW ); + return ndarray( N, target, start, end, x, strideX, ox, workspace, strideW, ow ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index 8872690f0274..43585a689527 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -31,22 +31,25 @@ var addon = require( './../src/addon.node' ); * @private * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} target - target index -* @param {NonNegativeInteger} start - source start index -* @param {NonNegativeInteger} end - source end index +* @param {NonNegativeInteger} start - source start index (inclusive) +* @param {NonNegativeInteger} end - source end index (exclusive) * @param {Float64Array} x - input array -* @param {integer} strideX - stride length +* @param {integer} strideX - stride length for `x` +* @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` * @returns {Float64Array} input array * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin( x.length, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ -function dcopyWithin( N, target, start, end, x, strideX ) { - addon( N, target, start, end, x, strideX ); +function dcopyWithin( N, target, start, end, x, strideX, workspace, strideW ) { + addon( N, target, start, end, x, strideX, workspace, strideW ); return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js index f506c2c9bc23..99b0f6116a6b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -28,8 +28,9 @@ * var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin( x.length, 3, 1, 4, x, 1 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, w, 1 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] * * @example @@ -37,8 +38,9 @@ * var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0 ); +* dcopyWithin.ndarray( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index 544830be0f4a..cb0c326bd712 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -20,8 +20,7 @@ // MODULES // -var min = require( '@stdlib/math/base/special/min' ); -var Float64Array = require( '@stdlib/array/float64' ); +var min = require( '@stdlib/math/base/special/fast/min' ); var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; @@ -30,25 +29,32 @@ var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; /** * Performs an in-place copy of elements within a double-precision floating-point array. * +* ## Notes +* +* - If the `start` and `target` index ranges do not overlap, the `workspace` array is unused and thus ignored. +* * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} target - target index -* @param {NonNegativeInteger} start - source start index -* @param {NonNegativeInteger} end - source end index +* @param {NonNegativeInteger} start - source start index (inclusive) +* @param {NonNegativeInteger} end - source end index (exclusive) * @param {Float64Array} x - input array -* @param {integer} strideX - stride length -* @param {NonNegativeInteger} offsetX - starting index +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` +* @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {Float64Array} input array * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin( x.length, 3, 1, 4, x, 1, 0 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ -function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { - var tmp; +function dcopyWithin( N, target, start, end, x, strideX, offsetX, workspace, strideW, offsetW ) { // eslint-disable-line max-len var ssi; var tsi; var cl; @@ -65,11 +71,10 @@ function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { ssi = offsetX + ( start * strideX ); tsi = offsetX + ( target * strideX ); - // When the source and target index ranges overlap, copying directly could overwrite source elements before they are read, and, thus, we first copy the source elements to a temporary array: - if ( start < target + cl && target < start + cl ) { - tmp = new Float64Array( cl ); - dcopy( cl, x, strideX, ssi, tmp, 1, 0 ); - dcopy( cl, tmp, 1, 0, x, strideX, tsi ); + // When the source and target index ranges overlap, copying directly could overwrite source elements before they are read, and, thus, we first copy the source elements to a workspace array: + if ( start < target+cl && target < start+cl ) { + dcopy( cl, x, strideX, ssi, workspace, strideW, offsetW ); + dcopy( cl, workspace, strideW, offsetW, x, strideX, tsi ); return x; } dcopy( cl, x, strideX, ssi, x, strideX, tsi ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index eaf5a15fb819..efe894f1fde8 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -31,23 +31,27 @@ var addon = require( './../src/addon.node' ); * @private * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} target - target index -* @param {NonNegativeInteger} start - source start index -* @param {NonNegativeInteger} end - source end index +* @param {NonNegativeInteger} start - source start index (inclusive) +* @param {NonNegativeInteger} end - source end index (exclusive) * @param {Float64Array} x - input array -* @param {integer} strideX - stride length -* @param {NonNegativeInteger} offsetX - starting index +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Float64Array} workspace - workspace array +* @param {integer} strideW - stride length for `workspace` +* @param {NonNegativeInteger} offsetW - starting index for `workspace` * @returns {Float64Array} input array * * @example * var Float64Array = require( '@stdlib/array/float64' ); * * var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var w = new Float64Array( x.length ); * -* dcopyWithin( x.length, 3, 1, 4, x, 1, 0 ); +* dcopyWithin( x.length, 3, 1, 4, x, 1, 0, w, 1, 0 ); * // x => [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] */ -function dcopyWithin( N, target, start, end, x, strideX, offsetX ) { - addon.ndarray( N, target, start, end, x, strideX, offsetX ); +function dcopyWithin( N, target, start, end, x, strideX, offsetX, workspace, strideW, offsetW ) { // eslint-disable-line max-len + addon.ndarray( N, target, start, end, x, strideX, offsetX, workspace, strideW, offsetW ); // eslint-disable-line max-len return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c index cc21a847440d..34896bd814ae 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/addon.c @@ -32,14 +32,16 @@ * @return Node-API value */ static napi_value addon( napi_env env, napi_callback_info info ) { - STDLIB_NAPI_ARGV( env, info, argv, argc, 6 ); + STDLIB_NAPI_ARGV( env, info, argv, argc, 8 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_INT64( env, target, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, start, argv, 2 ); STDLIB_NAPI_ARGV_INT64( env, end, argv, 3 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, strideW, argv, 7 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); - API_SUFFIX(stdlib_strided_dcopy_within)( N, target, start, end, X, strideX ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, W, N, strideW, argv, 6 ); + API_SUFFIX(stdlib_strided_dcopy_within)( N, target, start, end, X, strideX, W, strideW ); return NULL; } @@ -51,15 +53,18 @@ static napi_value addon( napi_env env, napi_callback_info info ) { * @return Node-API value */ static napi_value addon_method( napi_env env, napi_callback_info info ) { - STDLIB_NAPI_ARGV( env, info, argv, argc, 7 ); + STDLIB_NAPI_ARGV( env, info, argv, argc, 10 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_INT64( env, target, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, start, argv, 2 ); STDLIB_NAPI_ARGV_INT64( env, end, argv, 3 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 6 ); + STDLIB_NAPI_ARGV_INT64( env, strideW, argv, 8 ); + STDLIB_NAPI_ARGV_INT64( env, offsetW, argv, 9 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, X, strideX, offsetX ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, W, N, strideW, argv, 7 ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, X, strideX, offsetX, W, strideW, offsetW ); return NULL; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index 314eac7960ec..b8317f44d566 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -20,21 +20,23 @@ #include "stdlib/blas/base/shared.h" #include "stdlib/blas/base/dcopy.h" #include "stdlib/strided/base/stride2offset.h" -#include /** * Performs an in-place copy of elements within a double-precision floating-point array. * * @param N number of indexed elements * @param target target index -* @param start source start index -* @param end source end index +* @param start source start index (inclusive) +* @param end source end index (exclusive) * @param X input array -* @param strideX stride length +* @param strideX stride length for `X` +* @param W workspace array +* @param strideW stride length for `W` */ -void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX ) { - CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); - API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, X, strideX, ox ); +void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, double *W, const CBLAS_INT strideW ) { + const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + const CBLAS_INT ow = stdlib_strided_stride2offset( N, strideW ); + API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( N, target, start, end, X, strideX, ox, W, strideW, ow ); } /** @@ -42,22 +44,24 @@ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT * * @param N number of indexed elements * @param target target index -* @param start source start index -* @param end source end index +* @param start source start index (inclusive) +* @param end source end index (exclusive) * @param X input array -* @param strideX stride length -* @param offsetX starting index +* @param strideX stride length for `X` +* @param offsetX starting index for `X` +* @param W workspace array +* @param strideW stride length for `W` +* @param offsetW starting index for `W` */ -void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { +void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *W, const CBLAS_INT strideW, const CBLAS_INT offsetW ) { CBLAS_INT ssi; CBLAS_INT tsi; CBLAS_INT cl; - double *tmp; if ( N <= 0 || strideX == 0 || target >= N ) { return; } - // Resolve the number of elements to copy: + // Resolve the number of elements to copy (note: intentionally avoid `stdlib_base_min`, which operates on double-precision floating-point numbers)... cl = ( ( end < N ) ? end : N ) - start; if ( cl > N - target ) { cl = N - target; @@ -69,15 +73,10 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C ssi = offsetX + ( start * strideX ); tsi = offsetX + ( target * strideX ); - // When the source and target index ranges overlap, copying directly could overwrite source elements before they are read, and, thus, we first copy the source elements to a temporary array: + // When the source and target index ranges overlap, copying directly could overwrite source elements before they are read, and, thus, we first copy the source elements to a workspace array: if ( start < target + cl && target < start + cl ) { - tmp = (double *)malloc( cl * sizeof( double ) ); - if ( tmp == NULL ) { - return; - } - API_SUFFIX(c_dcopy_ndarray)( cl, X, strideX, ssi, tmp, 1, 0 ); - API_SUFFIX(c_dcopy_ndarray)( cl, tmp, 1, 0, X, strideX, tsi ); - free( tmp ); + API_SUFFIX(c_dcopy_ndarray)( cl, X, strideX, ssi, W, strideW, offsetW ); + API_SUFFIX(c_dcopy_ndarray)( cl, W, strideW, offsetW, X, strideX, tsi ); return; } API_SUFFIX(c_dcopy_ndarray)( cl, X, strideX, ssi, X, strideX, tsi ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js index dcbc1e6747d6..fbb501368896 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.js @@ -33,8 +33,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function has an arity of 6', function test( t ) { - t.strictEqual( dcopyWithin.length, 6, 'returns expected value' ); +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( dcopyWithin.length, 8, 'returns expected value' ); t.end(); }); @@ -42,27 +42,31 @@ tape( 'the function copies values within the provided double-precision floating- var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 6, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 6, 3, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 5, 2, 0, 5, x, 1 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -74,19 +78,21 @@ tape( 'if provided `target` parameter is greater than or equal to the `N` parame var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -97,16 +103,18 @@ tape( 'if provided `N` parameter is less than or equal to `0`, the function retu var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -118,19 +126,22 @@ tape( 'if provided `start` parameter is greater than or equal to the `end` param var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 3, 1, x, 1 ); + actual = dcopyWithin( 6, 0, 3, 1, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + actual = dcopyWithin( 6, 0, 2, 2, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -141,49 +152,56 @@ tape( 'if provided `end` parameter is greater than the number of indexed element var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 5, 0, 2, 10, x, 1 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing a stride parameter', function test( t ) { +tape( 'the function supports providing an `x` stride parameter', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, 2 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing negative strides', function test( t ) { +tape( 'the function supports providing an `x` negative stride parameter', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 3 ); expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -195,13 +213,81 @@ tape( 'the function supports a stride of zero', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + actual = dcopyWithin( 6, 1, 0, 2, x, 0, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); + +tape( 'the function supports providing a `workspace` stride parameter', function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 5 ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 1, 0, 2, x, 1, w, 2 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` negative stride parameter', function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 6, 3, 1, 4, x, 1, w, -1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var expected; + var x0; + var x1; + var w; + + // Initial array... + x0 = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, // 2 + 5.0, // 3 + 6.0, // 4 + 7.0, // 5 + 8.0 + ]); + + // Create offset view... + x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + + // Create a workspace array... + w = new Float64Array( 6 ); + + dcopyWithin( 6, 0, 3, 6, x1, 1, w, 1 ); + + expected = new Float64Array( [ 1.0, 5.0, 6.0, 7.0, 5.0, 6.0, 7.0, 8.0 ] ); + + t.deepEqual( x0, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index 7ae59e6c55f1..e8add82ac4b1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -44,8 +44,8 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'the function has an arity of 6', opts, function test( t ) { - t.strictEqual( dcopyWithin.length, 6, 'returns expected value' ); +tape( 'the function has an arity of 8', opts, function test( t ) { + t.strictEqual( dcopyWithin.length, 8, 'returns expected value' ); t.end(); }); @@ -53,27 +53,31 @@ tape( 'the function copies values within the provided double-precision floating- var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 6, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 6, 3, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 5, 2, 0, 5, x, 1 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -85,19 +89,21 @@ tape( 'if provided `target` parameter is greater than or equal to the `N` parame var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 6, 10, 0, 3, x, 1 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 4, 5, 0, 3, x, 1 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -108,16 +114,18 @@ tape( 'if provided `N` parameter is less than or equal to `0`, the function retu var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, 1, 4, x, 1 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -129,19 +137,22 @@ tape( 'if provided `start` parameter is greater than or equal to the `end` param var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 3, 1, x, 1 ); + actual = dcopyWithin( 6, 0, 3, 1, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1 ); + actual = dcopyWithin( 6, 0, 2, 2, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -152,49 +163,56 @@ tape( 'if provided `end` parameter is greater than the number of indexed element var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 5, 0, 2, 10, x, 1 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing a stride parameter', opts, function test( t ) { +tape( 'the function supports providing an `x` stride parameter', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, 2 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing negative strides', opts, function test( t ) { +tape( 'the function supports providing an `x` negative stride parameter', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 3 ); expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, -1 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -206,13 +224,81 @@ tape( 'the function supports a stride of zero', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0 ); + actual = dcopyWithin( 6, 1, 0, 2, x, 0, w, 1 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); + +tape( 'the function supports providing a `workspace` stride parameter', opts, function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 5 ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 1, 0, 2, x, 1, w, 2 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` negative stride parameter', opts, function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 6, 3, 1, 4, x, 1, w, -1 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', opts, function test( t ) { + var expected; + var x0; + var x1; + var w; + + // Initial array... + x0 = new Float64Array([ + 1.0, + 2.0, // 0 + 3.0, // 1 + 4.0, // 2 + 5.0, // 3 + 6.0, // 4 + 7.0, // 5 + 8.0 + ]); + + // Create offset view... + x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + + // Create a workspace array... + w = new Float64Array( 6 ); + + dcopyWithin( 6, 0, 3, 6, x1, 1, w, 1 ); + + expected = new Float64Array( [ 1.0, 5.0, 6.0, 7.0, 5.0, 6.0, 7.0, 8.0 ] ); + + t.deepEqual( x0, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js index 6bed43043c69..f0df646ad758 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.js @@ -33,8 +33,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function has an arity of 7', function test( t ) { - t.strictEqual( dcopyWithin.length, 7, 'returns expected value' ); +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( dcopyWithin.length, 10, 'returns expected value' ); t.end(); }); @@ -42,27 +42,31 @@ tape( 'the function copies values within the provided double-precision floating- var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 6, 3, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 5, 2, 0, 5, x, 1, 0 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -74,19 +78,21 @@ tape( 'if provided `target` parameter is greater than or equal to the `N` parame var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 6, 10, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -97,16 +103,18 @@ tape( 'if provided `N` parameter is less than or equal to `0`, the function retu var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -118,19 +126,22 @@ tape( 'if provided `start` parameter is greater than or equal to the `end` param var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); + actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); + actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -141,49 +152,56 @@ tape( 'if provided `end` parameter is greater than the number of indexed element var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 5, 0, 2, 10, x, 1, 0 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing a stride parameter', function test( t ) { +tape( 'the function supports providing an `x` stride parameter', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, 2, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing negative strides', function test( t ) { +tape( 'the function supports providing an `x` negative stride parameter', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 3 ); expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -195,26 +213,81 @@ tape( 'the function supports a stride of zero', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); + actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing an offset parameter', function test( t ) { +tape( 'the function supports providing an `x` offset parameter', function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ); - actual = dcopyWithin( 4, 2, 0, 2, x, 1, 1 ); + actual = dcopyWithin( 4, 2, 0, 2, x, 1, 1, w, 1, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` stride parameter', function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 5 ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 1, 0, 2, x, 1, 0, w, 2, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` negative stride parameter', function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0, w, -1, 5 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` offset parameter', function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 5 ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 1, 0, 2, x, 1, 0, w, 1, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index 2e93ee7d8f33..71f55f0d1df0 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -44,8 +44,8 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'the function has an arity of 7', opts, function test( t ) { - t.strictEqual( dcopyWithin.length, 7, 'returns expected value' ); +tape( 'the function has an arity of 10', opts, function test( t ) { + t.strictEqual( dcopyWithin.length, 10, 'returns expected value' ); t.end(); }); @@ -53,27 +53,31 @@ tape( 'the function copies values within the provided double-precision floating- var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); - actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 6, 3, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 3, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 3.0 ] ); - actual = dcopyWithin( 5, 2, 0, 5, x, 1, 0 ); + actual = dcopyWithin( 5, 2, 0, 5, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -85,19 +89,21 @@ tape( 'if provided `target` parameter is greater than or equal to the `N` parame var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 6, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 6, 10, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 6, 10, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0 ); + actual = dcopyWithin( 4, 5, 0, 3, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -108,16 +114,18 @@ tape( 'if provided `N` parameter is less than or equal to `0`, the function retu var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( 0, 3, 1, 4, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); - actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0 ); + actual = dcopyWithin( -1, 3, 1, 4, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -129,19 +137,22 @@ tape( 'if provided `start` parameter is greater than or equal to the `end` param var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0 ); + actual = dcopyWithin( 6, 0, 3, 1, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0 ); + actual = dcopyWithin( 6, 0, 2, 2, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -152,49 +163,56 @@ tape( 'if provided `end` parameter is greater than the number of indexed element var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); + w = new Float64Array( 5 ); expected = new Float64Array( [ 3.0, 4.0, 5.0, 4.0, 5.0 ] ); - actual = dcopyWithin( 5, 0, 2, 10, x, 1, 0 ); + actual = dcopyWithin( 5, 0, 2, 10, x, 1, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing a stride parameter', opts, function test( t ) { +tape( 'the function supports providing an `x` stride parameter', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 5.0, 2.0, 7.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, 2, 0 ); + actual = dcopyWithin( 4, 0, 2, 4, x, 2, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing negative strides', opts, function test( t ) { +tape( 'the function supports providing an `x` negative stride parameter', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 3 ); expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2 ); + actual = dcopyWithin( 3, 0, 1, 3, x, -1, 2, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 1.0, 2.0, 1.0, 2.0, 5.0, 6.0, 7.0, 8.0 ] ); - actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3 ); + actual = dcopyWithin( 4, 0, 2, 4, x, -1, 3, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); @@ -206,26 +224,81 @@ tape( 'the function supports a stride of zero', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0 ); + actual = dcopyWithin( 6, 1, 0, 2, x, 0, 0, w, 1, 0 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports providing an offset parameter', opts, function test( t ) { +tape( 'the function supports providing an `x` offset parameter', opts, function test( t ) { var expected; var actual; var x; + var w; x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 4 ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 6.0 ] ); - actual = dcopyWithin( 4, 2, 0, 2, x, 1, 1 ); + actual = dcopyWithin( 4, 2, 0, 2, x, 1, 1, w, 1, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` stride parameter', opts, function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 5 ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 1, 0, 2, x, 1, 0, w, 2, 0 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` negative stride parameter', opts, function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 6 ); + expected = new Float64Array( [ 1.0, 2.0, 3.0, 2.0, 3.0, 4.0 ] ); + + actual = dcopyWithin( 6, 3, 1, 4, x, 1, 0, w, -1, 5 ); + + t.strictEqual( actual, x, 'returns expected value' ); + t.deepEqual( x, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing a `workspace` offset parameter', opts, function test( t ) { + var expected; + var actual; + var x; + var w; + + x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + w = new Float64Array( 5 ); + expected = new Float64Array( [ 1.0, 1.0, 2.0, 4.0, 5.0, 6.0 ] ); + + actual = dcopyWithin( 3, 1, 0, 2, x, 1, 0, w, 1, 2 ); t.strictEqual( actual, x, 'returns expected value' ); t.deepEqual( x, expected, 'returns expected value' ); From 6d5b04984d9c91eb54204d7d3d6d0f20592db176 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 03:55:55 -0700 Subject: [PATCH 16/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index 493e8c0a2467..b9792e6caebf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -90,7 +90,7 @@ static double rand_double( void ) { } /** -* Run a benchmark which tests `stdlib_strided_dcopy_within`. +* Run a benchmark. * * @param iterations number of iterations * @param len array length @@ -127,7 +127,7 @@ static double benchmark1( int iterations, int len ) { } /** -* Run a benchmark which tests `stdlib_strided_dcopy_within_ndarray`. +* Run a benchmark. * * @param iterations number of iterations * @param len array length From d3b90a54e09c1ff8aa41fc9721c5436968bd38f3 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 04:02:11 -0700 Subject: [PATCH 17/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../benchmark/c/benchmark.length.c | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index b9792e6caebf..fc7ce44229a6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -80,21 +80,21 @@ static double tic( void ) { } /** -* Generates a random double on the interval [-100,100). +* Generates a random number on the interval [0,1). * -* @return random double +* @return random number */ static double rand_double( void ) { int r = rand(); - return -100.0 + (r/(double)RAND_MAX)*200.0; + return (double)r / ( (double)RAND_MAX + 1.0 ); } /** -* Run a benchmark. +* Runs a benchmark. * * @param iterations number of iterations * @param len array length -* @return elapsed time in seconds +* @return elapsed time in seconds */ static double benchmark1( int iterations, int len ) { double elapsed; @@ -127,11 +127,11 @@ static double benchmark1( int iterations, int len ) { } /** -* Run a benchmark. +* Runs a benchmark. * * @param iterations number of iterations * @param len array length -* @return elapsed time in seconds +* @return elapsed time in seconds */ static double benchmark2( int iterations, int len ) { double elapsed; @@ -179,21 +179,17 @@ int main( void ) { print_version(); count = 0; - - // Run benchmarks: for ( i = MIN; i <= MAX; i++ ) { len = pow( 10, i ); iter = ITERATIONS / pow( 10, i-1 ); - if ( iter < 1 ) { - iter = 1; - } for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); elapsed = benchmark1( iter, len ); print_results( "dcopy_within:len", elapsed ); printf( "ok %d benchmark finished\n", count ); - + } + for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:ndarray:len=%d\n", NAME, len ); elapsed = benchmark2( iter, len ); @@ -202,6 +198,4 @@ int main( void ) { } } print_summary( count, count ); - - return 0; } From a4090aee2b2c063148e645af291dfbaec0e07c26 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 04:04:24 -0700 Subject: [PATCH 18/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../dcopy-within/benchmark/c/benchmark.length.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index fc7ce44229a6..916a0ebe61a8 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -55,14 +55,13 @@ static void print_summary( int total, int passing ) { /** * Prints benchmark results. * -* @param prefix comment prefix -* @param elapsed elapsed time in seconds +* @param iterations number of iterations +* @param elapsed elapsed time in seconds */ -static void print_results( const char* prefix, double elapsed ) { - double rate = (double)ITERATIONS / elapsed; - printf( "# %s\n", prefix ); +static void print_results( int iterations, double elapsed ) { + double rate = (double)iterations / elapsed; printf( " ---\n" ); - printf( " iterations: %d\n", ITERATIONS ); + printf( " iterations: %d\n", iterations ); printf( " elapsed: %0.9f\n", elapsed ); printf( " rate: %0.9f\n", rate ); printf( " ...\n" ); @@ -186,14 +185,14 @@ int main( void ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); elapsed = benchmark1( iter, len ); - print_results( "dcopy_within:len", elapsed ); + print_results( iter, elapsed ); printf( "ok %d benchmark finished\n", count ); } for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:ndarray:len=%d\n", NAME, len ); elapsed = benchmark2( iter, len ); - print_results( "dcopy_within_ndarray:len", elapsed ); + print_results( iter, elapsed ); printf( "ok %d benchmark finished\n", count ); } } From 5b759ce4bb35f6a4da45344da65508202f9a03b7 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 04:08:05 -0700 Subject: [PATCH 19/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js | 2 +- .../blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js index 3fa4391dc3fd..5446ff7b0c33 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.js @@ -26,8 +26,8 @@ var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); -var dcopyWithin = require( './../lib/dcopy_within.js' ); var pkg = require( './../package.json' ).name; +var dcopyWithin = require( './../lib/dcopy_within.js' ); // VARIABLES // diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js index 2e59c4635389..1c2f052a4e6f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/benchmark.ndarray.js @@ -26,8 +26,8 @@ var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var format = require( '@stdlib/string/format' ); -var dcopyWithin = require( './../lib/ndarray.js' ); var pkg = require( './../package.json' ).name; +var dcopyWithin = require( './../lib/ndarray.js' ); // VARIABLES // From 5ecbc33254027eaee663b0591f64c9c166c454c1 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 04:22:15 -0700 Subject: [PATCH 20/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/dcopy-within/examples/c/example.c | 4 ++-- .../ext/base/dcopy-within/test/test.dcopy_within.native.js | 6 ++---- .../@stdlib/blas/ext/base/dcopy-within/test/test.js | 2 +- .../blas/ext/base/dcopy-within/test/test.ndarray.native.js | 6 ++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c index 8f68740e96f3..252b49d08485 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/examples/c/example.c @@ -26,14 +26,14 @@ int main( void ) { // Create a workspace array: double w[ 8 ]; - // Specify the number of elements to copy: + // Specify the number of indexed elements: const int N = 8; // Specify strides: const int strideX = 1; const int strideW = 1; - // Copy elements starting from index 1 to index 4: + // Copy elements: stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX, w, strideW ); // Print the result: diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js index e8add82ac4b1..9f8950cf701e 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.dcopy_within.native.js @@ -22,17 +22,15 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var isBrowser = require( '@stdlib/assert/is-browser' ); -var isError = require( '@stdlib/assert/is-error' ); var Float64Array = require( '@stdlib/array/float64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); // VARIABLES // var dcopyWithin = tryRequire( resolve( __dirname, './../lib/dcopy_within.native.js' ) ); var opts = { - 'skip': ( isBrowser || isError( dcopyWithin ) ) + 'skip': ( dcopyWithin instanceof Error ) }; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js index c599de2d5d6e..a2f9d5b6db49 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js @@ -63,7 +63,7 @@ tape( 'if a native implementation is available, the main export is the native im } }); -tape( 'if a native implementation is not available, the main export is a JavaScript implementation', function test( t ) { +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { var dcopyWithin; var main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index 71f55f0d1df0..be018c4eb13a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -22,17 +22,15 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var isBrowser = require( '@stdlib/assert/is-browser' ); -var isError = require( '@stdlib/assert/is-error' ); var Float64Array = require( '@stdlib/array/float64' ); +var isError = require( '@stdlib/assert/is-error' ); // VARIABLES // var dcopyWithin = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { - 'skip': ( isBrowser || isError( dcopyWithin ) ) + 'skip': ( dcopyWithin instanceof Error ) }; From 3e94a1acc59447cb63e7995be4a05b665d6f8b89 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 04:23:55 -0700 Subject: [PATCH 21/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../blas/ext/base/dcopy-within/test/test.ndarray.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js index be018c4eb13a..8bd75d53fc5c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.ndarray.native.js @@ -23,7 +23,7 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); -var isError = require( '@stdlib/assert/is-error' ); +var tryRequire = require( '@stdlib/utils/try-require' ); // VARIABLES // From 23991984b047e9188bc321f32983b21ecc8dede5 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 04:25:40 -0700 Subject: [PATCH 22/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index f117a4bc7191..38cba4059a0a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -273,14 +273,14 @@ int main( void ) { // Create a workspace array: double w[ 8 ]; - // Specify the number of elements to copy: + // Specify the number of indexed elements: const int N = 8; // Specify strides: const int strideX = 1; const int strideW = 1; - // Copy elements starting from index 1 to index 4: + // Copy elements: stdlib_strided_dcopy_within( N, 4, 1, 4, x, strideX, w, strideW ); // Print the result: From 6e069c3ce671cb926074fe4c063d3535d1c7dc55 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 2 Aug 2026 20:45:44 +0500 Subject: [PATCH 23/26] fix: docs descriptions --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - 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: 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/ext/base/dcopy-within/README.md | 10 +++++----- .../@stdlib/blas/ext/base/dcopy-within/docs/repl.txt | 4 ++-- .../blas/ext/base/dcopy-within/docs/types/index.d.ts | 6 +++--- .../include/stdlib/blas/ext/base/dcopy_within.h | 4 ++-- .../blas/ext/base/dcopy-within/lib/dcopy_within.js | 2 +- .../ext/base/dcopy-within/lib/dcopy_within.native.js | 2 +- .../@stdlib/blas/ext/base/dcopy-within/lib/index.js | 2 +- .../@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js | 2 +- .../blas/ext/base/dcopy-within/lib/ndarray.native.js | 2 +- .../@stdlib/blas/ext/base/dcopy-within/package.json | 2 +- .../@stdlib/blas/ext/base/dcopy-within/src/main.c | 4 ++-- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md index 38cba4059a0a..ccdd780ec0b4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/README.md @@ -20,7 +20,7 @@ limitations under the License. # dcopyWithin -> Perform an in-place copy of elements within a double-precision floating-point array. +> Perform an in-place copy of elements within a double-precision floating-point strided array.
@@ -32,7 +32,7 @@ var dcopyWithin = require( '@stdlib/blas/ext/base/dcopy-within' ); #### dcopyWithin( N, target, start, end, x, strideX, workspace, strideW ) -Performs an in-place copy of elements within a double-precision floating-point array. +Performs an in-place copy of elements within a double-precision floating-point strided array. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -90,7 +90,7 @@ dcopyWithin( 6, 0, 3, 6, x1, 1, w, 1 ); #### dcopyWithin.ndarray( N, target, start, end, x, strideX, offsetX, workspace, strideW, offsetW ) -Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. +Performs an in-place copy of elements within a double-precision floating-point strided array using alternative indexing semantics. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -192,7 +192,7 @@ console.log( x ); #### stdlib_strided_dcopy_within( N, target, start, end, \*X, strideX, \*W, strideW ) -Performs an in-place copy of elements within a double-precision floating-point array. +Performs an in-place copy of elements within a double-precision floating-point strided array. ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; @@ -218,7 +218,7 @@ void stdlib_strided_dcopy_within( const CBLAS_INT N, const CBLAS_INT target, con #### stdlib_strided_dcopy_within_ndarray( N, target, start, end, \*X, strideX, offsetX, \*W, strideW, offsetW ) -Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. +Performs an in-place copy of elements within a double-precision floating-point strided array using alternative indexing semantics. ```c double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt index a6f5a4f43597..863861b96dbe 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( N, target, start, end, x, strideX, w, strideW ) Performs an in-place copy of elements within a double-precision floating- - point array. + point strided array. The `N` and stride parameters determine which elements in the strided array are accessed at runtime. @@ -75,7 +75,7 @@ {{alias}}.ndarray( N, target, start, end, x,strideX,offsetX, w,strideW,offsetW ) Performs an in-place copy of elements within a double-precision floating- - point array using alternative indexing semantics. + point strided array using alternative indexing semantics. While typed array views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts index dbe3336198b1..ef7a7afac235 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/docs/types/index.d.ts @@ -23,7 +23,7 @@ */ interface Routine { /** - * Performs an in-place copy of elements within a double-precision floating-point array. + * Performs an in-place copy of elements within a double-precision floating-point strided array. * * ## Notes * @@ -51,7 +51,7 @@ interface Routine { ( N: number, target: number, start: number, end: number, x: Float64Array, strideX: number, workspace: Float64Array, strideW: number ): Float64Array; /** - * Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. + * Performs an in-place copy of elements within a double-precision floating-point strided array using alternative indexing semantics. * * ## Notes * @@ -82,7 +82,7 @@ interface Routine { } /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. * * ## Notes * diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h index b2abcd17ea7c..66ec54c99e51 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/include/stdlib/blas/ext/base/dcopy_within.h @@ -29,12 +29,12 @@ extern "C" { #endif /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. */ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, double *W, const CBLAS_INT strideW ); /** -* Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. +* Performs an in-place copy of elements within a double-precision floating-point strided array using alternative indexing semantics. */ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const CBLAS_INT target, const CBLAS_INT start, const CBLAS_INT end, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *W, const CBLAS_INT strideW, const CBLAS_INT offsetW ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js index de02da30dec5..cdb85ca205de 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.js @@ -27,7 +27,7 @@ var ndarray = require( './ndarray.js' ); // MAIN // /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. * * ## Notes * diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index 43585a689527..fdc936603e90 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' ); // MAIN // /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. * * @private * @param {PositiveInteger} N - number of indexed elements diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js index 99b0f6116a6b..3413fb3adb0a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Perform an in-place copy of elements within a double-precision floating-point array. +* Perform an in-place copy of elements within a double-precision floating-point strided array. * * @module @stdlib/blas/ext/base/dcopy-within * diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js index cb0c326bd712..def384293852 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.js @@ -27,7 +27,7 @@ var dcopy = require( '@stdlib/blas/base/dcopy' ).ndarray; // MAIN // /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. * * ## Notes * diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index efe894f1fde8..b8661a5dcd9a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' ); // MAIN // /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. * * @private * @param {PositiveInteger} N - number of indexed elements diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json index 76ffc0003087..c613d75f752d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/ext/base/dcopy-within", "version": "0.0.0", - "description": "Perform an in-place copy of elements within a double-precision floating-point array.", + "description": "Perform an in-place copy of elements within a double-precision floating-point strided array.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index b8317f44d566..1d419d4177c2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -22,7 +22,7 @@ #include "stdlib/strided/base/stride2offset.h" /** -* Performs an in-place copy of elements within a double-precision floating-point array. +* Performs an in-place copy of elements within a double-precision floating-point strided array. * * @param N number of indexed elements * @param target target index @@ -40,7 +40,7 @@ void API_SUFFIX(stdlib_strided_dcopy_within)( const CBLAS_INT N, const CBLAS_INT } /** -* Performs an in-place copy of elements within a double-precision floating-point array using alternative indexing semantics. +* Performs an in-place copy of elements within a double-precision floating-point strided array using alternative indexing semantics. * * @param N number of indexed elements * @param target target index From 0b17b70465ded76b9e66c88dc032f2489d6ac10f Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 2 Aug 2026 21:10:19 +0500 Subject: [PATCH 24/26] fix: cleanup --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - 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: na - task: lint_c_examples status: na - 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: na - task: lint_license_headers status: passed --- --- .../ext/base/dcopy-within/benchmark/c/benchmark.length.c | 6 +++--- .../@stdlib/blas/ext/base/dcopy-within/test/test.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c index 916a0ebe61a8..f55d0d904605 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/benchmark/c/benchmark.length.c @@ -40,8 +40,8 @@ static void print_version( void ) { /** * Prints the TAP summary. * -* @param total total number of tests -* @param passing total number of passing tests +* @param total total number of tests +* @param passing total number of passing tests */ static void print_summary( int total, int passing ) { printf( "#\n" ); @@ -53,7 +53,7 @@ static void print_summary( int total, int passing ) { } /** -* Prints benchmark results. +* Prints benchmarks results. * * @param iterations number of iterations * @param elapsed elapsed time in seconds diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js index a2f9d5b6db49..3fbb7bf1b47b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/test/test.js @@ -22,14 +22,14 @@ var tape = require( 'tape' ); var proxyquire = require( 'proxyquire' ); -var isBrowser = require( '@stdlib/assert/is-browser' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); var dcopyWithin = require( './../lib' ); // VARIABLES // var opts = { - 'skip': isBrowser + 'skip': IS_BROWSER }; @@ -77,6 +77,6 @@ tape( 'if a native implementation is not available, the main export is a JavaScr t.end(); function tryRequire() { - return new Error( 'Cannot resolve module' ); + return new Error( 'Cannot find module' ); } }); From 9ae8e58db081f81e123ef96c93a17059f52eadc5 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 13:19:59 -0700 Subject: [PATCH 25/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../blas/ext/base/dcopy-within/lib/dcopy_within.native.js | 1 - .../@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js index fdc936603e90..b4f006964c35 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/dcopy_within.native.js @@ -28,7 +28,6 @@ var addon = require( './../src/addon.node' ); /** * Performs an in-place copy of elements within a double-precision floating-point strided array. * -* @private * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} target - target index * @param {NonNegativeInteger} start - source start index (inclusive) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js index b8661a5dcd9a..b4bfb572761c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/lib/ndarray.native.js @@ -28,7 +28,6 @@ var addon = require( './../src/addon.node' ); /** * Performs an in-place copy of elements within a double-precision floating-point strided array. * -* @private * @param {PositiveInteger} N - number of indexed elements * @param {NonNegativeInteger} target - target index * @param {NonNegativeInteger} start - source start index (inclusive) From 221eaa26edbf042f16b2729ca11f2c02f7154ccd Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 2 Aug 2026 13:21:57 -0700 Subject: [PATCH 26/26] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c index 1d419d4177c2..8e0d7ca0d573 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dcopy-within/src/main.c @@ -61,7 +61,7 @@ void API_SUFFIX(stdlib_strided_dcopy_within_ndarray)( const CBLAS_INT N, const C if ( N <= 0 || strideX == 0 || target >= N ) { return; } - // Resolve the number of elements to copy (note: intentionally avoid `stdlib_base_min`, which operates on double-precision floating-point numbers)... + // Resolve the number of elements to copy... cl = ( ( end < N ) ? end : N ) - start; if ( cl > N - target ) { cl = N - target;