From 315eeebad0c44555e27645298890d88ac420ad4e Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 19 Jul 2026 12:04:50 -0700 Subject: [PATCH 1/4] feat: add `blas/ext/base/zxdy` --- 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: 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: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - 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/zxdy/README.md | 349 ++++++++++++++++++ .../blas/ext/base/zxdy/benchmark/benchmark.js | 112 ++++++ .../base/zxdy/benchmark/benchmark.native.js | 117 ++++++ .../base/zxdy/benchmark/benchmark.ndarray.js | 112 ++++++ .../benchmark/benchmark.ndarray.native.js | 117 ++++++ .../blas/ext/base/zxdy/benchmark/c/Makefile | 146 ++++++++ .../base/zxdy/benchmark/c/benchmark.length.c | 210 +++++++++++ .../@stdlib/blas/ext/base/zxdy/binding.gyp | 265 +++++++++++++ .../@stdlib/blas/ext/base/zxdy/docs/repl.txt | 127 +++++++ .../blas/ext/base/zxdy/docs/types/index.d.ts | 107 ++++++ .../blas/ext/base/zxdy/docs/types/test.ts | 247 +++++++++++++ .../blas/ext/base/zxdy/examples/c/Makefile | 146 ++++++++ .../blas/ext/base/zxdy/examples/c/example.c | 54 +++ .../blas/ext/base/zxdy/examples/index.js | 36 ++ .../@stdlib/blas/ext/base/zxdy/include.gypi | 53 +++ .../zxdy/include/stdlib/blas/ext/base/zxdy.h | 46 +++ .../@stdlib/blas/ext/base/zxdy/lib/index.js | 70 ++++ .../@stdlib/blas/ext/base/zxdy/lib/main.js | 35 ++ .../@stdlib/blas/ext/base/zxdy/lib/native.js | 35 ++ .../@stdlib/blas/ext/base/zxdy/lib/ndarray.js | 118 ++++++ .../blas/ext/base/zxdy/lib/ndarray.native.js | 60 +++ .../@stdlib/blas/ext/base/zxdy/lib/zxdy.js | 55 +++ .../blas/ext/base/zxdy/lib/zxdy.native.js | 58 +++ .../@stdlib/blas/ext/base/zxdy/manifest.json | 108 ++++++ .../@stdlib/blas/ext/base/zxdy/package.json | 83 +++++ .../@stdlib/blas/ext/base/zxdy/src/Makefile | 70 ++++ .../@stdlib/blas/ext/base/zxdy/src/addon.c | 65 ++++ .../@stdlib/blas/ext/base/zxdy/src/main.c | 96 +++++ .../@stdlib/blas/ext/base/zxdy/test/test.js | 82 ++++ .../blas/ext/base/zxdy/test/test.ndarray.js | 321 ++++++++++++++++ .../ext/base/zxdy/test/test.ndarray.native.js | 330 +++++++++++++++++ .../blas/ext/base/zxdy/test/test.zxdy.js | 321 ++++++++++++++++ .../ext/base/zxdy/test/test.zxdy.native.js | 330 +++++++++++++++++ 33 files changed, 4481 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/include/stdlib/blas/ext/base/zxdy.h create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md b/lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md new file mode 100644 index 000000000000..531f5a84db36 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md @@ -0,0 +1,349 @@ + + +# zxdy + +> Divide elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assign the results to `y`. + +
+ +This BLAS extension implements the operation + + + +```math +\mathbf{y} = \mathbf{x} \oslash \mathbf{y} +``` + + + +
+ + + +
+ +## Usage + +```javascript +var zxdy = require( '@stdlib/blas/ext/base/zxdy' ); +``` + +#### zxdy( N, x, strideX, y, strideY ) + +Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + +zxdy( x.length, x, 1, y, 1 ); +// y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **x**: input [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: stride length for `x`. +- **y**: output [`Complex128Array`][@stdlib/array/complex128]. +- **strideY**: stride length for `y`. + +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to divide every other element of `x` by every other element of `y`: + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ 4.0, 6.0, 100.0, 200.0, 12.0, 8.0, 300.0, 400.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 500.0, 600.0, 2.0, 2.0, 700.0, 800.0 ] ); + +zxdy( 2, x, 2, y, 2 ); +// y => [ 5.0, 1.0, 500.0, 600.0, 5.0, -1.0, 700.0, 800.0 ] +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +// Initial arrays... +var x0 = new Complex128Array( [ 100.0, 200.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0, 300.0, 400.0 ] ); +var y0 = new Complex128Array( [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + +// Create offset views... +var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element + +zxdy( 3, x1, 1, y1, 1 ); +// y0 => [ 500.0, 600.0, 700.0, 800.0, 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +``` + +#### zxdy.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + +Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + +zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); +// y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. +- **offsetY**: starting index for `y`. + +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 divide the last three elements of `x` by the last three elements of `y`: + + + +```javascript +var Complex128Array = require( '@stdlib/array/complex128' ); + +var x = new Complex128Array( [ 100.0, 200.0, 300.0, 400.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +var y = new Complex128Array( [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + +zxdy.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3 ); +// y => [ 500.0, 600.0, 700.0, 800.0, 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, both functions return `y` unchanged. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var logEach = require( '@stdlib/console/log-each' ); +var zxdy = require( '@stdlib/blas/ext/base/zxdy' ); + +var xbuf = discreteUniform( 20, -100, 100, { + 'dtype': 'float64' +}); +var ybuf = discreteUniform( 20, 1, 100, { + 'dtype': 'float64' +}); +var x = new Complex128Array( xbuf.buffer ); +var y = new Complex128Array( ybuf.buffer ); + +zxdy( x.length, x, 1, y, 1 ); +logEach( '%s', y ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/zxdy.h" +``` + +#### stdlib_strided_zxdy( N, \*X, strideX, \*Y, strideY ) + +Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. + +```c +#include "stdlib/complex/float64/ctor.h" + +const double x[] = { 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 }; +double y[] = { 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 }; + +stdlib_strided_zxdy( 3, (stdlib_complex128_t *)x, 1, (stdlib_complex128_t *)y, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] stdlib_complex128_t*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **Y**: `[inout] stdlib_complex128_t*` output array. +- **strideY**: `[in] CBLAS_INT` stride length for `Y`. + +```c +void stdlib_strided_zxdy( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, stdlib_complex128_t *Y, const CBLAS_INT strideY ); +``` + + + +#### stdlib_strided_zxdy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY ) + + + +Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. + +```c +#include "stdlib/complex/float64/ctor.h" + +const double x[] = { 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 }; +double y[] = { 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 }; + +stdlib_strided_zxdy_ndarray( 3, (stdlib_complex128_t *)x, 1, 0, (stdlib_complex128_t *)y, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] stdlib_complex128_t*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **Y**: `[inout] stdlib_complex128_t*` output array. +- **strideY**: `[in] CBLAS_INT` stride length for `Y`. +- **offsetY**: `[in] CBLAS_INT` starting index for `Y`. + +```c +void stdlib_strided_zxdy_ndarray( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, stdlib_complex128_t *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/zxdy.h" +#include "stdlib/complex/float64/ctor.h" +#include "stdlib/complex/float64/real.h" +#include "stdlib/complex/float64/imag.h" +#include + +int main( void ) { + // Create strided arrays: + const stdlib_complex128_t x[] = { + stdlib_complex128( 4.0, 6.0 ), + stdlib_complex128( 12.0, 8.0 ), + stdlib_complex128( 16.0, 8.0 ), + stdlib_complex128( 32.0, 16.0 ) + }; + stdlib_complex128_t y[] = { + stdlib_complex128( 1.0, 1.0 ), + stdlib_complex128( 2.0, 2.0 ), + stdlib_complex128( 4.0, 4.0 ), + stdlib_complex128( 8.0, 8.0 ) + }; + + // Specify the number of indexed elements: + const int N = 4; + + // Specify strides: + const int strideX = 1; + const int strideY = 1; + + // Divide elements of `x` by the corresponding elements of `y`: + stdlib_strided_zxdy( N, x, strideX, y, strideY ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "y[ %i ] = %lf + %lfi\n", i, stdlib_complex128_real( y[ i ] ), stdlib_complex128_imag( y[ i ] ) ); + } +} +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js new file mode 100644 index 000000000000..8d2c00dd8d2b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 Complex128Array = require( '@stdlib/array/complex128' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var zxdy = require( './../lib/zxdy.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, -0.5, 0.5, options ); + x = new Complex128Array( xbuf.buffer ); + y = new Complex128Array( ybuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zxdy( x.length, x, 1, y, 1 ); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + 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( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js new file mode 100644 index 000000000000..060568460edb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js @@ -0,0 +1,117 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 Complex128Array = require( '@stdlib/array/complex128' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var zxdy = tryRequire( resolve( __dirname, './../lib/zxdy.native.js' ) ); +var opts = { + 'skip': ( zxdy instanceof Error ) +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, -0.5, 0.5, options ); + x = new Complex128Array( xbuf.buffer ); + y = new Complex128Array( ybuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zxdy( x.length, x, 1, y, 1 ); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + 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( format( '%s::native:len=%d', pkg, len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..22754ce192e7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 Complex128Array = require( '@stdlib/array/complex128' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var zxdy = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, -0.5, 0.5, options ); + x = new Complex128Array( xbuf.buffer ); + y = new Complex128Array( ybuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zxdy( x.length, x, 1, 0, y, 1, 0 ); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + 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( format( '%s:ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js new file mode 100644 index 000000000000..30852caf450d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js @@ -0,0 +1,117 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 Complex128Array = require( '@stdlib/array/complex128' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var zxdy = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( zxdy instanceof Error ) +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Create a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, -0.5, 0.5, options ); + x = new Complex128Array( xbuf.buffer ); + y = new Complex128Array( ybuf.buffer ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + zxdy( x.length, x, 1, 0, y, 1, 0 ); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( ybuf[ i%(len*2) ] ) ) { + 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( format( '%s::native:ndarray:len=%d', pkg, len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile new file mode 100644 index 000000000000..0756dc7da20a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# 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. +# 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/zxdy/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..bb9490bf9c92 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c @@ -0,0 +1,210 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/zxdy.h" +#include "stdlib/complex/float64/ctor.h" +#include +#include +#include +#include +#include + +#define NAME "zxdy" +#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 benchmarks results. +* +* @param iterations number of iterations +* @param elapsed elapsed time in seconds +*/ +static void print_results( int iterations, double elapsed ) { + double rate = (double)iterations / elapsed; + 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 number on the interval [min,max). +* +* @param min minimum value (inclusive) +* @param max maximum value (exclusive) +* @return random number +*/ +static double random_uniform( const double min, const double max ) { + double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); + return min + ( v*(max-min) ); +} + +/** +* Runs a benchmark. +* +* @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; + double *y; + double t; + int i; + + x = (double *)malloc( len * 2 * sizeof( double ) ); + y = (double *)malloc( len * 2 * sizeof( double ) ); + + for ( i = 0; i < len*2; i++ ) { + x[ i ] = random_uniform( -0.5, 0.5 ); + y[ i ] = random_uniform( -0.5, 0.5 ); + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + stdlib_strided_zxdy( len, (stdlib_complex128_t *)x, 1, (stdlib_complex128_t *)y, 1 ); + if ( y[ 0 ] != y[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y[ 0 ] != y[ 0 ] ) { + printf( "should not return NaN\n" ); + } + free( x ); + free( y ); + return elapsed; +} + +/** +* Runs a benchmark. +* +* @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; + double *y; + double t; + int i; + + x = (double *)malloc( len * 2 * sizeof( double ) ); + y = (double *)malloc( len * 2 * sizeof( double ) ); + + for ( i = 0; i < len*2; i++ ) { + x[ i ] = random_uniform( -0.5, 0.5 ); + y[ i ] = random_uniform( -0.5, 0.5 ); + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + stdlib_strided_zxdy_ndarray( len, (stdlib_complex128_t *)x, 1, 0, (stdlib_complex128_t *)y, 1, 0 ); + if ( y[ 0 ] != y[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y[ 0 ] != y[ 0 ] ) { + printf( "should not return NaN\n" ); + } + free( x ); + free( y ); + 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; + for ( i = MIN; i <= MAX; i++ ) { + len = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:len=%d\n", NAME, len ); + elapsed = benchmark1( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + for ( i = MIN; i <= MAX; i++ ) { + len = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:ndarray:len=%d\n", NAME, len ); + elapsed = benchmark2( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + print_summary( count, count ); +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp b/lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp new file mode 100644 index 000000000000..60dce9d0b31a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp @@ -0,0 +1,265 @@ +# @license Apache-2.0 +# +# 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. +# 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', + + # 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': [ + [ + '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 + + # 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: + { + '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/zxdy/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/repl.txt new file mode 100644 index 000000000000..9b81fecf9d49 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/repl.txt @@ -0,0 +1,127 @@ + +{{alias}}( N, x, strideX, y, strideY ) + Divides elements of a double-precision complex floating-point strided array + `x` by the corresponding elements of a double-precision complex floating- + point strided array `y` and assigns the results to `y`. + + The `N` and stride parameters determine which elements in the strided arrays + 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 `y` unchanged. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Complex128Array + Input array. + + strideX: integer + Stride length for `x`. + + y: Complex128Array + Output array. + + strideY: integer + Stride length for `y`. + + Returns + ------- + y: Complex128Array + Output array. + + Examples + -------- + // Standard Usage: + > var bufX = [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ]; + > var bufY = [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; + > var x = new {{alias:@stdlib/array/complex128}}( bufX ); + > var y = new {{alias:@stdlib/array/complex128}}( bufY ); + > {{alias}}( x.length, x, 1, y, 1 ) + [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] + + // Using `N` and stride parameters: + > bufX = [ 4.0, 6.0, 100.0, 200.0, 12.0, 8.0, 300.0, 400.0 ]; + > x = new {{alias:@stdlib/array/complex128}}( bufX ); + > bufY = [ 1.0, 1.0, 500.0, 600.0, 2.0, 2.0, 700.0, 800.0 ]; + > y = new {{alias:@stdlib/array/complex128}}( bufY ); + > {{alias}}( 2, x, 2, y, 2 ) + [ 5.0, 1.0, 500.0, 600.0, 5.0, -1.0, 700.0, 800.0 ] + + // Using view offsets: + > var bufX = [ 100.0, 200.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0, 300.0, 400.0 ]; + > var bufY = [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; + > var x0 = new {{alias:@stdlib/array/complex128}}( bufX ); + > var y0 = new {{alias:@stdlib/array/complex128}}( bufY ); + > var offsetX = x0.BYTES_PER_ELEMENT * 1; + > var offsetY = y0.BYTES_PER_ELEMENT * 2; + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, offsetX ); + > var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, offsetY ); + > {{alias}}( 3, x1, 1, y1, 1 ) + [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] + > y0 + [ 500, 600, 700, 800, 5, 1, 5, -1, 3, -1 ] + + +{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + Divides elements of a double-precision complex floating-point strided array + `x` by the corresponding elements of a double-precision complex floating- + point strided array `y` and assigns the results to `y` 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 + indices. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Complex128Array + Input array. + + strideX: integer + Stride length for `x`. + + offsetX: integer + Starting index for `x`. + + y: Complex128Array + Output array. + + strideY: integer + Stride length for `y`. + + offsetY: integer + Starting index for `y`. + + Returns + ------- + y: Complex128Array + Output array. + + Examples + -------- + // Standard Usage: + > var bufX = [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ]; + > var bufY = [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; + > var x = new {{alias:@stdlib/array/complex128}}( bufX ); + > var y = new {{alias:@stdlib/array/complex128}}( bufY ); + > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) + [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] + + // Using index offsets: + > bufX = [ 100.0, 200.0, 300.0, 400.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ]; + > x = new {{alias:@stdlib/array/complex128}}( bufX ); + > bufY = [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; + > y = new {{alias:@stdlib/array/complex128}}( bufY ); + > {{alias}}.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3 ) + [ 500, 600, 700, 800, 5, 1, 5, -1, 3, -1 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts new file mode 100644 index 000000000000..5c7f2629ac26 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts @@ -0,0 +1,107 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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 + +/// + +import { Complex128Array } from '@stdlib/types/array'; + +/** +* Interface describing `zxdy`. +*/ +interface Routine { + /** + * Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. + * + * @param N - number of indexed elements + * @param x - input array + * @param strideX - `x` stride length + * @param y - output array + * @param strideY - `y` stride length + * @returns output array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + * var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + * + * zxdy( x.length, x, 1, y, 1 ); + * // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] + */ + ( N: number, x: Complex128Array, strideX: number, y: Complex128Array, strideY: number ): Complex128Array; + + /** + * Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param x - input array + * @param strideX - `x` stride length + * @param offsetX - starting `x` index + * @param y - output array + * @param strideY - `y` stride length + * @param offsetY - starting `y` index + * @returns output array + * + * @example + * var Complex128Array = require( '@stdlib/array/complex128' ); + * + * var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + * var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + * + * zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); + * // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] + */ + ndarray( N: number, x: Complex128Array, strideX: number, offsetX: number, y: Complex128Array, strideY: number, offsetY: number ): Complex128Array; +} + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. +* +* @param N - number of indexed elements +* @param x - input array +* @param strideX - `x` stride length +* @param y - output array +* @param strideY - `y` stride length +* @returns output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy( x.length, x, 1, y, 1 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +*/ +declare var zxdy: Routine; + + +// EXPORTS // + +export = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts new file mode 100644 index 000000000000..c77c8035d0e1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts @@ -0,0 +1,247 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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 Complex128Array = require( '@stdlib/array/complex128' ); +import zxdy = require( './index' ); + + +// TESTS // + +// The function returns a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy( x.length, x, 1, y, 1 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy( '10', x, 1, y, 1 ); // $ExpectError + zxdy( true, x, 1, y, 1 ); // $ExpectError + zxdy( false, x, 1, y, 1 ); // $ExpectError + zxdy( null, x, 1, y, 1 ); // $ExpectError + zxdy( undefined, x, 1, y, 1 ); // $ExpectError + zxdy( [], x, 1, y, 1 ); // $ExpectError + zxdy( {}, x, 1, y, 1 ); // $ExpectError + zxdy( ( x: number ): number => x, x, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a Complex128Array... +{ + const y = new Complex128Array( 10 ); + + zxdy( 10, 10, 1, y, 1 ); // $ExpectError + zxdy( 10, '10', 1, y, 1 ); // $ExpectError + zxdy( 10, true, 1, y, 1 ); // $ExpectError + zxdy( 10, false, 1, y, 1 ); // $ExpectError + zxdy( 10, null, 1, y, 1 ); // $ExpectError + zxdy( 10, undefined, 1, y, 1 ); // $ExpectError + zxdy( 10, [ '1' ], 1, y, 1 ); // $ExpectError + zxdy( 10, {}, 1, y, 1 ); // $ExpectError + zxdy( 10, ( x: number ): number => x, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy( x.length, x, '10', y, 1 ); // $ExpectError + zxdy( x.length, x, true, y, 1 ); // $ExpectError + zxdy( x.length, x, false, y, 1 ); // $ExpectError + zxdy( x.length, x, null, y, 1 ); // $ExpectError + zxdy( x.length, x, undefined, y, 1 ); // $ExpectError + zxdy( x.length, x, [], y, 1 ); // $ExpectError + zxdy( x.length, x, {}, y, 1 ); // $ExpectError + zxdy( x.length, x, ( x: number ): number => x, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + + zxdy( 10, x, 1, 10, 1 ); // $ExpectError + zxdy( 10, x, 1, '10', 1 ); // $ExpectError + zxdy( 10, x, 1, true, 1 ); // $ExpectError + zxdy( 10, x, 1, false, 1 ); // $ExpectError + zxdy( 10, x, 1, null, 1 ); // $ExpectError + zxdy( 10, x, 1, undefined, 1 ); // $ExpectError + zxdy( 10, x, 1, [ '1' ], 1 ); // $ExpectError + zxdy( 10, x, 1, {}, 1 ); // $ExpectError + zxdy( 10, x, 1, ( x: number ): number => x, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy( x.length, x, 1, y, '10' ); // $ExpectError + zxdy( x.length, x, 1, y, true ); // $ExpectError + zxdy( x.length, x, 1, y, false ); // $ExpectError + zxdy( x.length, x, 1, y, null ); // $ExpectError + zxdy( x.length, x, 1, y, undefined ); // $ExpectError + zxdy( x.length, x, 1, y, [] ); // $ExpectError + zxdy( x.length, x, 1, y, {} ); // $ExpectError + zxdy( x.length, x, 1, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy(); // $ExpectError + zxdy( x.length ); // $ExpectError + zxdy( x.length, x ); // $ExpectError + zxdy( x.length, x, 1 ); // $ExpectError + zxdy( x.length, x, 1, y ); // $ExpectError + zxdy( x.length, x, 1, y, 1, 10 ); // $ExpectError +} + +// Attached to the main export is an `ndarray` method which returns a Complex128Array... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); // $ExpectType Complex128Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray( '10', x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( true, x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( false, x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( null, x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( undefined, x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( [], x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( {}, x, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex128Array... +{ + const y = new Complex128Array( 10 ); + + zxdy.ndarray( 10, 10, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, '10', 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, true, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, false, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, null, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, undefined, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, [ '1' ], 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, {}, 1, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, ( x: number ): number => x, 1, 0, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray( x.length, x, '10', 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, true, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, false, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, null, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, undefined, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, [], 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, {}, 0, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, ( x: number ): number => x, 0, y, 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray( x.length, x, 1, '10', y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, true, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, false, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, null, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, undefined, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, [], y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, {}, y, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, ( x: number ): number => x, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Complex128Array... +{ + const x = new Complex128Array( 10 ); + + zxdy.ndarray( 10, x, 1, 0, 10, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, '10', 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, true, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, false, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, null, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, undefined, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, [ '1' ], 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, {}, 1, 0 ); // $ExpectError + zxdy.ndarray( 10, x, 1, 0, ( 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray( x.length, x, 1, 0, y, '10', 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, true, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, false, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, null, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, undefined, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, [], 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, {}, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, ( 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 Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray( x.length, x, 1, 0, y, 1, '10' ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, true ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, false ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, null ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, undefined ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, [] ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, {} ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Complex128Array( 10 ); + const y = new Complex128Array( 10 ); + + zxdy.ndarray(); // $ExpectError + zxdy.ndarray( x.length ); // $ExpectError + zxdy.ndarray( x.length, x ); // $ExpectError + zxdy.ndarray( x.length, x, 1 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1 ); // $ExpectError + zxdy.ndarray( x.length, x, 1, 0, y, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# 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. +# 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/zxdy/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/example.c new file mode 100644 index 000000000000..d725c9c45cdd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/example.c @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/zxdy.h" +#include "stdlib/complex/float64/ctor.h" +#include "stdlib/complex/float64/real.h" +#include "stdlib/complex/float64/imag.h" +#include + +int main( void ) { + // Create strided arrays: + const stdlib_complex128_t x[] = { + stdlib_complex128( 4.0, 6.0 ), + stdlib_complex128( 12.0, 8.0 ), + stdlib_complex128( 16.0, 8.0 ), + stdlib_complex128( 32.0, 16.0 ) + }; + stdlib_complex128_t y[] = { + stdlib_complex128( 1.0, 1.0 ), + stdlib_complex128( 2.0, 2.0 ), + stdlib_complex128( 4.0, 4.0 ), + stdlib_complex128( 8.0, 8.0 ) + }; + + // Specify the number of indexed elements: + const int N = 4; + + // Specify strides: + const int strideX = 1; + const int strideY = 1; + + // Divide elements of `x` by the corresponding elements of `y`: + stdlib_strided_zxdy( N, x, strideX, y, strideY ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "y[ %i ] = %lf + %lfi\n", i, stdlib_complex128_real( y[ i ] ), stdlib_complex128_imag( y[ i ] ) ); + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js new file mode 100644 index 000000000000..9c4a623125df --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 Complex128Array = require( '@stdlib/array/complex128' ); +var logEach = require( '@stdlib/console/log-each' ); +var zxdy = require( './../lib' ); + +var xbuf = discreteUniform( 20, -100, 100, { + 'dtype': 'float64' +}); +var ybuf = discreteUniform( 20, 1, 100, { + 'dtype': 'float64' +}); +var x = new Complex128Array( xbuf.buffer ); +var y = new Complex128Array( ybuf.buffer ); + +zxdy( x.length, x, 1, y, 1 ); +logEach( '%s', y ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi new file mode 100644 index 000000000000..bee8d41a2caf --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi @@ -0,0 +1,53 @@ +# @license Apache-2.0 +# +# 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. +# 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': [ + ' [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* var zxdy = require( '@stdlib/blas/ext/base/zxdy' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.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 zxdy; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + zxdy = main; +} else { + zxdy = tmp; +} + + +// EXPORTS // + +module.exports = zxdy; + +// exports: { "ndarray": "zxdy.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js new file mode 100644 index 000000000000..48885674c0eb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 zxdy = require( './zxdy.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( zxdy, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js new file mode 100644 index 000000000000..4c08cfc8d771 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 zxdy = require( './zxdy.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( zxdy, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js new file mode 100644 index 000000000000..bde3adcf5aa2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js @@ -0,0 +1,118 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var cdiv = require( '@stdlib/complex/float64/base/div' ).assign; + + +// VARIABLES // + +var M = 5; + + +// MAIN // + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {Complex128Array} y - output array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @returns {Complex128Array} output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy( x.length, x, 1, 0, y, 1, 0 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +*/ +function zxdy( N, x, strideX, offsetX, y, strideY, offsetY ) { + var xview; + var yview; + var ix; + var iy; + var sx; + var sy; + var m; + var i; + + if ( N <= 0 ) { + return y; + } + + // Reinterpret the complex input arrays as real-valued arrays: + xview = reinterpret( x, 0 ); + yview = reinterpret( y, 0 ); + + // Adjust the strides and offsets according to the real-valued arrays: + ix = offsetX * 2; + iy = offsetY * 2; + sx = strideX * 2; + sy = strideY * 2; + + // Use loop unrolling if both strides are equal to `1`... + if ( strideX === 1 && strideY === 1 ) { + m = N % M; + + // If we have a remainder, run a clean-up loop... + if ( m > 0 ) { + for ( i = 0; i < m; i++ ) { + cdiv( xview[ ix ], xview[ ix+1 ], yview[ iy ], yview[ iy+1 ], yview, 1, iy ); + ix += sx; + iy += sy; + } + } + if ( N < M ) { + return y; + } + for ( i = m; i < N; i += M ) { + cdiv( xview[ ix ], xview[ ix+1 ], yview[ iy ], yview[ iy+1 ], yview, 1, iy ); + cdiv( xview[ ix+2 ], xview[ ix+3 ], yview[ iy+2 ], yview[ iy+3 ], yview, 1, iy+2 ); + cdiv( xview[ ix+4 ], xview[ ix+5 ], yview[ iy+4 ], yview[ iy+5 ], yview, 1, iy+4 ); + cdiv( xview[ ix+6 ], xview[ ix+7 ], yview[ iy+6 ], yview[ iy+7 ], yview, 1, iy+6 ); + cdiv( xview[ ix+8 ], xview[ ix+9 ], yview[ iy+8 ], yview[ iy+9 ], yview, 1, iy+8 ); + ix += M * 2; + iy += M * 2; + } + return y; + } + for ( i = 0; i < N; i++ ) { + cdiv( xview[ ix ], xview[ ix+1 ], yview[ iy ], yview[ iy+1 ], yview, 1, iy ); + ix += sx; + iy += sy; + } + return y; +} + + +// EXPORTS // + +module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js new file mode 100644 index 000000000000..24d25a31056d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index +* @param {Complex128Array} y - output array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting `y` index +* @returns {Complex128Array} output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy( x.length, x, 1, 0, y, 1, 0 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +*/ +function zxdy( N, x, strideX, offsetX, y, strideY, offsetY ) { + var viewX = reinterpret( x, 0 ); + var viewY = reinterpret( y, 0 ); + addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY ); + return y; +} + + +// EXPORTS // + +module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js new file mode 100644 index 000000000000..a3e39de7078e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js @@ -0,0 +1,55 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {Complex128Array} y - output array +* @param {integer} strideY - `y` stride length +* @returns {Complex128Array} output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy( x.length, x, 1, y, 1 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +*/ +function zxdy( N, x, strideX, y, strideY ) { + return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js new file mode 100644 index 000000000000..da11193ea533 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js @@ -0,0 +1,58 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {Complex128Array} y - output array +* @param {integer} strideY - `y` stride length +* @returns {Complex128Array} output array +* +* @example +* var Complex128Array = require( '@stdlib/array/complex128' ); +* +* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); +* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); +* +* zxdy( x.length, x, 1, y, 1 ); +* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] +*/ +function zxdy( N, x, strideX, y, strideY ) { + var viewX = reinterpret( x, 0 ); + var viewY = reinterpret( y, 0 ); + addon( N, viewX, strideX, viewY, strideY ); + return y; +} + + +// EXPORTS // + +module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json new file mode 100644 index 000000000000..9c77abf3ddfb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json @@ -0,0 +1,108 @@ +{ + "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/complex/float64/base/div", + "@stdlib/complex/float64/ctor", + "@stdlib/strided/base/stride2offset", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex128array" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/complex/float64/base/div", + "@stdlib/complex/float64/ctor", + "@stdlib/strided/base/stride2offset" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/complex/float64/base/div", + "@stdlib/complex/float64/real", + "@stdlib/complex/float64/imag", + "@stdlib/complex/float64/ctor", + "@stdlib/strided/base/stride2offset" + ] + }, + { + "task": "build", + "wasm": true, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/complex/float64/base/div", + "@stdlib/complex/float64/ctor", + "@stdlib/strided/base/stride2offset" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json b/lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json new file mode 100644 index 000000000000..16ce305b60ae --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json @@ -0,0 +1,83 @@ +{ + "name": "@stdlib/blas/ext/base/zxdy", + "version": "0.0.0", + "description": "Divide elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assign the results to `y`.", + "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", + "linear", + "algebra", + "subroutines", + "divide", + "division", + "transform", + "strided", + "array", + "ndarray", + "vector", + "xdy", + "zxdy", + "complex", + "complex128", + "complex128array", + "float64", + "double" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# 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. +# 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/zxdy/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/addon.c new file mode 100644 index 000000000000..4d0c3225c45f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/addon.c @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/zxdy.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_complex128array.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, 5 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, Y, N, strideY, argv, 3 ); + API_SUFFIX(stdlib_strided_zxdy)( N, (stdlib_complex128_t *)X, strideX, (stdlib_complex128_t *)Y, strideY ); + 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, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, Y, N, strideY, argv, 4 ); + API_SUFFIX(stdlib_strided_zxdy_ndarray)( N, (stdlib_complex128_t *)X, strideX, offsetX, (stdlib_complex128_t *)Y, strideY, offsetY ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c new file mode 100644 index 000000000000..77642d39bb91 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c @@ -0,0 +1,96 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/zxdy.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/complex/float64/base/div.h" +#include "stdlib/strided/base/stride2offset.h" + +static const CBLAS_INT M = 5; + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. +* +* @param N number of indexed elements +* @param X input array +* @param strideX stride length for `X` +* @param Y output array +* @param strideY stride length for `Y` +*/ +void API_SUFFIX(stdlib_strided_zxdy)( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, stdlib_complex128_t *Y, const CBLAS_INT strideY ) { + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY ); + API_SUFFIX(stdlib_strided_zxdy_ndarray)( N, X, strideX, ox, Y, strideY, oy ); +} + +/** +* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X input array +* @param strideX stride length for `X` +* @param offsetX starting index for `X` +* @param Y output array +* @param strideY stride length for `Y` +* @param offsetY starting index for `Y` +*/ +void API_SUFFIX(stdlib_strided_zxdy_ndarray)( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, stdlib_complex128_t *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) { + CBLAS_INT ix; + CBLAS_INT iy; + CBLAS_INT m; + CBLAS_INT i; + + if ( N <= 0 ) { + return; + } + ix = offsetX; + iy = offsetY; + + // Use loop unrolling if both strides are equal to `1`... + if ( strideX == 1 && strideY == 1 ) { + m = N % M; + + // If we have a remainder, run a clean-up loop... + if ( m > 0 ) { + for ( i = 0; i < m; i++ ) { + Y[ iy ] = stdlib_base_complex128_div( X[ ix ], Y[ iy ] ); + ix += strideX; + iy += strideY; + } + } + if ( N < M ) { + return; + } + for ( i = m; i < N; i += M ) { + Y[ iy ] = stdlib_base_complex128_div( X[ ix ], Y[ iy ] ); + Y[ iy+1 ] = stdlib_base_complex128_div( X[ ix+1 ], Y[ iy+1 ] ); + Y[ iy+2 ] = stdlib_base_complex128_div( X[ ix+2 ], Y[ iy+2 ] ); + Y[ iy+3 ] = stdlib_base_complex128_div( X[ ix+3 ], Y[ iy+3 ] ); + Y[ iy+4 ] = stdlib_base_complex128_div( X[ ix+4 ], Y[ iy+4 ] ); + ix += M; + iy += M; + } + return; + } + for ( i = 0; i < N; i++ ) { + Y[ iy ] = stdlib_base_complex128_div( X[ ix ], Y[ iy ] ); + ix += strideX; + iy += strideY; + } + return; +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js new file mode 100644 index 000000000000..bc6877df1d0a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var zxdy = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zxdy, '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 zxdy.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 zxdy = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zxdy, mock, 'returns native implementation' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var zxdy; + var main; + + main = require( './../lib/zxdy.js' ); + + zxdy = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( zxdy, main, 'returns JavaScript implementation' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js new file mode 100644 index 000000000000..86708894a971 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js @@ -0,0 +1,321 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable stdlib/empty-line-before-comment */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var cdiv = require( '@stdlib/complex/float64/base/div' ); +var zxdy = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( zxdy.length, 7, 'has expected arity' ); + t.end(); +}); + +tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); + expected = new Complex128Array([ + // (4.0+2.0i) / (1.0+1.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0 + ]); + + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the output array', function test( t ) { + var out; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + out = zxdy( x.length, x, 1, 0, y, 1, 0 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + + zxdy( 0, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + zxdy( -4, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 4.0, // 0 + 6.0, // 0 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 16.0, // 2 + 8.0 // 2 + ]); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 2, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array([ + 1.0, // 0 + 1.0, // 0 + 4.0, + 5.0, + 2.0, // 1 + 2.0, // 1 + 8.0, + 9.0, + 4.0, // 2 + 4.0 // 2 + ]); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + 4.0, + 5.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + 8.0, + 9.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 1, 0, y, 2, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 16.0, // 2 + 8.0, // 2 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 4.0, // 0 + 6.0 // 0 + ]); + y = new Complex128Array([ + 4.0, // 2 + 4.0, // 2 + 2.0, // 1 + 2.0, // 1 + 1.0, // 0 + 1.0 // 0 + ]); + expected = new Complex128Array([ + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0 + ]); + + zxdy( 3, x, -2, 4, y, -1, 2 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var expected; + var x0; + var y0; + var x1; + var y1; + + x0 = new Complex128Array([ + 10.0, + 0.0, + 4.0, // 0 + 6.0, // 0 + 12.0, // 1 + 8.0, // 1 + 16.0, // 2 + 8.0 // 2 + ]); + y0 = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + 1.0, // 0 + 1.0, // 0 + 2.0, // 1 + 2.0, // 1 + 4.0, // 2 + 4.0 // 2 + ]); + + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); + + expected = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x1, 1, 0, y1, 1, 0 ); + t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { + var expected; + var xv; + var yv; + var x; + var y; + var i; + + x = new Complex128Array( 100 ); + y = new Complex128Array( 100 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( 240 ); + y = new Complex128Array( 240 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js new file mode 100644 index 000000000000..b051c743d7ed --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js @@ -0,0 +1,330 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable stdlib/empty-line-before-comment */ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var cdiv = require( '@stdlib/complex/float64/base/div' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var zxdy = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( zxdy instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', opts, function test( t ) { + t.strictEqual( zxdy.length, 7, 'has expected arity' ); + t.end(); +}); + +tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); + expected = new Complex128Array([ + // (4.0+2.0i) / (1.0+1.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0 + ]); + + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the output array', opts, function test( t ) { + var out; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + out = zxdy( x.length, x, 1, 0, y, 1, 0 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + + zxdy( 0, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + zxdy( -4, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 4.0, // 0 + 6.0, // 0 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 16.0, // 2 + 8.0 // 2 + ]); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 2, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array([ + 1.0, // 0 + 1.0, // 0 + 4.0, + 5.0, + 2.0, // 1 + 2.0, // 1 + 8.0, + 9.0, + 4.0, // 2 + 4.0 // 2 + ]); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + 4.0, + 5.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + 8.0, + 9.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 1, 0, y, 2, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 16.0, // 2 + 8.0, // 2 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 4.0, // 0 + 6.0 // 0 + ]); + y = new Complex128Array([ + 4.0, // 2 + 4.0, // 2 + 2.0, // 1 + 2.0, // 1 + 1.0, // 0 + 1.0 // 0 + ]); + expected = new Complex128Array([ + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0 + ]); + + zxdy( 3, x, -2, 4, y, -1, 2 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', opts, function test( t ) { + var expected; + var x0; + var y0; + var x1; + var y1; + + x0 = new Complex128Array([ + 10.0, + 0.0, + 4.0, // 0 + 6.0, // 0 + 12.0, // 1 + 8.0, // 1 + 16.0, // 2 + 8.0 // 2 + ]); + y0 = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + 1.0, // 0 + 1.0, // 0 + 2.0, // 1 + 2.0, // 1 + 4.0, // 2 + 4.0 // 2 + ]); + + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); + + expected = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x1, 1, 0, y1, 1, 0 ); + t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { + var expected; + var xv; + var yv; + var x; + var y; + var i; + + x = new Complex128Array( 100 ); + y = new Complex128Array( 100 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( 240 ); + y = new Complex128Array( 240 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js new file mode 100644 index 000000000000..dfbcb6a8c937 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js @@ -0,0 +1,321 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable stdlib/empty-line-before-comment */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var cdiv = require( '@stdlib/complex/float64/base/div' ); +var zxdy = require( './../lib/zxdy.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', function test( t ) { + t.strictEqual( zxdy.length, 5, 'has expected arity' ); + t.end(); +}); + +tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); + expected = new Complex128Array([ + // (4.0+2.0i) / (1.0+1.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0 + ]); + + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the output array', function test( t ) { + var out; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + out = zxdy( x.length, x, 1, y, 1 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + + zxdy( 0, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + zxdy( -4, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 4.0, // 0 + 6.0, // 0 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 16.0, // 2 + 8.0 // 2 + ]); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 2, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array([ + 1.0, // 0 + 1.0, // 0 + 4.0, + 5.0, + 2.0, // 1 + 2.0, // 1 + 8.0, + 9.0, + 4.0, // 2 + 4.0 // 2 + ]); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + 4.0, + 5.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + 8.0, + 9.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 1, y, 2 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 16.0, // 2 + 8.0, // 2 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 4.0, // 0 + 6.0 // 0 + ]); + y = new Complex128Array([ + 4.0, // 2 + 4.0, // 2 + 2.0, // 1 + 2.0, // 1 + 1.0, // 0 + 1.0 // 0 + ]); + expected = new Complex128Array([ + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0 + ]); + + zxdy( 3, x, -2, y, -1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var expected; + var x0; + var y0; + var x1; + var y1; + + x0 = new Complex128Array([ + 10.0, + 0.0, + 4.0, // 0 + 6.0, // 0 + 12.0, // 1 + 8.0, // 1 + 16.0, // 2 + 8.0 // 2 + ]); + y0 = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + 1.0, // 0 + 1.0, // 0 + 2.0, // 1 + 2.0, // 1 + 4.0, // 2 + 4.0 // 2 + ]); + + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); + + expected = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x1, 1, y1, 1 ); + t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { + var expected; + var xv; + var yv; + var x; + var y; + var i; + + x = new Complex128Array( 100 ); + y = new Complex128Array( 100 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( 240 ); + y = new Complex128Array( 240 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js new file mode 100644 index 000000000000..ae0c3ad9055a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js @@ -0,0 +1,330 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable stdlib/empty-line-before-comment */ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); +var Complex128Array = require( '@stdlib/array/complex128' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); +var cdiv = require( '@stdlib/complex/float64/base/div' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var zxdy = tryRequire( resolve( __dirname, './../lib/zxdy.native.js' ) ); +var opts = { + 'skip': ( zxdy instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', opts, function test( t ) { + t.strictEqual( zxdy.length, 5, 'has expected arity' ); + t.end(); +}); + +tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); + expected = new Complex128Array([ + // (4.0+2.0i) / (1.0+1.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0 + ]); + + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the output array', opts, function test( t ) { + var out; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + out = zxdy( x.length, x, 1, y, 1 ); + + t.strictEqual( out, y, 'same reference' ); + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + + zxdy( 0, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + zxdy( -4, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports an `x` stride', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 4.0, // 0 + 6.0, // 0 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 16.0, // 2 + 8.0 // 2 + ]); + y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 2, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); + y = new Complex128Array([ + 1.0, // 0 + 1.0, // 0 + 4.0, + 5.0, + 2.0, // 1 + 2.0, // 1 + 8.0, + 9.0, + 4.0, // 2 + 4.0 // 2 + ]); + expected = new Complex128Array([ + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + 4.0, + 5.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + 8.0, + 9.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x, 1, y, 2 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', opts, function test( t ) { + var expected; + var x; + var y; + + x = new Complex128Array([ + 16.0, // 2 + 8.0, // 2 + 0.0, + 0.0, + 12.0, // 1 + 8.0, // 1 + 0.0, + 0.0, + 4.0, // 0 + 6.0 // 0 + ]); + y = new Complex128Array([ + 4.0, // 2 + 4.0, // 2 + 2.0, // 1 + 2.0, // 1 + 1.0, // 0 + 1.0 // 0 + ]); + expected = new Complex128Array([ + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0 + ]); + + zxdy( 3, x, -2, y, -1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', opts, function test( t ) { + var expected; + var x0; + var y0; + var x1; + var y1; + + x0 = new Complex128Array([ + 10.0, + 0.0, + 4.0, // 0 + 6.0, // 0 + 12.0, // 1 + 8.0, // 1 + 16.0, // 2 + 8.0 // 2 + ]); + y0 = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + 1.0, // 0 + 1.0, // 0 + 2.0, // 1 + 2.0, // 1 + 4.0, // 2 + 4.0 // 2 + ]); + + x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); + + expected = new Complex128Array([ + 10.0, + 0.0, + 10.0, + 0.0, + // (4.0+6.0i) / (1.0+1.0i) + 5.0, + 1.0, + // (12.0+8.0i) / (2.0+2.0i) + 5.0, + -1.0, + // (16.0+8.0i) / (4.0+4.0i) + 3.0, + -1.0 + ]); + + zxdy( 3, x1, 1, y1, 1 ); + t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { + var expected; + var xv; + var yv; + var x; + var y; + var i; + + x = new Complex128Array( 100 ); + y = new Complex128Array( 100 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + x = new Complex128Array( 240 ); + y = new Complex128Array( 240 ); + expected = new Complex128Array( x.length ); + for ( i = 0; i < x.length; i++ ) { + xv = new Complex128( i, 0.0 ); + yv = new Complex128( x.length - i, 0.0 ); + x.set( xv, i ); + y.set( yv, i ); + expected.set( cdiv( xv, yv ), i ); + } + zxdy( x.length, x, 1, y, 1 ); + t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); + + t.end(); +}); From 5aab6cd642a5fdf74c1937de1cbb598be80d4e02 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 19 Jul 2026 12:08:24 -0700 Subject: [PATCH 2/4] bench: avoid division by zero --- 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: na - 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: passed - 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/zxdy/benchmark/benchmark.js | 2 +- .../@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js | 2 +- .../@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js | 2 +- .../blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js | 2 +- .../@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js index 8d2c00dd8d2b..fe4b4146d82b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js @@ -53,7 +53,7 @@ function createBenchmark( len ) { var y; xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, 1.0, 10.0, options ); x = new Complex128Array( xbuf.buffer ); y = new Complex128Array( ybuf.buffer ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js index 060568460edb..244c29d15336 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js @@ -58,7 +58,7 @@ function createBenchmark( len ) { var y; xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, 1.0, 10.0, options ); x = new Complex128Array( xbuf.buffer ); y = new Complex128Array( ybuf.buffer ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js index 22754ce192e7..13b5f8dd83e9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js @@ -53,7 +53,7 @@ function createBenchmark( len ) { var y; xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, 1.0, 10.0, options ); x = new Complex128Array( xbuf.buffer ); y = new Complex128Array( ybuf.buffer ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js index 30852caf450d..78aa1b125b52 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js @@ -58,7 +58,7 @@ function createBenchmark( len ) { var y; xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, -0.5, 0.5, options ); + ybuf = uniform( len*2, 1.0, 10.0, options ); x = new Complex128Array( xbuf.buffer ); y = new Complex128Array( ybuf.buffer ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c index bb9490bf9c92..25807aa2f438 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c @@ -109,7 +109,7 @@ static double benchmark1( int iterations, int len ) { for ( i = 0; i < len*2; i++ ) { x[ i ] = random_uniform( -0.5, 0.5 ); - y[ i ] = random_uniform( -0.5, 0.5 ); + y[ i ] = random_uniform( 1.0, 10.0 ); } t = tic(); for ( i = 0; i < iterations; i++ ) { @@ -148,7 +148,7 @@ static double benchmark2( int iterations, int len ) { for ( i = 0; i < len*2; i++ ) { x[ i ] = random_uniform( -0.5, 0.5 ); - y[ i ] = random_uniform( -0.5, 0.5 ); + y[ i ] = random_uniform( 1.0, 10.0 ); } t = tic(); for ( i = 0; i < iterations; i++ ) { From ae48b2fcb66a8ccab21ef5c3cbddbb86c0a1ad81 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 19 Jul 2026 12:22:59 -0700 Subject: [PATCH 3/4] feat: add `blas/ext/base/ndarray/dxdy` --- 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: 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: 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: passed - task: lint_license_headers status: passed --- --- .../blas/ext/base/ndarray/dxdy/README.md | 127 ++++++++++ .../base/ndarray/dxdy/benchmark/benchmark.js | 103 ++++++++ .../blas/ext/base/ndarray/dxdy/docs/repl.txt | 35 +++ .../base/ndarray/dxdy/docs/types/index.d.ts | 52 ++++ .../ext/base/ndarray/dxdy/docs/types/test.ts | 63 +++++ .../ext/base/ndarray/dxdy/examples/index.js | 36 +++ .../blas/ext/base/ndarray/dxdy/lib/index.js | 44 ++++ .../blas/ext/base/ndarray/dxdy/lib/main.js | 67 +++++ .../blas/ext/base/ndarray/dxdy/package.json | 73 ++++++ .../blas/ext/base/ndarray/dxdy/test/test.js | 234 ++++++++++++++++++ 10 files changed, 834 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/test/test.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/README.md new file mode 100644 index 000000000000..acb0ff1bac43 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/README.md @@ -0,0 +1,127 @@ + + +# dxdy + +> Divide elements of a one-dimensional double-precision floating-point ndarray by the corresponding elements of a second one-dimensional double-precision floating-point ndarray and assign the results to the second ndarray. + +
+ +This BLAS extension implements the operation + + + +```math +\mathbf{y} = \mathbf{x} \oslash \mathbf{y} +``` + + + +
+ + + +
+ +## Usage + +```javascript +var dxdy = require( '@stdlib/blas/ext/base/ndarray/dxdy' ); +``` + +#### dxdy( arrays ) + +Divides elements of a one-dimensional double-precision floating-point ndarray by the corresponding elements of a second one-dimensional double-precision floating-point ndarray and assigns the results to the second ndarray. + +```javascript +var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); + +var x = new Float64Vector( [ 6.0, 12.0, 20.0, 30.0, 42.0 ] ); +var y = new Float64Vector( [ 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + +dxdy( [ x, y ] ); +// y => [ 3.0, 4.0, 5.0, 6.0, 7.0 ] +``` + +The function has the following parameters: + +- **arrays**: array-like object containing the following ndarrays: + + - a one-dimensional input ndarray. + - a one-dimensional output ndarray. + +
+ + + +
+ +## Notes + +- The output ndarray is modified **in-place** (i.e., the output ndarray is **mutated**). + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var dxdy = require( '@stdlib/blas/ext/base/ndarray/dxdy' ); + +var opts = { + 'dtype': 'float64' +}; + +var x = discreteUniform( [ 10 ], 1, 100, opts ); +console.log( ndarray2array( x ) ); + +var y = discreteUniform( [ 10 ], 1, 100, opts ); +console.log( ndarray2array( y ) ); + +dxdy( [ x, y ] ); +console.log( ndarray2array( y ) ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/benchmark/benchmark.js new file mode 100644 index 000000000000..40413474122c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/benchmark/benchmark.js @@ -0,0 +1,103 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/uniform' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dxdy = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - ndarray length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = uniform( [ len ], -100.0, 100.0, options ); + var y = uniform( [ len ], 1.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = dxdy( [ x, y ] ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( typeof out !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + 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( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/repl.txt new file mode 100644 index 000000000000..90cb76ad819f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/repl.txt @@ -0,0 +1,35 @@ + +{{alias}}( arrays ) + Divides elements of a one-dimensional double-precision floating-point + ndarray by the corresponding elements of a second one-dimensional double- + precision floating-point ndarray and assigns the results to the second + ndarray. + + The output ndarray is modified *in-place* (i.e., the output ndarray is + *mutated*). + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing the following ndarrays: + + - a one-dimensional input ndarray. + - a one-dimensional output ndarray. + + Returns + ------- + out: ndarray + Output ndarray. + + Examples + -------- + > var xbuf = [ 6.0, 12.0, 20.0, 30.0 ]; + > var x = new {{alias:@stdlib/ndarray/vector/float64}}( xbuf ); + > var ybuf = [ 2.0, 3.0, 4.0, 5.0 ]; + > var y = new {{alias:@stdlib/ndarray/vector/float64}}( ybuf ); + > {{alias}}( [ x, y ] ) + [ 3.0, 4.0, 5.0, 6.0 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/index.d.ts new file mode 100644 index 000000000000..4177bbeda47c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/index.d.ts @@ -0,0 +1,52 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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 + +/// + +import { float64ndarray } from '@stdlib/types/ndarray'; + +/** +* Divides elements of a one-dimensional double-precision floating-point ndarray by the corresponding elements of a second one-dimensional double-precision floating-point ndarray and assigns the results to the second ndarray. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a one-dimensional input ndarray. +* - a one-dimensional output ndarray. +* +* @param arrays - array-like object containing ndarrays +* @returns output ndarray +* +* @example +* var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +* +* var x = new Float64Vector( [ 6.0, 12.0, 20.0, 30.0, 42.0 ] ); +* var y = new Float64Vector( [ 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* var out = dxdy( [ x, y ] ); +* // returns [ 3.0, 4.0, 5.0, 6.0, 7.0 ] +*/ +declare function dxdy( arrays: [ float64ndarray, float64ndarray ] ): float64ndarray; + + +// EXPORTS // + +export = dxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/test.ts new file mode 100644 index 000000000000..3007f4485335 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/docs/types/test.ts @@ -0,0 +1,63 @@ +/* +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/* eslint-disable space-in-parens */ + +import zeros = require( '@stdlib/ndarray/zeros' ); +import dxdy = require( './index' ); + + +// TESTS // + +// The function returns an ndarray... +{ + const x = zeros( [ 10 ], { + 'dtype': 'float64' + }); + const y = zeros( [ 10 ], { + 'dtype': 'float64' + }); + + dxdy( [ x, y ] ); // $ExpectType float64ndarray +} + +// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... +{ + dxdy( '10' ); // $ExpectError + dxdy( 5 ); // $ExpectError + dxdy( true ); // $ExpectError + dxdy( false ); // $ExpectError + dxdy( null ); // $ExpectError + dxdy( undefined ); // $ExpectError + dxdy( [] ); // $ExpectError + dxdy( {} ); // $ExpectError + dxdy( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 10 ], { + 'dtype': 'float64' + }); + const y = zeros( [ 10 ], { + 'dtype': 'float64' + }); + + dxdy(); // $ExpectError + dxdy( [ x, y ], {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/examples/index.js new file mode 100644 index 000000000000..9323ff136a47 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/examples/index.js @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/discrete-uniform' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var dxdy = require( './../lib' ); + +var opts = { + 'dtype': 'float64' +}; + +var x = discreteUniform( [ 10 ], 1, 100, opts ); +console.log( ndarray2array( x ) ); + +var y = discreteUniform( [ 10 ], 1, 100, opts ); +console.log( ndarray2array( y ) ); + +dxdy( [ x, y ] ); +console.log( ndarray2array( y ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/index.js new file mode 100644 index 000000000000..0292b7e5d543 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/index.js @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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'; + +/** +* Divide elements of a one-dimensional double-precision floating-point ndarray by the corresponding elements of a second one-dimensional double-precision floating-point ndarray and assign the results to the second ndarray. +* +* @module @stdlib/blas/ext/base/ndarray/dxdy +* +* @example +* var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +* var dxdy = require( '@stdlib/blas/ext/base/ndarray/dxdy' ); +* +* var x = new Float64Vector( [ 6.0, 12.0, 20.0, 30.0, 42.0 ] ); +* var y = new Float64Vector( [ 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* var out = dxdy( [ x, y ] ); +* // returns [ 3.0, 4.0, 5.0, 6.0, 7.0 ] +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/main.js new file mode 100644 index 000000000000..643e65dcbf7f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/lib/main.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); +var getStride = require( '@stdlib/ndarray/base/stride' ); +var getOffset = require( '@stdlib/ndarray/base/offset' ); +var getData = require( '@stdlib/ndarray/base/data-buffer' ); +var strided = require( '@stdlib/blas/ext/base/dxdy' ).ndarray; + + +// MAIN // + +/** +* Divides elements of a one-dimensional double-precision floating-point ndarray by the corresponding elements of a second one-dimensional double-precision floating-point ndarray and assigns the results to the second ndarray. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a one-dimensional input ndarray. +* - a one-dimensional output ndarray. +* +* @param {ArrayLikeObject} arrays - array-like object containing ndarrays +* @returns {ndarray} output ndarray +* +* @example +* var Float64Vector = require( '@stdlib/ndarray/vector/float64' ); +* +* var x = new Float64Vector( [ 6.0, 12.0, 20.0, 30.0, 42.0 ] ); +* var y = new Float64Vector( [ 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* var out = dxdy( [ x, y ] ); +* // returns [ 3.0, 4.0, 5.0, 6.0, 7.0 ] +*/ +function dxdy( arrays ) { + var x; + var y; + + x = arrays[ 0 ]; + y = arrays[ 1 ]; + strided( numelDimension( x, 0 ), getData( x ), getStride( x, 0 ), getOffset( x ), getData( y ), getStride( y, 0 ), getOffset( y ) ); // eslint-disable-line max-len + return y; +} + + +// EXPORTS // + +module.exports = dxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/package.json b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/package.json new file mode 100644 index 000000000000..23f3e58ec14c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/blas/ext/base/ndarray/dxdy", + "version": "0.0.0", + "description": "Divide elements of a one-dimensional double-precision floating-point ndarray by the corresponding elements of a second one-dimensional double-precision floating-point ndarray and assign the results to the second ndarray.", + "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", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "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", + "ext", + "dxdy", + "xdy", + "divide", + "division", + "quotient", + "vector", + "strided", + "array", + "ndarray", + "float64", + "double", + "double-precision" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/test/test.js new file mode 100644 index 000000000000..1189096b5463 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/dxdy/test/test.js @@ -0,0 +1,234 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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 ndarray = require( '@stdlib/ndarray/base/ctor' ); +var dxdy = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns a one-dimensional ndarray. +* +* @private +* @param {Float64Array} buffer - underlying data buffer +* @param {NonNegativeInteger} length - number of indexed elements +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {ndarray} one-dimensional ndarray +*/ +function vector( buffer, length, stride, offset ) { + return new ndarray( 'float64', buffer, [ length ], [ stride ], offset, 'row-major' ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dxdy, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 1', function test( t ) { + t.strictEqual( dxdy.length, 1, 'has expected arity' ); + t.end(); +}); + +tape( 'the function divides `x` by `y` and assigns the results to `y`', function test( t ) { + var expected; + var actual; + var xbuf; + var ybuf; + var x; + var y; + + xbuf = new Float64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0 ] ); + ybuf = new Float64Array( [ 1.0, 2.0, -3.0, 4.0, -1.0 ] ); + x = vector( xbuf, 5, 1, 0 ); + y = vector( ybuf, 5, 1, 0 ); + expected = new Float64Array([ + -2.0, // -2.0 / 1.0 + 0.5, // 1.0 / 2.0 + -1.0, // 3.0 / (-3.0) + -1.25, // -5.0 / 4.0 + -4.0 // 4.0 / (-1.0) + ]); + + actual = dxdy( [ x, y ] ); + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports input ndarrays having non-unit strides', function test( t ) { + var expected; + var actual; + var xbuf; + var ybuf; + var x; + var y; + + xbuf = new Float64Array([ + -2.0, // 0 + 1.0, + 3.0, // 1 + -5.0, + 4.0, // 2 + 0.0, + 6.0, // 3 + -3.0 + ]); + ybuf = new Float64Array([ + 1.0, // 0 + 2.0, + -3.0, // 1 + 4.0, + -1.0, // 2 + 0.0, + 2.0, // 3 + 2.0 + ]); + x = vector( xbuf, 4, 2, 0 ); + y = vector( ybuf, 4, 2, 0 ); + expected = new Float64Array([ + -2.0, // -2.0 / 1.0 + 2.0, + -1.0, // 3.0 / (-3.0) + 4.0, + -4.0, // 4.0 / (-1.0) + 0.0, + 3.0, // 6.0 / 2.0 + 2.0 + ]); + + actual = dxdy( [ x, y ] ); + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports input ndarrays having negative strides', function test( t ) { + var expected; + var actual; + var xbuf; + var ybuf; + var x; + var y; + + xbuf = new Float64Array([ + -2.0, // 4 + 1.0, // 3 + 3.0, // 2 + -5.0, // 1 + 4.0 // 0 + ]); + ybuf = new Float64Array([ + 1.0, // 4 + 2.0, // 3 + -3.0, // 2 + 4.0, // 1 + -1.0 // 0 + ]); + x = vector( xbuf, 5, -1, 4 ); + y = vector( ybuf, 5, -1, 4 ); + expected = new Float64Array([ + -2.0, // -2.0 / 1.0 + 0.5, // 1.0 / 2.0 + -1.0, // 3.0 / (-3.0) + -1.25, // -5.0 / 4.0 + -4.0 // 4.0 / (-1.0) + ]); + + actual = dxdy( [ x, y ] ); + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports input ndarrays having non-zero offsets', function test( t ) { + var expected; + var actual; + var xbuf; + var ybuf; + var x; + var y; + + xbuf = new Float64Array([ + 1.0, + -2.0, + 3.0, // 0 + -5.0, // 1 + 4.0, // 2 + 0.0 + ]); + ybuf = new Float64Array([ + 1.0, + -2.0, + 1.0, // 0 + 4.0, // 1 + -1.0, // 2 + 0.0 + ]); + x = vector( xbuf, 3, 1, 2 ); + y = vector( ybuf, 3, 1, 2 ); + expected = new Float64Array([ + 1.0, + -2.0, + 3.0, // 3.0 / 1.0 + -1.25, // -5.0 / 4.0 + -4.0, // 4.0 / (-1.0) + 0.0 + ]); + + actual = dxdy( [ x, y ] ); + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the output ndarray unchanged when the input ndarrays are empty', function test( t ) { + var expected; + var actual; + var xbuf; + var ybuf; + var x; + var y; + + xbuf = new Float64Array( [] ); + ybuf = new Float64Array( [] ); + x = vector( xbuf, 0, 1, 0 ); + y = vector( ybuf, 0, 1, 0 ); + expected = new Float64Array( [] ); + + actual = dxdy( [ x, y ] ); + t.strictEqual( actual, y, 'returns expected value' ); + t.deepEqual( ybuf, expected, 'returns expected value' ); + + t.end(); +}); From bc2627bfaf22cb30be44aeb13df9bced96262cce Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sun, 19 Jul 2026 12:26:57 -0700 Subject: [PATCH 4/4] chore: remove redundant files --- 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: 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 --- --- .../@stdlib/blas/ext/base/zxdy/README.md | 349 ------------------ .../blas/ext/base/zxdy/benchmark/benchmark.js | 112 ------ .../base/zxdy/benchmark/benchmark.native.js | 117 ------ .../base/zxdy/benchmark/benchmark.ndarray.js | 112 ------ .../benchmark/benchmark.ndarray.native.js | 117 ------ .../blas/ext/base/zxdy/benchmark/c/Makefile | 146 -------- .../base/zxdy/benchmark/c/benchmark.length.c | 210 ----------- .../@stdlib/blas/ext/base/zxdy/binding.gyp | 265 ------------- .../@stdlib/blas/ext/base/zxdy/docs/repl.txt | 127 ------- .../blas/ext/base/zxdy/docs/types/index.d.ts | 107 ------ .../blas/ext/base/zxdy/docs/types/test.ts | 247 ------------- .../blas/ext/base/zxdy/examples/c/Makefile | 146 -------- .../blas/ext/base/zxdy/examples/c/example.c | 54 --- .../blas/ext/base/zxdy/examples/index.js | 36 -- .../@stdlib/blas/ext/base/zxdy/include.gypi | 53 --- .../zxdy/include/stdlib/blas/ext/base/zxdy.h | 46 --- .../@stdlib/blas/ext/base/zxdy/lib/index.js | 70 ---- .../@stdlib/blas/ext/base/zxdy/lib/main.js | 35 -- .../@stdlib/blas/ext/base/zxdy/lib/native.js | 35 -- .../@stdlib/blas/ext/base/zxdy/lib/ndarray.js | 118 ------ .../blas/ext/base/zxdy/lib/ndarray.native.js | 60 --- .../@stdlib/blas/ext/base/zxdy/lib/zxdy.js | 55 --- .../blas/ext/base/zxdy/lib/zxdy.native.js | 58 --- .../@stdlib/blas/ext/base/zxdy/manifest.json | 108 ------ .../@stdlib/blas/ext/base/zxdy/package.json | 83 ----- .../@stdlib/blas/ext/base/zxdy/src/Makefile | 70 ---- .../@stdlib/blas/ext/base/zxdy/src/addon.c | 65 ---- .../@stdlib/blas/ext/base/zxdy/src/main.c | 96 ----- .../@stdlib/blas/ext/base/zxdy/test/test.js | 82 ---- .../blas/ext/base/zxdy/test/test.ndarray.js | 321 ---------------- .../ext/base/zxdy/test/test.ndarray.native.js | 330 ----------------- .../blas/ext/base/zxdy/test/test.zxdy.js | 321 ---------------- .../ext/base/zxdy/test/test.zxdy.native.js | 330 ----------------- 33 files changed, 4481 deletions(-) delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/repl.txt delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/example.c delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/include/stdlib/blas/ext/base/zxdy.h delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/index.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/src/addon.c delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js delete mode 100644 lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md b/lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md deleted file mode 100644 index 531f5a84db36..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/README.md +++ /dev/null @@ -1,349 +0,0 @@ - - -# zxdy - -> Divide elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assign the results to `y`. - -
- -This BLAS extension implements the operation - - - -```math -\mathbf{y} = \mathbf{x} \oslash \mathbf{y} -``` - - - -
- - - -
- -## Usage - -```javascript -var zxdy = require( '@stdlib/blas/ext/base/zxdy' ); -``` - -#### zxdy( N, x, strideX, y, strideY ) - -Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. - -```javascript -var Complex128Array = require( '@stdlib/array/complex128' ); - -var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - -zxdy( x.length, x, 1, y, 1 ); -// y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -``` - -The function has the following parameters: - -- **N**: number of indexed elements. -- **x**: input [`Complex128Array`][@stdlib/array/complex128]. -- **strideX**: stride length for `x`. -- **y**: output [`Complex128Array`][@stdlib/array/complex128]. -- **strideY**: stride length for `y`. - -The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to divide every other element of `x` by every other element of `y`: - - - -```javascript -var Complex128Array = require( '@stdlib/array/complex128' ); - -var x = new Complex128Array( [ 4.0, 6.0, 100.0, 200.0, 12.0, 8.0, 300.0, 400.0 ] ); -var y = new Complex128Array( [ 1.0, 1.0, 500.0, 600.0, 2.0, 2.0, 700.0, 800.0 ] ); - -zxdy( 2, x, 2, y, 2 ); -// y => [ 5.0, 1.0, 500.0, 600.0, 5.0, -1.0, 700.0, 800.0 ] -``` - -Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. - - - -```javascript -var Complex128Array = require( '@stdlib/array/complex128' ); - -// Initial arrays... -var x0 = new Complex128Array( [ 100.0, 200.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0, 300.0, 400.0 ] ); -var y0 = new Complex128Array( [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - -// Create offset views... -var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element - -zxdy( 3, x1, 1, y1, 1 ); -// y0 => [ 500.0, 600.0, 700.0, 800.0, 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -``` - -#### zxdy.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) - -Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. - -```javascript -var Complex128Array = require( '@stdlib/array/complex128' ); - -var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - -zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); -// y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -``` - -The function has the following additional parameters: - -- **offsetX**: starting index for `x`. -- **offsetY**: starting index for `y`. - -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 divide the last three elements of `x` by the last three elements of `y`: - - - -```javascript -var Complex128Array = require( '@stdlib/array/complex128' ); - -var x = new Complex128Array( [ 100.0, 200.0, 300.0, 400.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -var y = new Complex128Array( [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - -zxdy.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3 ); -// y => [ 500.0, 600.0, 700.0, 800.0, 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -``` - -
- - - -
- -## Notes - -- If `N <= 0`, both functions return `y` unchanged. - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var logEach = require( '@stdlib/console/log-each' ); -var zxdy = require( '@stdlib/blas/ext/base/zxdy' ); - -var xbuf = discreteUniform( 20, -100, 100, { - 'dtype': 'float64' -}); -var ybuf = discreteUniform( 20, 1, 100, { - 'dtype': 'float64' -}); -var x = new Complex128Array( xbuf.buffer ); -var y = new Complex128Array( ybuf.buffer ); - -zxdy( x.length, x, 1, y, 1 ); -logEach( '%s', y ); -``` - -
- - - - - -* * * - -
- -## C APIs - - - -
- -
- - - - - -
- -### Usage - -```c -#include "stdlib/blas/ext/base/zxdy.h" -``` - -#### stdlib_strided_zxdy( N, \*X, strideX, \*Y, strideY ) - -Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. - -```c -#include "stdlib/complex/float64/ctor.h" - -const double x[] = { 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 }; -double y[] = { 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 }; - -stdlib_strided_zxdy( 3, (stdlib_complex128_t *)x, 1, (stdlib_complex128_t *)y, 1 ); -``` - -The function accepts the following arguments: - -- **N**: `[in] CBLAS_INT` number of indexed elements. -- **X**: `[in] stdlib_complex128_t*` input array. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. -- **Y**: `[inout] stdlib_complex128_t*` output array. -- **strideY**: `[in] CBLAS_INT` stride length for `Y`. - -```c -void stdlib_strided_zxdy( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, stdlib_complex128_t *Y, const CBLAS_INT strideY ); -``` - - - -#### stdlib_strided_zxdy_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY ) - - - -Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. - -```c -#include "stdlib/complex/float64/ctor.h" - -const double x[] = { 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 }; -double y[] = { 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 }; - -stdlib_strided_zxdy_ndarray( 3, (stdlib_complex128_t *)x, 1, 0, (stdlib_complex128_t *)y, 1, 0 ); -``` - -The function accepts the following arguments: - -- **N**: `[in] CBLAS_INT` number of indexed elements. -- **X**: `[in] stdlib_complex128_t*` input array. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. -- **offsetX**: `[in] CBLAS_INT` starting index for `X`. -- **Y**: `[inout] stdlib_complex128_t*` output array. -- **strideY**: `[in] CBLAS_INT` stride length for `Y`. -- **offsetY**: `[in] CBLAS_INT` starting index for `Y`. - -```c -void stdlib_strided_zxdy_ndarray( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, stdlib_complex128_t *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ); -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```c -#include "stdlib/blas/ext/base/zxdy.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" -#include - -int main( void ) { - // Create strided arrays: - const stdlib_complex128_t x[] = { - stdlib_complex128( 4.0, 6.0 ), - stdlib_complex128( 12.0, 8.0 ), - stdlib_complex128( 16.0, 8.0 ), - stdlib_complex128( 32.0, 16.0 ) - }; - stdlib_complex128_t y[] = { - stdlib_complex128( 1.0, 1.0 ), - stdlib_complex128( 2.0, 2.0 ), - stdlib_complex128( 4.0, 4.0 ), - stdlib_complex128( 8.0, 8.0 ) - }; - - // Specify the number of indexed elements: - const int N = 4; - - // Specify strides: - const int strideX = 1; - const int strideY = 1; - - // Divide elements of `x` by the corresponding elements of `y`: - stdlib_strided_zxdy( N, x, strideX, y, strideY ); - - // Print the result: - for ( int i = 0; i < N; i++ ) { - printf( "y[ %i ] = %lf + %lfi\n", i, stdlib_complex128_real( y[ i ] ), stdlib_complex128_imag( y[ i ] ) ); - } -} -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js deleted file mode 100644 index fe4b4146d82b..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.js +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 Complex128Array = require( '@stdlib/array/complex128' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var zxdy = require( './../lib/zxdy.js' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// FUNCTIONS // - -/** -* Create a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var xbuf; - var ybuf; - var x; - var y; - - xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, 1.0, 10.0, options ); - x = new Complex128Array( xbuf.buffer ); - y = new Complex128Array( ybuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - zxdy( x.length, x, 1, y, 1 ); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - 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( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js deleted file mode 100644 index 244c29d15336..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.native.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 Complex128Array = require( '@stdlib/array/complex128' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var zxdy = tryRequire( resolve( __dirname, './../lib/zxdy.native.js' ) ); -var opts = { - 'skip': ( zxdy instanceof Error ) -}; -var options = { - 'dtype': 'float64' -}; - - -// FUNCTIONS // - -/** -* Create a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var xbuf; - var ybuf; - var x; - var y; - - xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, 1.0, 10.0, options ); - x = new Complex128Array( xbuf.buffer ); - y = new Complex128Array( ybuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - zxdy( x.length, x, 1, y, 1 ); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - 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( format( '%s::native:len=%d', pkg, len ), opts, f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js deleted file mode 100644 index 13b5f8dd83e9..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.js +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 Complex128Array = require( '@stdlib/array/complex128' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; -var zxdy = require( './../lib/ndarray.js' ); - - -// VARIABLES // - -var options = { - 'dtype': 'float64' -}; - - -// FUNCTIONS // - -/** -* Create a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var xbuf; - var ybuf; - var x; - var y; - - xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, 1.0, 10.0, options ); - x = new Complex128Array( xbuf.buffer ); - y = new Complex128Array( ybuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - zxdy( x.length, x, 1, 0, y, 1, 0 ); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - 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( format( '%s:ndarray:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js deleted file mode 100644 index 78aa1b125b52..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/benchmark.ndarray.native.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 Complex128Array = require( '@stdlib/array/complex128' ); -var tryRequire = require( '@stdlib/utils/try-require' ); -var format = require( '@stdlib/string/format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var zxdy = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); -var opts = { - 'skip': ( zxdy instanceof Error ) -}; -var options = { - 'dtype': 'float64' -}; - - -// FUNCTIONS // - -/** -* Create a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var xbuf; - var ybuf; - var x; - var y; - - xbuf = uniform( len*2, -0.5, 0.5, options ); - ybuf = uniform( len*2, 1.0, 10.0, options ); - x = new Complex128Array( xbuf.buffer ); - y = new Complex128Array( ybuf.buffer ); - - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - zxdy( x.length, x, 1, 0, y, 1, 0 ); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( ybuf[ i%(len*2) ] ) ) { - 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( format( '%s::native:ndarray:len=%d', pkg, len ), opts, f ); - } -} - -main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile deleted file mode 100644 index 0756dc7da20a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# 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. -# 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/zxdy/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c deleted file mode 100644 index 25807aa2f438..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/benchmark/c/benchmark.length.c +++ /dev/null @@ -1,210 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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/zxdy.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include -#include -#include - -#define NAME "zxdy" -#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 benchmarks results. -* -* @param iterations number of iterations -* @param elapsed elapsed time in seconds -*/ -static void print_results( int iterations, double elapsed ) { - double rate = (double)iterations / elapsed; - 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 number on the interval [min,max). -* -* @param min minimum value (inclusive) -* @param max maximum value (exclusive) -* @return random number -*/ -static double random_uniform( const double min, const double max ) { - double v = (double)rand() / ( (double)RAND_MAX + 1.0 ); - return min + ( v*(max-min) ); -} - -/** -* Runs a benchmark. -* -* @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; - double *y; - double t; - int i; - - x = (double *)malloc( len * 2 * sizeof( double ) ); - y = (double *)malloc( len * 2 * sizeof( double ) ); - - for ( i = 0; i < len*2; i++ ) { - x[ i ] = random_uniform( -0.5, 0.5 ); - y[ i ] = random_uniform( 1.0, 10.0 ); - } - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - stdlib_strided_zxdy( len, (stdlib_complex128_t *)x, 1, (stdlib_complex128_t *)y, 1 ); - if ( y[ 0 ] != y[ 0 ] ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( y[ 0 ] != y[ 0 ] ) { - printf( "should not return NaN\n" ); - } - free( x ); - free( y ); - return elapsed; -} - -/** -* Runs a benchmark. -* -* @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; - double *y; - double t; - int i; - - x = (double *)malloc( len * 2 * sizeof( double ) ); - y = (double *)malloc( len * 2 * sizeof( double ) ); - - for ( i = 0; i < len*2; i++ ) { - x[ i ] = random_uniform( -0.5, 0.5 ); - y[ i ] = random_uniform( 1.0, 10.0 ); - } - t = tic(); - for ( i = 0; i < iterations; i++ ) { - // cppcheck-suppress uninitvar - stdlib_strided_zxdy_ndarray( len, (stdlib_complex128_t *)x, 1, 0, (stdlib_complex128_t *)y, 1, 0 ); - if ( y[ 0 ] != y[ 0 ] ) { - printf( "should not return NaN\n" ); - break; - } - } - elapsed = tic() - t; - if ( y[ 0 ] != y[ 0 ] ) { - printf( "should not return NaN\n" ); - } - free( x ); - free( y ); - 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; - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i-1 ); - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::%s:len=%d\n", NAME, len ); - elapsed = benchmark1( iter, len ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - for ( i = MIN; i <= MAX; i++ ) { - len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i-1 ); - for ( j = 0; j < REPEATS; j++ ) { - count += 1; - printf( "# c::%s:ndarray:len=%d\n", NAME, len ); - elapsed = benchmark2( iter, len ); - print_results( iter, elapsed ); - printf( "ok %d benchmark finished\n", count ); - } - } - print_summary( count, count ); -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp b/lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp deleted file mode 100644 index 60dce9d0b31a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/binding.gyp +++ /dev/null @@ -1,265 +0,0 @@ -# @license Apache-2.0 -# -# 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. -# 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', - - # 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': [ - [ - '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 - - # 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: - { - '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/zxdy/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/repl.txt deleted file mode 100644 index 9b81fecf9d49..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/repl.txt +++ /dev/null @@ -1,127 +0,0 @@ - -{{alias}}( N, x, strideX, y, strideY ) - Divides elements of a double-precision complex floating-point strided array - `x` by the corresponding elements of a double-precision complex floating- - point strided array `y` and assigns the results to `y`. - - The `N` and stride parameters determine which elements in the strided arrays - 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 `y` unchanged. - - Parameters - ---------- - N: integer - Number of indexed elements. - - x: Complex128Array - Input array. - - strideX: integer - Stride length for `x`. - - y: Complex128Array - Output array. - - strideY: integer - Stride length for `y`. - - Returns - ------- - y: Complex128Array - Output array. - - Examples - -------- - // Standard Usage: - > var bufX = [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ]; - > var bufY = [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; - > var x = new {{alias:@stdlib/array/complex128}}( bufX ); - > var y = new {{alias:@stdlib/array/complex128}}( bufY ); - > {{alias}}( x.length, x, 1, y, 1 ) - [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] - - // Using `N` and stride parameters: - > bufX = [ 4.0, 6.0, 100.0, 200.0, 12.0, 8.0, 300.0, 400.0 ]; - > x = new {{alias:@stdlib/array/complex128}}( bufX ); - > bufY = [ 1.0, 1.0, 500.0, 600.0, 2.0, 2.0, 700.0, 800.0 ]; - > y = new {{alias:@stdlib/array/complex128}}( bufY ); - > {{alias}}( 2, x, 2, y, 2 ) - [ 5.0, 1.0, 500.0, 600.0, 5.0, -1.0, 700.0, 800.0 ] - - // Using view offsets: - > var bufX = [ 100.0, 200.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0, 300.0, 400.0 ]; - > var bufY = [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; - > var x0 = new {{alias:@stdlib/array/complex128}}( bufX ); - > var y0 = new {{alias:@stdlib/array/complex128}}( bufY ); - > var offsetX = x0.BYTES_PER_ELEMENT * 1; - > var offsetY = y0.BYTES_PER_ELEMENT * 2; - > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, offsetX ); - > var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, offsetY ); - > {{alias}}( 3, x1, 1, y1, 1 ) - [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] - > y0 - [ 500, 600, 700, 800, 5, 1, 5, -1, 3, -1 ] - - -{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) - Divides elements of a double-precision complex floating-point strided array - `x` by the corresponding elements of a double-precision complex floating- - point strided array `y` and assigns the results to `y` 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 - indices. - - Parameters - ---------- - N: integer - Number of indexed elements. - - x: Complex128Array - Input array. - - strideX: integer - Stride length for `x`. - - offsetX: integer - Starting index for `x`. - - y: Complex128Array - Output array. - - strideY: integer - Stride length for `y`. - - offsetY: integer - Starting index for `y`. - - Returns - ------- - y: Complex128Array - Output array. - - Examples - -------- - // Standard Usage: - > var bufX = [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ]; - > var bufY = [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; - > var x = new {{alias:@stdlib/array/complex128}}( bufX ); - > var y = new {{alias:@stdlib/array/complex128}}( bufY ); - > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) - [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] - - // Using index offsets: - > bufX = [ 100.0, 200.0, 300.0, 400.0, 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ]; - > x = new {{alias:@stdlib/array/complex128}}( bufX ); - > bufY = [ 500.0, 600.0, 700.0, 800.0, 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ]; - > y = new {{alias:@stdlib/array/complex128}}( bufY ); - > {{alias}}.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3 ) - [ 500, 600, 700, 800, 5, 1, 5, -1, 3, -1 ] - - See Also - -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts deleted file mode 100644 index 5c7f2629ac26..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/index.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* -* @license Apache-2.0 -* -* 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. -* 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 - -/// - -import { Complex128Array } from '@stdlib/types/array'; - -/** -* Interface describing `zxdy`. -*/ -interface Routine { - /** - * Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. - * - * @param N - number of indexed elements - * @param x - input array - * @param strideX - `x` stride length - * @param y - output array - * @param strideY - `y` stride length - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array/complex128' ); - * - * var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - * var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - * - * zxdy( x.length, x, 1, y, 1 ); - * // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] - */ - ( N: number, x: Complex128Array, strideX: number, y: Complex128Array, strideY: number ): Complex128Array; - - /** - * Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. - * - * @param N - number of indexed elements - * @param x - input array - * @param strideX - `x` stride length - * @param offsetX - starting `x` index - * @param y - output array - * @param strideY - `y` stride length - * @param offsetY - starting `y` index - * @returns output array - * - * @example - * var Complex128Array = require( '@stdlib/array/complex128' ); - * - * var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - * var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - * - * zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); - * // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] - */ - ndarray( N: number, x: Complex128Array, strideX: number, offsetX: number, y: Complex128Array, strideY: number, offsetY: number ): Complex128Array; -} - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. -* -* @param N - number of indexed elements -* @param x - input array -* @param strideX - `x` stride length -* @param y - output array -* @param strideY - `y` stride length -* @returns output array -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy( x.length, x, 1, y, 1 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -*/ -declare var zxdy: Routine; - - -// EXPORTS // - -export = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts deleted file mode 100644 index c77c8035d0e1..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/docs/types/test.ts +++ /dev/null @@ -1,247 +0,0 @@ -/* -* @license Apache-2.0 -* -* 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. -* 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 Complex128Array = require( '@stdlib/array/complex128' ); -import zxdy = require( './index' ); - - -// TESTS // - -// The function returns a Complex128Array... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy( x.length, x, 1, y, 1 ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a number... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy( '10', x, 1, y, 1 ); // $ExpectError - zxdy( true, x, 1, y, 1 ); // $ExpectError - zxdy( false, x, 1, y, 1 ); // $ExpectError - zxdy( null, x, 1, y, 1 ); // $ExpectError - zxdy( undefined, x, 1, y, 1 ); // $ExpectError - zxdy( [], x, 1, y, 1 ); // $ExpectError - zxdy( {}, x, 1, y, 1 ); // $ExpectError - zxdy( ( x: number ): number => x, x, 1, y, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a Complex128Array... -{ - const y = new Complex128Array( 10 ); - - zxdy( 10, 10, 1, y, 1 ); // $ExpectError - zxdy( 10, '10', 1, y, 1 ); // $ExpectError - zxdy( 10, true, 1, y, 1 ); // $ExpectError - zxdy( 10, false, 1, y, 1 ); // $ExpectError - zxdy( 10, null, 1, y, 1 ); // $ExpectError - zxdy( 10, undefined, 1, y, 1 ); // $ExpectError - zxdy( 10, [ '1' ], 1, y, 1 ); // $ExpectError - zxdy( 10, {}, 1, y, 1 ); // $ExpectError - zxdy( 10, ( x: number ): number => x, 1, y, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument which is not a number... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy( x.length, x, '10', y, 1 ); // $ExpectError - zxdy( x.length, x, true, y, 1 ); // $ExpectError - zxdy( x.length, x, false, y, 1 ); // $ExpectError - zxdy( x.length, x, null, y, 1 ); // $ExpectError - zxdy( x.length, x, undefined, y, 1 ); // $ExpectError - zxdy( x.length, x, [], y, 1 ); // $ExpectError - zxdy( x.length, x, {}, y, 1 ); // $ExpectError - zxdy( x.length, x, ( x: number ): number => x, y, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fourth argument which is not a Complex128Array... -{ - const x = new Complex128Array( 10 ); - - zxdy( 10, x, 1, 10, 1 ); // $ExpectError - zxdy( 10, x, 1, '10', 1 ); // $ExpectError - zxdy( 10, x, 1, true, 1 ); // $ExpectError - zxdy( 10, x, 1, false, 1 ); // $ExpectError - zxdy( 10, x, 1, null, 1 ); // $ExpectError - zxdy( 10, x, 1, undefined, 1 ); // $ExpectError - zxdy( 10, x, 1, [ '1' ], 1 ); // $ExpectError - zxdy( 10, x, 1, {}, 1 ); // $ExpectError - zxdy( 10, x, 1, ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a fifth argument which is not a number... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy( x.length, x, 1, y, '10' ); // $ExpectError - zxdy( x.length, x, 1, y, true ); // $ExpectError - zxdy( x.length, x, 1, y, false ); // $ExpectError - zxdy( x.length, x, 1, y, null ); // $ExpectError - zxdy( x.length, x, 1, y, undefined ); // $ExpectError - zxdy( x.length, x, 1, y, [] ); // $ExpectError - zxdy( x.length, x, 1, y, {} ); // $ExpectError - zxdy( x.length, x, 1, y, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy(); // $ExpectError - zxdy( x.length ); // $ExpectError - zxdy( x.length, x ); // $ExpectError - zxdy( x.length, x, 1 ); // $ExpectError - zxdy( x.length, x, 1, y ); // $ExpectError - zxdy( x.length, x, 1, y, 1, 10 ); // $ExpectError -} - -// Attached to the main export is an `ndarray` method which returns a Complex128Array... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray( '10', x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( true, x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( false, x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( null, x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( undefined, x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( [], x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( {}, x, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex128Array... -{ - const y = new Complex128Array( 10 ); - - zxdy.ndarray( 10, 10, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, '10', 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, true, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, false, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, null, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, undefined, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, [ '1' ], 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, {}, 1, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, ( x: number ): number => x, 1, 0, y, 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 Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray( x.length, x, '10', 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, true, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, false, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, null, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, undefined, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, [], 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, {}, 0, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, ( x: number ): number => x, 0, y, 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 Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray( x.length, x, 1, '10', y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, true, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, false, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, null, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, undefined, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, [], y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, {}, y, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, ( x: number ): number => x, y, 1, 0 ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Complex128Array... -{ - const x = new Complex128Array( 10 ); - - zxdy.ndarray( 10, x, 1, 0, 10, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, '10', 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, true, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, false, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, null, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, undefined, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, [ '1' ], 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, {}, 1, 0 ); // $ExpectError - zxdy.ndarray( 10, x, 1, 0, ( 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 Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray( x.length, x, 1, 0, y, '10', 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, true, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, false, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, null, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, undefined, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, [], 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, {}, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, ( 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 Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray( x.length, x, 1, 0, y, 1, '10' ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, true ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, false ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, null ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, undefined ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, [] ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, {} ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... -{ - const x = new Complex128Array( 10 ); - const y = new Complex128Array( 10 ); - - zxdy.ndarray(); // $ExpectError - zxdy.ndarray( x.length ); // $ExpectError - zxdy.ndarray( x.length, x ); // $ExpectError - zxdy.ndarray( x.length, x, 1 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1 ); // $ExpectError - zxdy.ndarray( x.length, x, 1, 0, y, 1, 0, 10 ); // $ExpectError -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile deleted file mode 100644 index c8f8e9a1517b..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -#/ -# @license Apache-2.0 -# -# 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. -# 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/zxdy/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/example.c deleted file mode 100644 index d725c9c45cdd..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/c/example.c +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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/zxdy.h" -#include "stdlib/complex/float64/ctor.h" -#include "stdlib/complex/float64/real.h" -#include "stdlib/complex/float64/imag.h" -#include - -int main( void ) { - // Create strided arrays: - const stdlib_complex128_t x[] = { - stdlib_complex128( 4.0, 6.0 ), - stdlib_complex128( 12.0, 8.0 ), - stdlib_complex128( 16.0, 8.0 ), - stdlib_complex128( 32.0, 16.0 ) - }; - stdlib_complex128_t y[] = { - stdlib_complex128( 1.0, 1.0 ), - stdlib_complex128( 2.0, 2.0 ), - stdlib_complex128( 4.0, 4.0 ), - stdlib_complex128( 8.0, 8.0 ) - }; - - // Specify the number of indexed elements: - const int N = 4; - - // Specify strides: - const int strideX = 1; - const int strideY = 1; - - // Divide elements of `x` by the corresponding elements of `y`: - stdlib_strided_zxdy( N, x, strideX, y, strideY ); - - // Print the result: - for ( int i = 0; i < N; i++ ) { - printf( "y[ %i ] = %lf + %lfi\n", i, stdlib_complex128_real( y[ i ] ), stdlib_complex128_imag( y[ i ] ) ); - } -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js deleted file mode 100644 index 9c4a623125df..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 Complex128Array = require( '@stdlib/array/complex128' ); -var logEach = require( '@stdlib/console/log-each' ); -var zxdy = require( './../lib' ); - -var xbuf = discreteUniform( 20, -100, 100, { - 'dtype': 'float64' -}); -var ybuf = discreteUniform( 20, 1, 100, { - 'dtype': 'float64' -}); -var x = new Complex128Array( xbuf.buffer ); -var y = new Complex128Array( ybuf.buffer ); - -zxdy( x.length, x, 1, y, 1 ); -logEach( '%s', y ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi deleted file mode 100644 index bee8d41a2caf..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/include.gypi +++ /dev/null @@ -1,53 +0,0 @@ -# @license Apache-2.0 -# -# 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. -# 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': [ - ' [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* var zxdy = require( '@stdlib/blas/ext/base/zxdy' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy.ndarray( x.length, x, 1, 0, y, 1, 0 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.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 zxdy; -var tmp = tryRequire( join( __dirname, './native.js' ) ); -if ( isError( tmp ) ) { - zxdy = main; -} else { - zxdy = tmp; -} - - -// EXPORTS // - -module.exports = zxdy; - -// exports: { "ndarray": "zxdy.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js deleted file mode 100644 index 48885674c0eb..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/main.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 zxdy = require( './zxdy.js' ); -var ndarray = require( './ndarray.js' ); - - -// MAIN // - -setReadOnly( zxdy, 'ndarray', ndarray ); - - -// EXPORTS // - -module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js deleted file mode 100644 index 4c08cfc8d771..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/native.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 zxdy = require( './zxdy.native.js' ); -var ndarray = require( './ndarray.native.js' ); - - -// MAIN // - -setReadOnly( zxdy, 'ndarray', ndarray ); - - -// EXPORTS // - -module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js deleted file mode 100644 index bde3adcf5aa2..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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. -*/ - -/* eslint-disable max-len */ - -'use strict'; - -// MODULES // - -var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); -var cdiv = require( '@stdlib/complex/float64/base/div' ).assign; - - -// VARIABLES // - -var M = 5; - - -// MAIN // - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. -* -* @param {PositiveInteger} N - number of indexed elements -* @param {Complex128Array} x - input array -* @param {integer} strideX - `x` stride length -* @param {NonNegativeInteger} offsetX - starting `x` index -* @param {Complex128Array} y - output array -* @param {integer} strideY - `y` stride length -* @param {NonNegativeInteger} offsetY - starting `y` index -* @returns {Complex128Array} output array -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy( x.length, x, 1, 0, y, 1, 0 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -*/ -function zxdy( N, x, strideX, offsetX, y, strideY, offsetY ) { - var xview; - var yview; - var ix; - var iy; - var sx; - var sy; - var m; - var i; - - if ( N <= 0 ) { - return y; - } - - // Reinterpret the complex input arrays as real-valued arrays: - xview = reinterpret( x, 0 ); - yview = reinterpret( y, 0 ); - - // Adjust the strides and offsets according to the real-valued arrays: - ix = offsetX * 2; - iy = offsetY * 2; - sx = strideX * 2; - sy = strideY * 2; - - // Use loop unrolling if both strides are equal to `1`... - if ( strideX === 1 && strideY === 1 ) { - m = N % M; - - // If we have a remainder, run a clean-up loop... - if ( m > 0 ) { - for ( i = 0; i < m; i++ ) { - cdiv( xview[ ix ], xview[ ix+1 ], yview[ iy ], yview[ iy+1 ], yview, 1, iy ); - ix += sx; - iy += sy; - } - } - if ( N < M ) { - return y; - } - for ( i = m; i < N; i += M ) { - cdiv( xview[ ix ], xview[ ix+1 ], yview[ iy ], yview[ iy+1 ], yview, 1, iy ); - cdiv( xview[ ix+2 ], xview[ ix+3 ], yview[ iy+2 ], yview[ iy+3 ], yview, 1, iy+2 ); - cdiv( xview[ ix+4 ], xview[ ix+5 ], yview[ iy+4 ], yview[ iy+5 ], yview, 1, iy+4 ); - cdiv( xview[ ix+6 ], xview[ ix+7 ], yview[ iy+6 ], yview[ iy+7 ], yview, 1, iy+6 ); - cdiv( xview[ ix+8 ], xview[ ix+9 ], yview[ iy+8 ], yview[ iy+9 ], yview, 1, iy+8 ); - ix += M * 2; - iy += M * 2; - } - return y; - } - for ( i = 0; i < N; i++ ) { - cdiv( xview[ ix ], xview[ ix+1 ], yview[ iy ], yview[ iy+1 ], yview, 1, iy ); - ix += sx; - iy += sy; - } - return y; -} - - -// EXPORTS // - -module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js deleted file mode 100644 index 24d25a31056d..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/ndarray.native.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. -* -* @param {PositiveInteger} N - number of indexed elements -* @param {Complex128Array} x - input array -* @param {integer} strideX - `x` stride length -* @param {NonNegativeInteger} offsetX - starting `x` index -* @param {Complex128Array} y - output array -* @param {integer} strideY - `y` stride length -* @param {NonNegativeInteger} offsetY - starting `y` index -* @returns {Complex128Array} output array -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy( x.length, x, 1, 0, y, 1, 0 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -*/ -function zxdy( N, x, strideX, offsetX, y, strideY, offsetY ) { - var viewX = reinterpret( x, 0 ); - var viewY = reinterpret( y, 0 ); - addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY ); - return y; -} - - -// EXPORTS // - -module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js deleted file mode 100644 index a3e39de7078e..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 stride2offset = require( '@stdlib/strided/base/stride2offset' ); -var ndarray = require( './ndarray.js' ); - - -// MAIN // - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. -* -* @param {PositiveInteger} N - number of indexed elements -* @param {Complex128Array} x - input array -* @param {integer} strideX - `x` stride length -* @param {Complex128Array} y - output array -* @param {integer} strideY - `y` stride length -* @returns {Complex128Array} output array -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy( x.length, x, 1, y, 1 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -*/ -function zxdy( N, x, strideX, y, strideY ) { - return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js deleted file mode 100644 index da11193ea533..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/lib/zxdy.native.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); -var addon = require( './../src/addon.node' ); - - -// MAIN // - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. -* -* @param {PositiveInteger} N - number of indexed elements -* @param {Complex128Array} x - input array -* @param {integer} strideX - `x` stride length -* @param {Complex128Array} y - output array -* @param {integer} strideY - `y` stride length -* @returns {Complex128Array} output array -* -* @example -* var Complex128Array = require( '@stdlib/array/complex128' ); -* -* var x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); -* var y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); -* -* zxdy( x.length, x, 1, y, 1 ); -* // y => [ 5.0, 1.0, 5.0, -1.0, 3.0, -1.0 ] -*/ -function zxdy( N, x, strideX, y, strideY ) { - var viewX = reinterpret( x, 0 ); - var viewY = reinterpret( y, 0 ); - addon( N, viewX, strideX, viewY, strideY ); - return y; -} - - -// EXPORTS // - -module.exports = zxdy; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json deleted file mode 100644 index 9c77abf3ddfb..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/manifest.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "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/complex/float64/base/div", - "@stdlib/complex/float64/ctor", - "@stdlib/strided/base/stride2offset", - "@stdlib/napi/export", - "@stdlib/napi/argv", - "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-strided-complex128array" - ] - }, - { - "task": "benchmark", - "wasm": false, - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/blas/base/shared", - "@stdlib/complex/float64/base/div", - "@stdlib/complex/float64/ctor", - "@stdlib/strided/base/stride2offset" - ] - }, - { - "task": "examples", - "wasm": false, - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/blas/base/shared", - "@stdlib/complex/float64/base/div", - "@stdlib/complex/float64/real", - "@stdlib/complex/float64/imag", - "@stdlib/complex/float64/ctor", - "@stdlib/strided/base/stride2offset" - ] - }, - { - "task": "build", - "wasm": true, - "src": [ - "./src/main.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/blas/base/shared", - "@stdlib/complex/float64/base/div", - "@stdlib/complex/float64/ctor", - "@stdlib/strided/base/stride2offset" - ] - } - ] -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json b/lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json deleted file mode 100644 index 16ce305b60ae..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "@stdlib/blas/ext/base/zxdy", - "version": "0.0.0", - "description": "Divide elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assign the results to `y`.", - "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", - "linear", - "algebra", - "subroutines", - "divide", - "division", - "transform", - "strided", - "array", - "ndarray", - "vector", - "xdy", - "zxdy", - "complex", - "complex128", - "complex128array", - "float64", - "double" - ], - "__stdlib__": { - "wasm": false - } -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile deleted file mode 100644 index 2caf905cedbe..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -#/ -# @license Apache-2.0 -# -# 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. -# 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/zxdy/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/addon.c deleted file mode 100644 index 4d0c3225c45f..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/addon.c +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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/zxdy.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_complex128array.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, 5 ); - STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); - STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); - STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 1 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, Y, N, strideY, argv, 3 ); - API_SUFFIX(stdlib_strided_zxdy)( N, (stdlib_complex128_t *)X, strideX, (stdlib_complex128_t *)Y, strideY ); - 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, strideX, argv, 2 ); - STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 ); - STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); - STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 1 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, Y, N, strideY, argv, 4 ); - API_SUFFIX(stdlib_strided_zxdy_ndarray)( N, (stdlib_complex128_t *)X, strideX, offsetX, (stdlib_complex128_t *)Y, strideY, offsetY ); - return NULL; -} - -STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c deleted file mode 100644 index 77642d39bb91..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/src/main.c +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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/zxdy.h" -#include "stdlib/blas/base/shared.h" -#include "stdlib/complex/float64/base/div.h" -#include "stdlib/strided/base/stride2offset.h" - -static const CBLAS_INT M = 5; - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y`. -* -* @param N number of indexed elements -* @param X input array -* @param strideX stride length for `X` -* @param Y output array -* @param strideY stride length for `Y` -*/ -void API_SUFFIX(stdlib_strided_zxdy)( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, stdlib_complex128_t *Y, const CBLAS_INT strideY ) { - CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); - CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY ); - API_SUFFIX(stdlib_strided_zxdy_ndarray)( N, X, strideX, ox, Y, strideY, oy ); -} - -/** -* Divides elements of a double-precision complex floating-point strided array `x` by the corresponding elements of a double-precision complex floating-point strided array `y` and assigns the results to `y` using alternative indexing semantics. -* -* @param N number of indexed elements -* @param X input array -* @param strideX stride length for `X` -* @param offsetX starting index for `X` -* @param Y output array -* @param strideY stride length for `Y` -* @param offsetY starting index for `Y` -*/ -void API_SUFFIX(stdlib_strided_zxdy_ndarray)( const CBLAS_INT N, const stdlib_complex128_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, stdlib_complex128_t *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) { - CBLAS_INT ix; - CBLAS_INT iy; - CBLAS_INT m; - CBLAS_INT i; - - if ( N <= 0 ) { - return; - } - ix = offsetX; - iy = offsetY; - - // Use loop unrolling if both strides are equal to `1`... - if ( strideX == 1 && strideY == 1 ) { - m = N % M; - - // If we have a remainder, run a clean-up loop... - if ( m > 0 ) { - for ( i = 0; i < m; i++ ) { - Y[ iy ] = stdlib_base_complex128_div( X[ ix ], Y[ iy ] ); - ix += strideX; - iy += strideY; - } - } - if ( N < M ) { - return; - } - for ( i = m; i < N; i += M ) { - Y[ iy ] = stdlib_base_complex128_div( X[ ix ], Y[ iy ] ); - Y[ iy+1 ] = stdlib_base_complex128_div( X[ ix+1 ], Y[ iy+1 ] ); - Y[ iy+2 ] = stdlib_base_complex128_div( X[ ix+2 ], Y[ iy+2 ] ); - Y[ iy+3 ] = stdlib_base_complex128_div( X[ ix+3 ], Y[ iy+3 ] ); - Y[ iy+4 ] = stdlib_base_complex128_div( X[ ix+4 ], Y[ iy+4 ] ); - ix += M; - iy += M; - } - return; - } - for ( i = 0; i < N; i++ ) { - Y[ iy ] = stdlib_base_complex128_div( X[ ix ], Y[ iy ] ); - ix += strideX; - iy += strideY; - } - return; -} diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js deleted file mode 100644 index bc6877df1d0a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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 IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var zxdy = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': IS_BROWSER -}; - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zxdy, '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 zxdy.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 zxdy = proxyquire( './../lib', { - '@stdlib/utils/try-require': tryRequire - }); - - t.strictEqual( zxdy, mock, 'returns native implementation' ); - t.end(); - - function tryRequire() { - return mock; - } - - function mock() { - // Mock... - } -}); - -tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { - var zxdy; - var main; - - main = require( './../lib/zxdy.js' ); - - zxdy = proxyquire( './../lib', { - '@stdlib/utils/try-require': tryRequire - }); - - t.strictEqual( zxdy, main, 'returns JavaScript implementation' ); - t.end(); - - function tryRequire() { - return new Error( 'Cannot find module' ); - } -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js deleted file mode 100644 index 86708894a971..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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. -*/ - -/* eslint-disable stdlib/empty-line-before-comment */ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var cdiv = require( '@stdlib/complex/float64/base/div' ); -var zxdy = require( './../lib/ndarray.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 7', function test( t ) { - t.strictEqual( zxdy.length, 7, 'has expected arity' ); - t.end(); -}); - -tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); - expected = new Complex128Array([ - // (4.0+2.0i) / (1.0+1.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0 - ]); - - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a reference to the output array', function test( t ) { - var out; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - out = zxdy( x.length, x, 1, 0, y, 1, 0 ); - - t.strictEqual( out, y, 'same reference' ); - t.end(); -}); - -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - - zxdy( 0, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - zxdy( -4, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an `x` stride', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 4.0, // 0 - 6.0, // 0 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 16.0, // 2 - 8.0 // 2 - ]); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 2, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports a `y` stride', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array([ - 1.0, // 0 - 1.0, // 0 - 4.0, - 5.0, - 2.0, // 1 - 2.0, // 1 - 8.0, - 9.0, - 4.0, // 2 - 4.0 // 2 - ]); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - 4.0, - 5.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - 8.0, - 9.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 1, 0, y, 2, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports negative strides', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 16.0, // 2 - 8.0, // 2 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 4.0, // 0 - 6.0 // 0 - ]); - y = new Complex128Array([ - 4.0, // 2 - 4.0, // 2 - 2.0, // 1 - 2.0, // 1 - 1.0, // 0 - 1.0 // 0 - ]); - expected = new Complex128Array([ - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0 - ]); - - zxdy( 3, x, -2, 4, y, -1, 2 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports view offsets', function test( t ) { - var expected; - var x0; - var y0; - var x1; - var y1; - - x0 = new Complex128Array([ - 10.0, - 0.0, - 4.0, // 0 - 6.0, // 0 - 12.0, // 1 - 8.0, // 1 - 16.0, // 2 - 8.0 // 2 - ]); - y0 = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - 1.0, // 0 - 1.0, // 0 - 2.0, // 1 - 2.0, // 1 - 4.0, // 2 - 4.0 // 2 - ]); - - x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); - - expected = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x1, 1, 0, y1, 1, 0 ); - t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { - var expected; - var xv; - var yv; - var x; - var y; - var i; - - x = new Complex128Array( 100 ); - y = new Complex128Array( 100 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( 240 ); - y = new Complex128Array( 240 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js deleted file mode 100644 index b051c743d7ed..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.ndarray.native.js +++ /dev/null @@ -1,330 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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. -*/ - -/* eslint-disable stdlib/empty-line-before-comment */ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var cdiv = require( '@stdlib/complex/float64/base/div' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var zxdy = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); -var opts = { - 'skip': ( zxdy instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 7', opts, function test( t ) { - t.strictEqual( zxdy.length, 7, 'has expected arity' ); - t.end(); -}); - -tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); - expected = new Complex128Array([ - // (4.0+2.0i) / (1.0+1.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0 - ]); - - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a reference to the output array', opts, function test( t ) { - var out; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - out = zxdy( x.length, x, 1, 0, y, 1, 0 ); - - t.strictEqual( out, y, 'same reference' ); - t.end(); -}); - -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - - zxdy( 0, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - zxdy( -4, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an `x` stride', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 4.0, // 0 - 6.0, // 0 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 16.0, // 2 - 8.0 // 2 - ]); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 2, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports a `y` stride', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array([ - 1.0, // 0 - 1.0, // 0 - 4.0, - 5.0, - 2.0, // 1 - 2.0, // 1 - 8.0, - 9.0, - 4.0, // 2 - 4.0 // 2 - ]); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - 4.0, - 5.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - 8.0, - 9.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 1, 0, y, 2, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports negative strides', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 16.0, // 2 - 8.0, // 2 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 4.0, // 0 - 6.0 // 0 - ]); - y = new Complex128Array([ - 4.0, // 2 - 4.0, // 2 - 2.0, // 1 - 2.0, // 1 - 1.0, // 0 - 1.0 // 0 - ]); - expected = new Complex128Array([ - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0 - ]); - - zxdy( 3, x, -2, 4, y, -1, 2 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports view offsets', opts, function test( t ) { - var expected; - var x0; - var y0; - var x1; - var y1; - - x0 = new Complex128Array([ - 10.0, - 0.0, - 4.0, // 0 - 6.0, // 0 - 12.0, // 1 - 8.0, // 1 - 16.0, // 2 - 8.0 // 2 - ]); - y0 = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - 1.0, // 0 - 1.0, // 0 - 2.0, // 1 - 2.0, // 1 - 4.0, // 2 - 4.0 // 2 - ]); - - x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); - - expected = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x1, 1, 0, y1, 1, 0 ); - t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { - var expected; - var xv; - var yv; - var x; - var y; - var i; - - x = new Complex128Array( 100 ); - y = new Complex128Array( 100 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( 240 ); - y = new Complex128Array( 240 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js deleted file mode 100644 index dfbcb6a8c937..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.js +++ /dev/null @@ -1,321 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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. -*/ - -/* eslint-disable stdlib/empty-line-before-comment */ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var cdiv = require( '@stdlib/complex/float64/base/div' ); -var zxdy = require( './../lib/zxdy.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 5', function test( t ) { - t.strictEqual( zxdy.length, 5, 'has expected arity' ); - t.end(); -}); - -tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); - expected = new Complex128Array([ - // (4.0+2.0i) / (1.0+1.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0 - ]); - - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a reference to the output array', function test( t ) { - var out; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - out = zxdy( x.length, x, 1, y, 1 ); - - t.strictEqual( out, y, 'same reference' ); - t.end(); -}); - -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - - zxdy( 0, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - zxdy( -4, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an `x` stride', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 4.0, // 0 - 6.0, // 0 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 16.0, // 2 - 8.0 // 2 - ]); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 2, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports a `y` stride', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array([ - 1.0, // 0 - 1.0, // 0 - 4.0, - 5.0, - 2.0, // 1 - 2.0, // 1 - 8.0, - 9.0, - 4.0, // 2 - 4.0 // 2 - ]); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - 4.0, - 5.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - 8.0, - 9.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 1, y, 2 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports negative strides', function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 16.0, // 2 - 8.0, // 2 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 4.0, // 0 - 6.0 // 0 - ]); - y = new Complex128Array([ - 4.0, // 2 - 4.0, // 2 - 2.0, // 1 - 2.0, // 1 - 1.0, // 0 - 1.0 // 0 - ]); - expected = new Complex128Array([ - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0 - ]); - - zxdy( 3, x, -2, y, -1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports view offsets', function test( t ) { - var expected; - var x0; - var y0; - var x1; - var y1; - - x0 = new Complex128Array([ - 10.0, - 0.0, - 4.0, // 0 - 6.0, // 0 - 12.0, // 1 - 8.0, // 1 - 16.0, // 2 - 8.0 // 2 - ]); - y0 = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - 1.0, // 0 - 1.0, // 0 - 2.0, // 1 - 2.0, // 1 - 4.0, // 2 - 4.0 // 2 - ]); - - x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); - - expected = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x1, 1, y1, 1 ); - t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', function test( t ) { - var expected; - var xv; - var yv; - var x; - var y; - var i; - - x = new Complex128Array( 100 ); - y = new Complex128Array( 100 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( 240 ); - y = new Complex128Array( 240 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js b/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js deleted file mode 100644 index ae0c3ad9055a..000000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/zxdy/test/test.zxdy.native.js +++ /dev/null @@ -1,330 +0,0 @@ -/** -* @license Apache-2.0 -* -* 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. -* 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. -*/ - -/* eslint-disable stdlib/empty-line-before-comment */ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' ); -var Complex128Array = require( '@stdlib/array/complex128' ); -var Complex128 = require( '@stdlib/complex/float64/ctor' ); -var cdiv = require( '@stdlib/complex/float64/base/div' ); -var tryRequire = require( '@stdlib/utils/try-require' ); - - -// VARIABLES // - -var zxdy = tryRequire( resolve( __dirname, './../lib/zxdy.native.js' ) ); -var opts = { - 'skip': ( zxdy instanceof Error ) -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zxdy, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 5', opts, function test( t ) { - t.strictEqual( zxdy.length, 5, 'has expected arity' ); - t.end(); -}); - -tape( 'the function divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( [ 4.0, 2.0, 12.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0 ] ); - expected = new Complex128Array([ - // (4.0+2.0i) / (1.0+1.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0 - ]); - - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a reference to the output array', opts, function test( t ) { - var out; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - out = zxdy( x.length, x, 1, y, 1 ); - - t.strictEqual( out, y, 'same reference' ); - t.end(); -}); - -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - y = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - expected = new Complex128Array( [ 4.0, 5.0, 6.0, 7.0 ] ); - - zxdy( 0, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - zxdy( -4, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports an `x` stride', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 4.0, // 0 - 6.0, // 0 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 16.0, // 2 - 8.0 // 2 - ]); - y = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 4.0, 4.0 ] ); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 2, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports a `y` stride', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array( [ 4.0, 6.0, 12.0, 8.0, 16.0, 8.0 ] ); - y = new Complex128Array([ - 1.0, // 0 - 1.0, // 0 - 4.0, - 5.0, - 2.0, // 1 - 2.0, // 1 - 8.0, - 9.0, - 4.0, // 2 - 4.0 // 2 - ]); - expected = new Complex128Array([ - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - 4.0, - 5.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - 8.0, - 9.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x, 1, y, 2 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports negative strides', opts, function test( t ) { - var expected; - var x; - var y; - - x = new Complex128Array([ - 16.0, // 2 - 8.0, // 2 - 0.0, - 0.0, - 12.0, // 1 - 8.0, // 1 - 0.0, - 0.0, - 4.0, // 0 - 6.0 // 0 - ]); - y = new Complex128Array([ - 4.0, // 2 - 4.0, // 2 - 2.0, // 1 - 2.0, // 1 - 1.0, // 0 - 1.0 // 0 - ]); - expected = new Complex128Array([ - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0 - ]); - - zxdy( 3, x, -2, y, -1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports view offsets', opts, function test( t ) { - var expected; - var x0; - var y0; - var x1; - var y1; - - x0 = new Complex128Array([ - 10.0, - 0.0, - 4.0, // 0 - 6.0, // 0 - 12.0, // 1 - 8.0, // 1 - 16.0, // 2 - 8.0 // 2 - ]); - y0 = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - 1.0, // 0 - 1.0, // 0 - 2.0, // 1 - 2.0, // 1 - 4.0, // 2 - 4.0 // 2 - ]); - - x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); - - expected = new Complex128Array([ - 10.0, - 0.0, - 10.0, - 0.0, - // (4.0+6.0i) / (1.0+1.0i) - 5.0, - 1.0, - // (12.0+8.0i) / (2.0+2.0i) - 5.0, - -1.0, - // (16.0+8.0i) / (4.0+4.0i) - 3.0, - -1.0 - ]); - - zxdy( 3, x1, 1, y1, 1 ); - t.strictEqual( isSameComplex128Array( y0, expected ), true, 'returns expected value' ); - t.end(); -}); - -tape( 'if both strides are equal to `1`, the function efficiently divides elements of `x` by the corresponding elements of `y` and assigns the results to `y`', opts, function test( t ) { - var expected; - var xv; - var yv; - var x; - var y; - var i; - - x = new Complex128Array( 100 ); - y = new Complex128Array( 100 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - x = new Complex128Array( 240 ); - y = new Complex128Array( 240 ); - expected = new Complex128Array( x.length ); - for ( i = 0; i < x.length; i++ ) { - xv = new Complex128( i, 0.0 ); - yv = new Complex128( x.length - i, 0.0 ); - x.set( xv, i ); - y.set( yv, i ); - expected.set( cdiv( xv, yv ), i ); - } - zxdy( x.length, x, 1, y, 1 ); - t.strictEqual( isSameComplex128Array( y, expected ), true, 'returns expected value' ); - - t.end(); -});