From c5c1625fe9ed66df019bac67d4a3e670166421e6 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Thu, 16 Jan 2025 09:28:33 +0000 Subject: [PATCH 01/19] feat: add blas/base/cdotu --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: 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 --- --- .../@stdlib/blas/base/cdotu/README.md | 246 +++++++++++++++++ .../blas/base/cdotu/benchmark/benchmark.js | 107 ++++++++ .../base/cdotu/benchmark/benchmark.ndarray.js | 107 ++++++++ .../blas/base/cdotu/docs/types/index.d.ts | 140 ++++++++++ .../blas/base/cdotu/docs/types/test.ts | 249 ++++++++++++++++++ .../@stdlib/blas/base/cdotu/examples/index.js | 37 +++ .../@stdlib/blas/base/cdotu/lib/cdotu.js | 65 +++++ .../@stdlib/blas/base/cdotu/lib/index.js | 86 ++++++ .../@stdlib/blas/base/cdotu/lib/main.js | 35 +++ .../@stdlib/blas/base/cdotu/lib/ndarray.js | 82 ++++++ .../@stdlib/blas/base/cdotu/package.json | 82 ++++++ .../blas/base/cdotu/test/test.cdotu.js | 217 +++++++++++++++ .../@stdlib/blas/base/cdotu/test/test.js | 82 ++++++ .../blas/base/cdotu/test/test.ndarray.js | 239 +++++++++++++++++ 14 files changed, 1774 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/README.md b/lib/node_modules/@stdlib/blas/base/cdotu/README.md new file mode 100644 index 000000000000..8e9b31b33f8c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/README.md @@ -0,0 +1,246 @@ + + +# cdotu + +> Calculate the [dot product][dot-product] of two single-precision complex floating-point vectors. + +
+ +The [dot product][dot-product] (or scalar product) is defined as + + + +```math +\mathbf{zx}\cdot\mathbf{zy} = \sum_{i=0}^{N-1} zx_i zy_i = zx_0 zy_0 + zx_1 zy_1 + \ldots + zx_{N-1} zy_{N-1} +``` + + + +
+ + + +
+ +## Usage + +```javascript +var cdotu = require( '@stdlib/blas/base/cdotu' ); +``` + +#### cdotu( N, zx, strideX, zy, strideY ) + +Calculates the dot product of vectors `zx` and `zy`. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); + +var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + +var z = cdotu( 3, zx, 1, zy, 1 ); +// returns + +var re = real( z ); +// returns -52.0 + +var im = imag( z ); +// returns 82.0 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **zx**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: index increment for `zx`. +- **zy**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideY**: index increment for `zy`. + +The `N` and strides parameters determine which elements in the strided arrays are accessed at runtime. For example, to calculate the dot product of every other value in `zx` and the first `N` elements of `zy` in reverse order, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); + +var zx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var zy = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + +var z = cdotu( 2, zx, 2, zy, -1 ); +// returns + +var re = real( z ); +// returns -2.0 + +var im = imag( z ); +// returns 14.0 +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); + +// Initial arrays... +var zx0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var zy0 = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + +// Create offset views... +var zx1 = new Complex64Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var zy1 = new Complex64Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // start at 3th element + +var z = cdotu( 1, zx1, 1, zy1, 1 ); +// returns + +var re = real( z ); +// returns -15.0 + +var im = imag( z ); +// returns 80.0 +``` + +#### cdotu.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY ) + +Calculates the dot product of `zx` and `zy` using alternative indexing semantics. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); + +var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + +var z = cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); +// returns + +var re = real( z ); +// returns -52.0 + +var im = imag( z ); +// returns 82.0 +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `zx`. +- **offsetY**: starting index for `zy`. + +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 calculate the dot product of every other value in `zx` starting from the second value with the last 2 elements in `zy` in reverse order + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); + +var zx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var zy = new Complex64Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); // eslint-disable-line max-len + +var z = cdotu.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 ); +// returns + +var re = real( z ); +// returns -40.0 + +var im = imag( z ); +// returns 310.0 +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, both functions return `0.0 + 0.0i`. +- `cdotu()` corresponds to the [BLAS][blas] level 1 function [`cdotu`][cdotu]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var cdotu = require( '@stdlib/blas/base/cdotu' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var zx = filledarrayBy( 10, 'complex64', rand ); +console.log( zx.toString() ); + +var zy = filledarrayBy( 10, 'complex64', rand ); +console.log( zy.toString() ); + +var out = cdotu.ndarray( zx.length, zx, 1, 0, zy, -1, zy.length-1 ); +console.log( out.toString() ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js new file mode 100644 index 000000000000..9785d1663ddc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var 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 Complex64Array = require( '@stdlib/array/complex64' ); +var pkg = require( './../package.json' ).name; +var cdotu = require( './../lib/cdotu.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var zx; + var zy; + + zx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + zy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = cdotu( zx.length, zx, 1, zy, 1 ); + if ( isnan( d ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( d ) ) { + 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 = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..7be9e547890d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -0,0 +1,107 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var 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 Complex64Array = require( '@stdlib/array/complex128' ); +var pkg = require( './../package.json' ).name; +var cdotu = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var zx; + var zy; + + zx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + zy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = cdotu( zx.length, zx, 1, 0, zy, 1, 0 ); + if ( isnan( d ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( d ) ) { + 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 = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts new file mode 100644 index 000000000000..96de97a9230c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts @@ -0,0 +1,140 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Complex64Array } from '@stdlib/types/array'; +import { Complex64 } from '@stdlib/types/complex'; + +/** +* Interface describing `cdotu`. +*/ +interface Routine { + /** + * Calculates the dot product of vectors `zx` and `zy`. + * + * @param N - number of indexed elements + * @param zx - first input array + * @param strideX - `zx` stride length + * @param zy - second input array + * @param strideY - `zy` stride length + * @returns dot product + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var real = require( '@stdlib/complex/float32/real' ); + * var imag = require( '@stdlib/complex/float32/imag' ); + * + * var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); + * var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + * + * var z = cdotu( 3, zx, 1, zy, 1 ); + * // returns + * + * var re = real( z ); + * // returns -52.0 + * + * var im = imag( z ); + * // returns 82.0 + */ + ( N: number, zx: Complex64Array, strideX: number, zy: Complex64Array, strideY: number ): Complex64; + + /** + * Calculates the dot product of vectors `zx` and `zy` using alternative indexing semantics. + * + * @param N - number of indexed elements + * @param zx - first input array + * @param strideX - `zx` stride length + * @param offsetX - starting index for `zx` + * @param zy - second input array + * @param strideY - `zy` stride length + * @param offsetY - starting index for `zy` + * @returns dot product + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * var real = require( '@stdlib/complex/float32/real' ); + * var imag = require( '@stdlib/complex/float32/imag' ); + * + * var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); + * var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + * + * var z = cdotu.ndarray( 3, zx, 1, 0, zy, 1, 0 ); + * // returns + * + * var re = real( z ); + * // returns -52.0 + * + * var im = imag( z ); + * // returns 82.0 + */ + ndarray( N: number, zx: Complex64Array, strideX: number, offsetX: number, zy: Complex64Array, strideY: number, offsetY: number ): Complex64; +} + +/** +* Computes the dot product of two single-precision complex floating-point vectors. +* +* @param N - number of indexed elements +* @param zx - first input array +* @param strideX - `zx` stride length +* @param zy - second input array +* @param strideY - `zy` stride length +* @returns dot product +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var real = require( '@stdlib/complex/float32/real' ); +* var imag = require( '@stdlib/complex/float32/imag' ); +* +* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* +* var z = cdotu( 3, zx, 1, zy, 1 ); +* // returns +* +* var re = real( z ); +* // returns -52.0 +* +* var im = imag( z ); +* // returns 82.0 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var real = require( '@stdlib/complex/float32/real' ); +* var imag = require( '@stdlib/complex/float32/imag' ); +* +* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* +* var z = cdotu.ndarray( 3, zx, 1, 0, zy, 1, 0 ); +* // returns +* +* var re = real( z ); +* // returns -52.0 +* +* var im = imag( z ); +* // returns 82.0 +*/ +declare var cdotu: Routine; + + +// EXPORTS // + +export = cdotu; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts new file mode 100644 index 000000000000..d7f3fe0dda43 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts @@ -0,0 +1,249 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex64Array = require( '@stdlib/array/complex64' ); +import cdotu = require( './index' ); + + +// TESTS // + +// The function returns Complex64... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu( zx.length, zx, 1, zy, 1 ); // $ExpectType Complex64 +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu( '10', zx, 1, zy, 1 ); // $ExpectError + cdotu( true, zx, 1, zy, 1 ); // $ExpectError + cdotu( false, zx, 1, zy, 1 ); // $ExpectError + cdotu( null, zx, 1, zy, 1 ); // $ExpectError + cdotu( undefined, zx, 1, zy, 1 ); // $ExpectError + cdotu( [], zx, 1, zy, 1 ); // $ExpectError + cdotu( {}, zx, 1, zy, 1 ); // $ExpectError + cdotu( ( zx: number ): number => zx, zx, 1, zy, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a Complex64Array... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu( zx.length, 10, 1, zy, 1 ); // $ExpectError + cdotu( zx.length, '10', 1, zy, 1 ); // $ExpectError + cdotu( zx.length, true, 1, zy, 1 ); // $ExpectError + cdotu( zx.length, false, 1, zy, 1 ); // $ExpectError + cdotu( zx.length, null, 1, zy, 1 ); // $ExpectError + cdotu( zx.length, undefined, 1, zy, 1 ); // $ExpectError + cdotu( zx.length, [ '1' ], 1, zy, 1 ); // $ExpectError + cdotu( zx.length, {}, 1, zy, 1 ); // $ExpectError + cdotu( zx.length, ( zx: number ): number => zx, 1, zy, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu( zx.length, zx, '10', zy, 1 ); // $ExpectError + cdotu( zx.length, zx, true, zy, 1 ); // $ExpectError + cdotu( zx.length, zx, false, zy, 1 ); // $ExpectError + cdotu( zx.length, zx, null, zy, 1 ); // $ExpectError + cdotu( zx.length, zx, undefined, zy, 1 ); // $ExpectError + cdotu( zx.length, zx, [], zy, 1 ); // $ExpectError + cdotu( zx.length, zx, {}, zy, 1 ); // $ExpectError + cdotu( zx.length, zx, ( zx: number ): number => zx, zy, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Complex64Array... +{ + const zx = new Complex64Array( 10 ); + + cdotu( zx.length, zx, 1, 10, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, '10', 1 ); // $ExpectError + cdotu( zx.length, zx, 1, true, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, false, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, null, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, undefined, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, [], 1 ); // $ExpectError + cdotu( zx.length, zx, 1, {}, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, ( zx: number ): number => zx, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu( zx.length, zx, 1, zy, '10' ); // $ExpectError + cdotu( zx.length, zx, 1, zy, true ); // $ExpectError + cdotu( zx.length, zx, 1, zy, false ); // $ExpectError + cdotu( zx.length, zx, 1, zy, null ); // $ExpectError + cdotu( zx.length, zx, 1, zy, undefined ); // $ExpectError + cdotu( zx.length, zx, 1, zy, [] ); // $ExpectError + cdotu( zx.length, zx, 1, zy, {} ); // $ExpectError + cdotu( zx.length, zx, 1, zy, ( zx: number ): number => zx ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu(); // $ExpectError + cdotu( zx.length ); // $ExpectError + cdotu( zx.length, zx ); // $ExpectError + cdotu( zx.length, zx, 1 ); // $ExpectError + cdotu( zx.length, zx, 1, zy ); // $ExpectError + cdotu( zx.length, zx, 1, zy, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex64... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); // $ExpectType Complex64 +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( '10', zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( true, zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( false, zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( null, zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( undefined, zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( [], zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( {}, zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( ( zx: number ): number => zx, zx, 1, 0, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Complex64Array... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, 10, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, '10', 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, true, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, false, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, null, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, undefined, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, [], 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, {}, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, ( zx: number ): number => zx, 1, 0, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, zx, '10', 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, true, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, false, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, null, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, undefined, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, [], 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, {}, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, ( zx: number ): number => zx, 0, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, zx, 1, '10', zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, true, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, false, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, null, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, undefined, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, [], zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, {}, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, ( zx: number ): number => zx, zy, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Complex64Array... +{ + const zx = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, zx, 1, 0, 10, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, '10', 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, true, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, false, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, null, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, undefined, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, [], 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, {}, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, ( zx: number ): number => zx, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, zx, 1, 0, zy, '10', 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, true, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, false, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, null, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, undefined, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, [], 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, {}, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, ( zx: number ): number => zx, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, '10' ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, true ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, false ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, null ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, undefined ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, [] ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, {} ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, ( zx: number ): number => zx ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const zx = new Complex64Array( 10 ); + const zy = new Complex64Array( 10 ); + + cdotu.ndarray(); // $ExpectError + cdotu.ndarray( zx.length ); // $ExpectError + cdotu.ndarray( zx.length, zx ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1 ); // $ExpectError + cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js new file mode 100644 index 000000000000..50eb26da8bce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js @@ -0,0 +1,37 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var cdotu = require( '@stdlib/blas/base/cdotu' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); +} + +var zx = filledarrayBy( 10, 'complex64', rand ); +console.log( zx.toString() ); + +var zy = filledarrayBy( 10, 'complex64', rand ); +console.log( zy.toString() ); + +var out = cdotu.ndarray( zx.length, zx, 1, 0, zy, -1, zy.length-1 ); +console.log( out.toString() ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js new file mode 100644 index 000000000000..1d2da83f4938 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Calculates the dot product of two single-precision complex floating-point vectors. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Complex64Array} zx - first input array +* @param {integer} strideX - `zx` stride length +* @param {Complex64Array} zy - second input array +* @param {integer} strideY - `zy` stride length +* @returns {Complex64} dot product +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var real = require( '@stdlib/complex/float32/real' ); +* var imag = require( '@stdlib/complex/float32/imag' ); +* +* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* +* var z = cdotu( 3, zx, 1, zy, 1 ); +* // returns +* +* var re = real( z ); +* // returns -52.0 +* +* var im = imag( z ); +* // returns 82.0 +*/ +function cdotu( N, zx, strideX, zy, strideY ) { + var ix = stride2offset( N, strideX ); + var iy = stride2offset( N, strideY ); + return ndarray( N, zx, strideX, ix, zy, strideY, iy ); +} + + +// EXPORTS // + +module.exports = cdotu; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js new file mode 100644 index 000000000000..9a5444929a5a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* BLAS level 1 routine to compute the dot product of two single-precision complex floating-point vectors. +* +* @module @stdlib/blas/base/cdotu +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var real = require( '@stdlib/complex/float32/real' ); +* var imag = require( '@stdlib/complex/float32/imag' ); +* var cdotu = require( '@stdlib/blas/base/cdotu' ); +* +* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* +* var z = cdotu( 3, zx, 1, zy, 1 ); +* // returns +* +* var re = real( z ); +* // returns -52.0 +* +* var im = imag( z ); +* // returns 82.0 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var real = require( '@stdlib/complex/float32/real' ); +* var imag = require( '@stdlib/complex/float32/imag' ); +* var cdotu = require( '@stdlib/blas/base/cdotu' ); +* +* var zx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var zy = new Complex64Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); +* +* var z = cdotu.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 ); +* // returns +* +* var re = real( z ); +* // returns -40.0 +* +* var im = imag( z ); +* // returns 310.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 cdotu; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + cdotu = main; +} else { + cdotu = tmp; +} + + +// EXPORTS // + +module.exports = cdotu; + +// exports: { "ndarray": "cdotu.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js new file mode 100644 index 000000000000..e9627d52ef51 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var cdotu = require( './cdotu.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( cdotu, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = cdotu; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js new file mode 100644 index 000000000000..21e31c2a4398 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var cmul = require( '@stdlib/complex/float32/base/mul' ); +var cadd = require( '@stdlib/complex/float32/base/add' ); + + +// MAIN // + +/** +* Calculates the dot product of two single-precision complex floating-point vectors. +* +* @param {integer} N - number of indexed elements +* @param {Complex64Array} zx - first input array +* @param {integer} strideX - `zx` stride length +* @param {NonNegativeInteger} offsetX - starting index for `zx` +* @param {Complex64Array} zy - second input array +* @param {integer} strideY - `zy` stride length +* @param {NonNegativeInteger} offsetY - starting index for `zy` +* @returns {Complex64} dot product +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var real = require( '@stdlib/complex/float32/real' ); +* var imag = require( '@stdlib/complex/float32/imag' ); +* +* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* +* var z = cdotu( 3, zx, 1, 0, zy, 1, 0 ); +* // returns +* +* var re = real( z ); +* // returns -52.0 +* +* var im = imag( z ); +* // returns 82.0 +*/ +function cdotu( N, zx, strideX, offsetX, zy, strideY, offsetY ) { + var dot; + var ix; + var iy; + var i; + + dot = new Complex64( 0.0, 0.0 ); + if ( N <= 0 ) { + return dot; + } + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + dot = cadd( cmul( zx.get( ix ), zy.get( iy ) ), dot ); + ix += strideX; + iy += strideY; + } + return dot; +} + + +// EXPORTS // + +module.exports = cdotu; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/package.json b/lib/node_modules/@stdlib/blas/base/cdotu/package.json new file mode 100644 index 000000000000..128c67121984 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/package.json @@ -0,0 +1,82 @@ +{ + "name": "@stdlib/blas/base/cdotu", + "version": "0.0.0", + "description": "Calculate the dot product of two single-precision complex floating-point vectors.", + "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", + "level 1", + "linear", + "algebra", + "subroutines", + "cdotu", + "dot", + "product", + "dot product", + "scalar", + "scalar product", + "inner", + "inner product", + "vector", + "typed", + "array", + "ndarray", + "complex", + "complex64", + "single", + "float32", + "float32array" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js new file mode 100644 index 000000000000..f6d9ffa68c9f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js @@ -0,0 +1,217 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isSameComplex64 = require( '@stdlib/assert/is-same-complex64' ); +var cdotu = require( './../lib/cdotu.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cdotu, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', function test( t ) { + t.strictEqual( cdotu.length, 5, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `zx` and `zy`', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); + zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); + + dot = cdotu( 4, zx, 1, zy, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 3, 70 ) ), true, 'returns expected value' ); + + zx = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); + zy = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); + + dot = cdotu( 2, zx, 1, zy, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -18, 4 ) ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0 + 0i`', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); + zy = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); + + dot = cdotu( 0, zx, 1, zy, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + + dot = cdotu( -4, zx, 1, zy, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `zx` stride', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, + 6.0, + 7.0, // 1 + 6.0 // 1 + ]); + zy = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, // 1 + 3.0, // 1 + -4.0, + 1.0 + ]); + + dot = cdotu( 2, zx, 2, zy, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -17, -17 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `zy` stride', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, // 1 + 7.0, // 1 + 6.0, + -2.0 + ]); + zy = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, + 3.0, + -4.0, // 1 + 1.0 // 1 + ]); + + dot = cdotu( 2, zx, 1, zy, 2 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 35, -53 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 1.0, // 1 + 2.0, // 1 + 3.0, + 4.0, + 5.0, // 0 + 6.0 // 0 + ]); + zy = new Complex64Array([ + 7.0, // 1 + 8.0, // 1 + 9.0, // 0 + 10.0, // 0 + 11.0, + 12.0 + ]); + + dot = cdotu( 2, zx, -2, zy, -1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -24, 126 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + zy = new Complex64Array([ + 7.0, // 0 + 8.0, // 0 + 9.0, // 1 + 10.0, // 1 + 11.0, + 12.0 + ]); + + dot = cdotu( 2, zx, 2, zy, -1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -24, 110 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var dot; + var x0; + var y0; + var x1; + var y1; + + x0 = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + y0 = new Complex64Array([ + 7.0, + 8.0, + 9.0, // 0 + 10.0, // 0 + 11.0, // 1 + 12.0 // 1 + ]); + + x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*0 ); + y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); + + dot = cdotu( 2, x1, 2, y1, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js new file mode 100644 index 000000000000..04a656870507 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var cdotu = 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 cdotu, '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 cdotu.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 cdotu = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cdotu, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var cdotu; + var main; + + main = require( './../lib/cdotu.js' ); + + cdotu = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cdotu, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js new file mode 100644 index 000000000000..fc9c1891c75c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js @@ -0,0 +1,239 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isSameComplex64 = require( '@stdlib/assert/is-same-complex64' ); +var cdotu = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cdotu, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( cdotu.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `zx` and `zy`', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); + zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); + + dot = cdotu( zx.length, zx, 1, 0, zy, 1, 0 ); + t.strictEqual(isSameComplex64( dot, new Complex64( 3, 70 ) ), true, 'returns expected value' ); + + zx = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); + zy = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); + + dot = cdotu( zx.length, zx, 1, 0, zy, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -18, 4 ) ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); + zy = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); + + dot = cdotu( 0, zx, 1, 0, zy, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + + dot = cdotu( -4, zx, 1, 0, zy, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `zx` stride', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, + 6.0, + 7.0, // 1 + 6.0 // 1 + ]); + zy = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, // 1 + 3.0, // 1 + -4.0, + 1.0 + ]); + + dot = cdotu( 2, zx, 2, 0, zy, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -17, -17 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `zx` offset', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 2.0, + -3.0, + -5.0, // 0 + 6.0, // 0 + 7.0, // 1 + 6.0 // 1 + ]); + zy = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, // 1 + 3.0, // 1 + -4.0, + 1.0 + ]); + + dot = cdotu( 2, zx, 1, 1, zy, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -91, 41 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `zy` stride', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, // 1 + 6.0, // 1 + 7.0, + 6.0 + ]); + zy = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, + 3.0, + -4.0, // 1 + 1.0 // 1 + ]); + + dot = cdotu( 2, zx, 1, 0, zy, 2, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 36, -49 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `zy` offset', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + zy = new Complex64Array([ + 7.0, + 8.0, + 9.0, // 0 + 10.0, // 0 + 11.0, // 1 + 12.0 // 1 + ]); + + dot = cdotu( 2, zx, 2, 0, zy, 1, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 1.0, // 1 + 2.0, // 1 + 3.0, + 4.0, + 5.0, // 0 + 6.0 // 0 + ]); + zy = new Complex64Array([ + 7.0, + 8.0, + 9.0, // 1 + 10.0, // 1 + 11.0, // 0 + 12.0 // 0 + ]); + + dot = cdotu( 2, zx, -2, zx.length-1, zy, -1, 2 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var dot; + var zx; + var zy; + + zx = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + zy = new Complex64Array([ + 7.0, // 0 + 8.0, // 0 + 9.0, // 1 + 10.0, // 1 + 11.0, + 12.0 + ]); + + dot = cdotu( 2, zx, 2, 0, zy, -1, zy.length-2 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -24, 110 ) ), true, 'returns expected value' ); + t.end(); +}); From 1fbde8e370bd2a448835d98f4eb3f33d46ff33b8 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Thu, 16 Jan 2025 09:30:33 +0000 Subject: [PATCH 02/19] add repl file --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/base/cdotu/docs/repl.txt | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt new file mode 100644 index 000000000000..944e59ca693e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt @@ -0,0 +1,124 @@ + +{{alias}}( N, zx, strideX, zy, strideY ) + Calculate the dot product of two single-precision complex floating-point + vectors. + + 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 a + typed array view. + + If `N <= 0`, the function returns `0 + 0i`. + + Parameters + ---------- + N: integer + Number of indexed elements. + + zx: Complex64Array + First input array. + + strideX: integer + Index increment for `zx`. + + zy: Complex64Array + Second input array. + + strideY: integer + Index increment for `zy`. + + Returns + ------- + out: Complex64 + Scalar constant. + + Examples + -------- + // Standard usage: + > var zx = new {{alias:@stdlib/array/complex64}}( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); + > var zy = new {{alias:@stdlib/array/complex64}}( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + > var z = {{alias}}( 3, zx, 1, zy, 1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( z ) + -52.0 + > var im = {{alias:@stdlib/complex/float32/imag}}( z ) + 82.0 + + // Advanced indexing: + > var zx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var zy = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + > var z = {{alias}}( 2, zx, 2, zy, -1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( z ) + -2.0 + > var im = {{alias:@stdlib/complex/float32/imag}}( z ) + 14.0 + + // Using typed array views: + > var zx0 = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var zy0 = new {{alias:@stdlib/array/complex64}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + > var zx1 = new {{alias:@stdlib/array/complex64}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); + > var zy1 = new {{alias:@stdlib/array/complex64}}( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); + > var z = {{alias}}( 1, zx1, 1, zy1, 1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( z ) + -15.0 + > var im = {{alias:@stdlib/complex/float32/imag}}( z ) + 80.0 + + +{{alias}}.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY ) + Computes the dot product of two single-precision complex floating-point + vectors using alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing based on a starting index. + + Parameters + ---------- + N: integer + Number of indexed elements. + + zx: Complex64Array + First input array. + + strideX: integer + Index increment for `zx`. + + offsetX: integer + Starting index for `zx`. + + zy: Complex64Array + Second input array. + + strideY: integer + Index increment for `zy`. + + offsetY: integer + Starting index for `zy`. + + Returns + ------- + out: Complex64 + Second input array. + + Examples + -------- + // Standard usage: + > var zx = new {{alias:@stdlib/array/complex64}}( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); + > var zy = new {{alias:@stdlib/array/complex64}}( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + > var z = {{alias}}.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); + > var re = {{alias:@stdlib/complex/float32/real}}( z ) + -52.0 + > var im = {{alias:@stdlib/complex/float32/imag}}( z ) + 82.0 + + // Advanced indexing: + > var zx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > var zy = new {{alias:@stdlib/array/complex64}}( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); + > var z = {{alias}}.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( z ) + -40.0 + > var im = {{alias:@stdlib/complex/float32/imag}}( z ) + 310.0 + + See Also + -------- From d1ef8d363de5e4416e9739ee8ec3e06717ba899f Mon Sep 17 00:00:00 2001 From: kaustubh Date: Sun, 18 Jan 2026 15:36:41 +0530 Subject: [PATCH 03/19] bench: change variable names --- .../blas/base/cdotu/benchmark/benchmark.js | 22 +++++++++---------- .../base/cdotu/benchmark/benchmark.ndarray.js | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js index 9785d1663ddc..18b65c7d02de 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -42,15 +42,15 @@ var options = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} len - array length +* @param {PositiveInteger} N - array Ngth * @returns {Function} benchmark function */ -function createBenchmark( len ) { - var zx; - var zy; +function createBenchmark( N ) { + var x; + var y; - zx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); - zy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + x = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); return benchmark; /** @@ -65,7 +65,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - d = cdotu( zx.length, zx, 1, zy, 1 ); + d = cdotu( x.Ngth, x, 1, y, 1 ); if ( isnan( d ) ) { b.fail( 'should not return NaN' ); } @@ -88,7 +88,7 @@ function createBenchmark( len ) { * @private */ function main() { - var len; + var N; var min; var max; var f; @@ -98,9 +98,9 @@ function main() { max = 5; // 10^max for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':len='+len, f ); + N = pow( 10, i ); + f = createBenchmark( N ); + bench( pkg+':N='+N, f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js index 7be9e547890d..ad644864b9c2 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -42,15 +42,15 @@ var options = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} len - array length +* @param {PositiveInteger} N - array Ngth * @returns {Function} benchmark function */ -function createBenchmark( len ) { - var zx; - var zy; +function createBenchmark( N ) { + var x; + var y; - zx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); - zy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + x = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); return benchmark; /** @@ -65,7 +65,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - d = cdotu( zx.length, zx, 1, 0, zy, 1, 0 ); + d = cdotu( x.Ngth, x, 1, 0, y, 1, 0 ); if ( isnan( d ) ) { b.fail( 'should not return NaN' ); } @@ -88,7 +88,7 @@ function createBenchmark( len ) { * @private */ function main() { - var len; + var N; var min; var max; var f; @@ -98,9 +98,9 @@ function main() { max = 5; // 10^max for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':ndarray:len='+len, f ); + N = pow( 10, i ); + f = createBenchmark( N ); + bench( pkg+':ndarray:N='+N, f ); } } From 3f69f27d44214a4116e60d0bac8f39a129297caa Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 11:04:57 +0530 Subject: [PATCH 04/19] docs: improve JSDoc and Change variable naming --- .../blas/base/cdotu/benchmark/benchmark.js | 4 +- .../base/cdotu/benchmark/benchmark.ndarray.js | 6 +- .../blas/base/cdotu/docs/types/index.d.ts | 100 +++--- .../blas/base/cdotu/docs/types/test.ts | 288 +++++++++--------- .../@stdlib/blas/base/cdotu/lib/cdotu.js | 28 +- .../@stdlib/blas/base/cdotu/lib/index.js | 34 +-- .../@stdlib/blas/base/cdotu/lib/ndarray.js | 35 +-- 7 files changed, 215 insertions(+), 280 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js index 18b65c7d02de..ac7f054f7778 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -42,7 +42,7 @@ var options = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} N - array Ngth +* @param {PositiveInteger} N - array length * @returns {Function} benchmark function */ function createBenchmark( N ) { @@ -65,7 +65,7 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - d = cdotu( x.Ngth, x, 1, y, 1 ); + d = cdotu( x.length, x, 1, y, 1 ); if ( isnan( d ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js index ad644864b9c2..8d53ad8f5aba 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -24,7 +24,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Complex64Array = require( '@stdlib/array/complex128' ); +var Complex64Array = require( '@stdlib/array/complex64' ); var pkg = require( './../package.json' ).name; var cdotu = require( './../lib/ndarray.js' ); @@ -42,7 +42,7 @@ var options = { * Creates a benchmark function. * * @private -* @param {PositiveInteger} N - array Ngth +* @param {PositiveInteger} N - array length * @returns {Function} benchmark function */ function createBenchmark( N ) { @@ -65,7 +65,7 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - d = cdotu( x.Ngth, x, 1, 0, y, 1, 0 ); + d = cdotu( x.length, x, 1, 0, y, 1, 0 ); if ( isnan( d ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts index 96de97a9230c..7b6c23ade195 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts @@ -28,109 +28,77 @@ import { Complex64 } from '@stdlib/types/complex'; */ interface Routine { /** - * Calculates the dot product of vectors `zx` and `zy`. + * Computes the dot product of vectors `x` and `y`. * * @param N - number of indexed elements - * @param zx - first input array - * @param strideX - `zx` stride length - * @param zy - second input array - * @param strideY - `zy` stride length + * @param x - first input array + * @param strideX - `x` stride length + * @param y - second input array + * @param strideY - `y` stride length * @returns dot product * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); - * var real = require( '@stdlib/complex/float32/real' ); - * var imag = require( '@stdlib/complex/float32/imag' ); * - * var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); - * var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); + * var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); + * var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * - * var z = cdotu( 3, zx, 1, zy, 1 ); - * // returns - * - * var re = real( z ); - * // returns -52.0 - * - * var im = imag( z ); - * // returns 82.0 + * var z = cdotu( 3, x, 1, y, 1 ); + * // returns [ -52.0, 82.0 ] */ - ( N: number, zx: Complex64Array, strideX: number, zy: Complex64Array, strideY: number ): Complex64; + ( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64; /** - * Calculates the dot product of vectors `zx` and `zy` using alternative indexing semantics. + * Computes the dot product of vectors `x` and `y` using alternative indexing semantics. * * @param N - number of indexed elements - * @param zx - first input array - * @param strideX - `zx` stride length - * @param offsetX - starting index for `zx` - * @param zy - second input array - * @param strideY - `zy` stride length - * @param offsetY - starting index for `zy` + * @param x - first input array + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` + * @param y - second input array + * @param strideY - `y` stride length + * @param offsetY - starting index for `y` * @returns dot product * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); - * var real = require( '@stdlib/complex/float32/real' ); - * var imag = require( '@stdlib/complex/float32/imag' ); - * - * var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); - * var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); - * - * var z = cdotu.ndarray( 3, zx, 1, 0, zy, 1, 0 ); - * // returns * - * var re = real( z ); - * // returns -52.0 + * var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); + * var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * - * var im = imag( z ); - * // returns 82.0 + * var z = cdotu.ndarray( x.length, x, 1, 0, y, 1, 0 ); + * // returns [ -52.0, 82.0 ] */ - ndarray( N: number, zx: Complex64Array, strideX: number, offsetX: number, zy: Complex64Array, strideY: number, offsetY: number ): Complex64; + ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64; } /** * Computes the dot product of two single-precision complex floating-point vectors. * * @param N - number of indexed elements -* @param zx - first input array -* @param strideX - `zx` stride length -* @param zy - second input array -* @param strideY - `zy` stride length +* @param x - first input array +* @param strideX - `x` stride length +* @param y - second input array +* @param strideY - `y` stride length * @returns dot product * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); -* var real = require( '@stdlib/complex/float32/real' ); -* var imag = require( '@stdlib/complex/float32/imag' ); * -* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * -* var z = cdotu( 3, zx, 1, zy, 1 ); -* // returns -* -* var re = real( z ); -* // returns -52.0 -* -* var im = imag( z ); -* // returns 82.0 +* var z = cdotu( 3, x, 1, y, 1 ); +* // returns [ -52.0, 82.0 ] * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); -* var real = require( '@stdlib/complex/float32/real' ); -* var imag = require( '@stdlib/complex/float32/imag' ); -* -* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); -* -* var z = cdotu.ndarray( 3, zx, 1, 0, zy, 1, 0 ); -* // returns * -* var re = real( z ); -* // returns -52.0 +* var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * -* var im = imag( z ); -* // returns 82.0 +* var z = cdotu.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns [ -52.0, 82.0 ] */ declare var cdotu: Routine; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts index d7f3fe0dda43..519c407075ed 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts @@ -24,226 +24,226 @@ import cdotu = require( './index' ); // The function returns Complex64... { - const zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu( zx.length, zx, 1, zy, 1 ); // $ExpectType Complex64 + cdotu( x.length, x, 1, y, 1 ); // $ExpectType Complex64 } // The compiler throws an error if the function is provided a first argument which is not a number... { - const zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu( '10', zx, 1, zy, 1 ); // $ExpectError - cdotu( true, zx, 1, zy, 1 ); // $ExpectError - cdotu( false, zx, 1, zy, 1 ); // $ExpectError - cdotu( null, zx, 1, zy, 1 ); // $ExpectError - cdotu( undefined, zx, 1, zy, 1 ); // $ExpectError - cdotu( [], zx, 1, zy, 1 ); // $ExpectError - cdotu( {}, zx, 1, zy, 1 ); // $ExpectError - cdotu( ( zx: number ): number => zx, zx, 1, zy, 1 ); // $ExpectError + cdotu( '10', x, 1, y, 1 ); // $ExpectError + cdotu( true, x, 1, y, 1 ); // $ExpectError + cdotu( false, x, 1, y, 1 ); // $ExpectError + cdotu( null, x, 1, y, 1 ); // $ExpectError + cdotu( undefined, x, 1, y, 1 ); // $ExpectError + cdotu( [], x, 1, y, 1 ); // $ExpectError + cdotu( {}, x, 1, y, 1 ); // $ExpectError + cdotu( ( 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 Complex64Array... { - const zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu( zx.length, 10, 1, zy, 1 ); // $ExpectError - cdotu( zx.length, '10', 1, zy, 1 ); // $ExpectError - cdotu( zx.length, true, 1, zy, 1 ); // $ExpectError - cdotu( zx.length, false, 1, zy, 1 ); // $ExpectError - cdotu( zx.length, null, 1, zy, 1 ); // $ExpectError - cdotu( zx.length, undefined, 1, zy, 1 ); // $ExpectError - cdotu( zx.length, [ '1' ], 1, zy, 1 ); // $ExpectError - cdotu( zx.length, {}, 1, zy, 1 ); // $ExpectError - cdotu( zx.length, ( zx: number ): number => zx, 1, zy, 1 ); // $ExpectError + cdotu( x.length, 10, 1, y, 1 ); // $ExpectError + cdotu( x.length, '10', 1, y, 1 ); // $ExpectError + cdotu( x.length, true, 1, y, 1 ); // $ExpectError + cdotu( x.length, false, 1, y, 1 ); // $ExpectError + cdotu( x.length, null, 1, y, 1 ); // $ExpectError + cdotu( x.length, undefined, 1, y, 1 ); // $ExpectError + cdotu( x.length, [ '1' ], 1, y, 1 ); // $ExpectError + cdotu( x.length, {}, 1, y, 1 ); // $ExpectError + cdotu( x.length, ( 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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu( zx.length, zx, '10', zy, 1 ); // $ExpectError - cdotu( zx.length, zx, true, zy, 1 ); // $ExpectError - cdotu( zx.length, zx, false, zy, 1 ); // $ExpectError - cdotu( zx.length, zx, null, zy, 1 ); // $ExpectError - cdotu( zx.length, zx, undefined, zy, 1 ); // $ExpectError - cdotu( zx.length, zx, [], zy, 1 ); // $ExpectError - cdotu( zx.length, zx, {}, zy, 1 ); // $ExpectError - cdotu( zx.length, zx, ( zx: number ): number => zx, zy, 1 ); // $ExpectError + cdotu( x.length, x, '10', y, 1 ); // $ExpectError + cdotu( x.length, x, true, y, 1 ); // $ExpectError + cdotu( x.length, x, false, y, 1 ); // $ExpectError + cdotu( x.length, x, null, y, 1 ); // $ExpectError + cdotu( x.length, x, undefined, y, 1 ); // $ExpectError + cdotu( x.length, x, [], y, 1 ); // $ExpectError + cdotu( x.length, x, {}, y, 1 ); // $ExpectError + cdotu( 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 Complex64Array... { - const zx = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); - cdotu( zx.length, zx, 1, 10, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, '10', 1 ); // $ExpectError - cdotu( zx.length, zx, 1, true, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, false, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, null, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, undefined, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, [], 1 ); // $ExpectError - cdotu( zx.length, zx, 1, {}, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, ( zx: number ): number => zx, 1 ); // $ExpectError + cdotu( x.length, x, 1, 10, 1 ); // $ExpectError + cdotu( x.length, x, 1, '10', 1 ); // $ExpectError + cdotu( x.length, x, 1, true, 1 ); // $ExpectError + cdotu( x.length, x, 1, false, 1 ); // $ExpectError + cdotu( x.length, x, 1, null, 1 ); // $ExpectError + cdotu( x.length, x, 1, undefined, 1 ); // $ExpectError + cdotu( x.length, x, 1, [], 1 ); // $ExpectError + cdotu( x.length, x, 1, {}, 1 ); // $ExpectError + cdotu( x.length, 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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu( zx.length, zx, 1, zy, '10' ); // $ExpectError - cdotu( zx.length, zx, 1, zy, true ); // $ExpectError - cdotu( zx.length, zx, 1, zy, false ); // $ExpectError - cdotu( zx.length, zx, 1, zy, null ); // $ExpectError - cdotu( zx.length, zx, 1, zy, undefined ); // $ExpectError - cdotu( zx.length, zx, 1, zy, [] ); // $ExpectError - cdotu( zx.length, zx, 1, zy, {} ); // $ExpectError - cdotu( zx.length, zx, 1, zy, ( zx: number ): number => zx ); // $ExpectError + cdotu( x.length, x, 1, y, '10' ); // $ExpectError + cdotu( x.length, x, 1, y, true ); // $ExpectError + cdotu( x.length, x, 1, y, false ); // $ExpectError + cdotu( x.length, x, 1, y, null ); // $ExpectError + cdotu( x.length, x, 1, y, undefined ); // $ExpectError + cdotu( x.length, x, 1, y, [] ); // $ExpectError + cdotu( x.length, x, 1, y, {} ); // $ExpectError + cdotu( 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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); cdotu(); // $ExpectError - cdotu( zx.length ); // $ExpectError - cdotu( zx.length, zx ); // $ExpectError - cdotu( zx.length, zx, 1 ); // $ExpectError - cdotu( zx.length, zx, 1, zy ); // $ExpectError - cdotu( zx.length, zx, 1, zy, 1, 10 ); // $ExpectError + cdotu( x.length ); // $ExpectError + cdotu( x.length, x ); // $ExpectError + cdotu( x.length, x, 1 ); // $ExpectError + cdotu( x.length, x, 1, y ); // $ExpectError + cdotu( x.length, x, 1, y, 1, 10 ); // $ExpectError } // Attached to main export is an `ndarray` method which returns a Complex64... { - const zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); // $ExpectType Complex64 + cdotu.ndarray( x.length, x, 1, 0, y, 1, 0 ); // $ExpectType Complex64 } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... { - const zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( '10', zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( true, zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( false, zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( null, zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( undefined, zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( [], zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( {}, zx, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( ( zx: number ): number => zx, zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( '10', x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( true, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( false, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( null, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( undefined, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( [], x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( {}, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.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 Complex64Array... { - const zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, 10, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, '10', 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, true, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, false, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, null, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, undefined, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, [], 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, {}, 1, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, ( zx: number ): number => zx, 1, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, 10, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, '10', 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, true, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, false, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, null, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, undefined, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, [], 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, {}, 1, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, ( 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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, zx, '10', 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, true, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, false, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, null, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, undefined, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, [], 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, {}, 0, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, ( zx: number ): number => zx, 0, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, '10', 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, true, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, false, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, null, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, undefined, 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, [], 0, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, {}, 0, y, 1, 0 ); // $ExpectError + cdotu.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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, zx, 1, '10', zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, true, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, false, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, null, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, undefined, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, [], zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, {}, zy, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, ( zx: number ): number => zx, zy, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, '10', y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, true, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, false, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, null, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, undefined, y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, [], y, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, {}, y, 1, 0 ); // $ExpectError + cdotu.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 Complex64Array... { - const zx = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, zx, 1, 0, 10, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, '10', 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, true, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, false, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, null, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, undefined, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, [], 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, {}, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, ( zx: number ): number => zx, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, 10, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, '10', 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, true, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, false, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, null, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, undefined, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, [], 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, {}, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, 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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, zx, 1, 0, zy, '10', 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, true, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, false, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, null, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, undefined, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, [], 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, {}, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, ( zx: number ): number => zx, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, '10', 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, true, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, false, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, null, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, undefined, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, [], 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, {}, 0 ); // $ExpectError + cdotu.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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, '10' ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, true ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, false ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, null ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, undefined ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, [] ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, {} ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, ( zx: number ): number => zx ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, '10' ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, true ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, false ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, null ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, undefined ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, [] ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, {} ); // $ExpectError + cdotu.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 zx = new Complex64Array( 10 ); - const zy = new Complex64Array( 10 ); + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); cdotu.ndarray(); // $ExpectError - cdotu.ndarray( zx.length ); // $ExpectError - cdotu.ndarray( zx.length, zx ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1 ); // $ExpectError - cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0, 10 ); // $ExpectError + cdotu.ndarray( x.length ); // $ExpectError + cdotu.ndarray( x.length, x ); // $ExpectError + cdotu.ndarray( x.length, x, 1 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1 ); // $ExpectError + cdotu.ndarray( x.length, x, 1, 0, y, 1, 0, 10 ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js index 1d2da83f4938..84ae3961f488 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js @@ -30,33 +30,25 @@ var ndarray = require( './ndarray.js' ); * Calculates the dot product of two single-precision complex floating-point vectors. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex64Array} zx - first input array -* @param {integer} strideX - `zx` stride length -* @param {Complex64Array} zy - second input array -* @param {integer} strideY - `zy` stride length +* @param {Complex64Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {Complex64Array} y - second input array +* @param {integer} strideY - `y` stride length * @returns {Complex64} dot product * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); -* var real = require( '@stdlib/complex/float32/real' ); -* var imag = require( '@stdlib/complex/float32/imag' ); * -* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * -* var z = cdotu( 3, zx, 1, zy, 1 ); -* // returns -* -* var re = real( z ); -* // returns -52.0 -* -* var im = imag( z ); -* // returns 82.0 +* var z = cdotu( 3, x, 1, y, 1 ); +* // returns [ -52.0, 82.0 ] */ -function cdotu( N, zx, strideX, zy, strideY ) { +function cdotu( N, x, strideX, y, strideY ) { var ix = stride2offset( N, strideX ); var iy = stride2offset( N, strideY ); - return ndarray( N, zx, strideX, ix, zy, strideY, iy ); + return ndarray( N, x, strideX, ix, y, strideY, iy ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js index 9a5444929a5a..9d590d21683d 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js @@ -19,45 +19,29 @@ 'use strict'; /** -* BLAS level 1 routine to compute the dot product of two single-precision complex floating-point vectors. +* BLAS level 1 routine to calculate the dot product of two single-precision complex floating-point vectors. * * @module @stdlib/blas/base/cdotu * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); -* var real = require( '@stdlib/complex/float32/real' ); -* var imag = require( '@stdlib/complex/float32/imag' ); * var cdotu = require( '@stdlib/blas/base/cdotu' ); * -* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * -* var z = cdotu( 3, zx, 1, zy, 1 ); -* // returns -* -* var re = real( z ); -* // returns -52.0 -* -* var im = imag( z ); -* // returns 82.0 +* var z = cdotu( 3, x, 1, y, 1 ); +* // returns [ -52.0, 82.0 ] * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); -* var real = require( '@stdlib/complex/float32/real' ); -* var imag = require( '@stdlib/complex/float32/imag' ); * var cdotu = require( '@stdlib/blas/base/cdotu' ); * -* var zx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var zy = new Complex64Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); -* -* var z = cdotu.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 ); -* // returns -* -* var re = real( z ); -* // returns -40.0 +* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +* var y = new Complex64Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); * -* var im = imag( z ); -* // returns 310.0 +* var z = cdotu.ndarray( 2, x, 2, 1, y, -1, y.length-1 ); +* // returns [ -40.0, 310.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js index 21e31c2a4398..7df887b335db 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js @@ -21,8 +21,7 @@ // MODULES // var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var cmul = require( '@stdlib/complex/float32/base/mul' ); -var cadd = require( '@stdlib/complex/float32/base/add' ); +var muladd = require( '@stdlib/complex/float32/base/mul-add' ); // MAIN // @@ -31,32 +30,24 @@ var cadd = require( '@stdlib/complex/float32/base/add' ); * Calculates the dot product of two single-precision complex floating-point vectors. * * @param {integer} N - number of indexed elements -* @param {Complex64Array} zx - first input array -* @param {integer} strideX - `zx` stride length -* @param {NonNegativeInteger} offsetX - starting index for `zx` -* @param {Complex64Array} zy - second input array -* @param {integer} strideY - `zy` stride length -* @param {NonNegativeInteger} offsetY - starting index for `zy` +* @param {Complex64Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex64Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` * @returns {Complex64} dot product * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); -* var real = require( '@stdlib/complex/float32/real' ); -* var imag = require( '@stdlib/complex/float32/imag' ); * -* var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -* var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * -* var z = cdotu( 3, zx, 1, 0, zy, 1, 0 ); -* // returns -* -* var re = real( z ); -* // returns -52.0 -* -* var im = imag( z ); -* // returns 82.0 +* var z = cdotu( 3, x, 1, 0, y, 1, 0 ); +* // returns [ -52.0, 82.0 ] */ -function cdotu( N, zx, strideX, offsetX, zy, strideY, offsetY ) { +function cdotu( N, x, strideX, offsetX, y, strideY, offsetY ) { var dot; var ix; var iy; @@ -69,7 +60,7 @@ function cdotu( N, zx, strideX, offsetX, zy, strideY, offsetY ) { ix = offsetX; iy = offsetY; for ( i = 0; i < N; i++ ) { - dot = cadd( cmul( zx.get( ix ), zy.get( iy ) ), dot ); + dot = muladd( x.get( ix ), y.get( iy ), dot ); ix += strideX; iy += strideY; } From a61700167fd30a82855ce1210372884bd7c77782 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 22:18:08 +0530 Subject: [PATCH 05/19] Fixed repl and updated readme --- .../@stdlib/blas/base/cdotu/README.md | 138 +++++++----------- .../@stdlib/blas/base/cdotu/docs/repl.txt | 91 +++++------- 2 files changed, 93 insertions(+), 136 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/README.md b/lib/node_modules/@stdlib/blas/base/cdotu/README.md index 8e9b31b33f8c..7dd3ea0db87e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotu/README.md @@ -20,18 +20,23 @@ limitations under the License. # cdotu -> Calculate the [dot product][dot-product] of two single-precision complex floating-point vectors. +> Calculate the dot product of two single-precision complex floating-point vectors.
The [dot product][dot-product] (or scalar product) is defined as - + ```math -\mathbf{zx}\cdot\mathbf{zy} = \sum_{i=0}^{N-1} zx_i zy_i = zx_0 zy_0 + zx_1 zy_1 + \ldots + zx_{N-1} zy_{N-1} +\mathbf{x}\cdot\mathbf{y} = \sum_{i=0}^{N-1} x_i y_i = x_0 y_0 + x_1 y_1 + \ldots + x_{N-1} y_{N-1} ``` + +
@@ -46,54 +51,38 @@ The [dot product][dot-product] (or scalar product) is defined as var cdotu = require( '@stdlib/blas/base/cdotu' ); ``` -#### cdotu( N, zx, strideX, zy, strideY ) +#### cdotu( N, x, strideX, y, strideY ) -Calculates the dot product of vectors `zx` and `zy`. +Computes the dot product of vectors `x` and `y`. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); - -var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); -var z = cdotu( 3, zx, 1, zy, 1 ); -// returns +var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); -var re = real( z ); -// returns -52.0 - -var im = imag( z ); -// returns 82.0 +var z = cdotu( 3, x, 1, y, 1 ); +// returns [ -52.0, 82.0 ] ``` The function has the following parameters: - **N**: number of indexed elements. -- **zx**: input [`Complex64Array`][@stdlib/array/complex64]. -- **strideX**: index increment for `zx`. -- **zy**: input [`Complex64Array`][@stdlib/array/complex64]. -- **strideY**: index increment for `zy`. +- **x**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: stride length for `x`. +- **y**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideY**: stride length for `y`. -The `N` and strides parameters determine which elements in the strided arrays are accessed at runtime. For example, to calculate the dot product of every other value in `zx` and the first `N` elements of `zy` in reverse order, +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to calculate the dot product of every other element in `x` and the first `N` elements of `y` in reverse order, ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); - -var zx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -var zy = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); -var z = cdotu( 2, zx, 2, zy, -1 ); -// returns +var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var y = new Complex64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); -var re = real( z ); -// returns -2.0 - -var im = imag( z ); -// returns 14.0 +var z = cdotu( 2, x, 2, y, -1 ); +// returns [ -2.0, 14.0 ] ``` Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. @@ -102,72 +91,50 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); // Initial arrays... -var zx0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -var zy0 = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); +var x0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var y0 = new Complex64Array( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); // Create offset views... -var zx1 = new Complex64Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var zy1 = new Complex64Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // start at 3th element - -var z = cdotu( 1, zx1, 1, zy1, 1 ); -// returns - -var re = real( z ); -// returns -15.0 +var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element -var im = imag( z ); -// returns 80.0 +var z = cdotu( 1, x1, 1, y1, 1 ); +// returns [ -15.0, 80.0 ] ``` -#### cdotu.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY ) +#### cdotu.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) -Calculates the dot product of `zx` and `zy` using alternative indexing semantics. +Computes the dot product of `x` and `y` using alternative indexing semantics. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); -var zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); -var zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); -var z = cdotu.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); -// returns - -var re = real( z ); -// returns -52.0 - -var im = imag( z ); -// returns 82.0 +var z = cdotu.ndarray( x.length, x, 1, 0, y, 1, 0 ); +// returns [ -52.0, 82.0 ] ``` The function has the following additional parameters: -- **offsetX**: starting index for `zx`. -- **offsetY**: starting index for `zy`. +- **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 calculate the dot product of every other value in `zx` starting from the second value with the last 2 elements in `zy` in reverse order +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 calculate the dot product of every other element in `x` starting from the second element with the last 2 elements in `y` in reverse order + + ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); - -var zx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -var zy = new Complex64Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); // eslint-disable-line max-len -var z = cdotu.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 ); -// returns +var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var y = new Complex64Array( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); -var re = real( z ); -// returns -40.0 - -var im = imag( z ); -// returns 310.0 +var z = cdotu.ndarray( 2, x, 2, 1, y, -1, y.length-1 ); +// returns [ -40.0, 310.0 ] ``` @@ -201,13 +168,18 @@ function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -var zx = filledarrayBy( 10, 'complex64', rand ); -console.log( zx.toString() ); +var x = filledarrayBy( 10, 'complex64', rand ); +console.log( x.toString() ); + +var y = filledarrayBy( 10, 'complex64', rand ); +console.log( y.toString() ); -var zy = filledarrayBy( 10, 'complex64', rand ); -console.log( zy.toString() ); +// Compute the dot product: +var out = cdotu( x.length, x, 1, y, -1 ); +console.log( out.toString() ); -var out = cdotu.ndarray( zx.length, zx, 1, 0, zy, -1, zy.length-1 ); +// Compute the dot product using alternative indexing semantics: +out = cdotu.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); console.log( out.toString() ); ``` @@ -231,7 +203,7 @@ console.log( out.toString() ); [blas]: http://www.netlib.org/blas -[cdotu]: https://www.netlib.org/lapack/explore-html/d7/d7b/cdotu_8f_source.html +[cdotu]: https://www.netlib.org/lapack/explore-html/d1/dcc/group__dot_ga2cce681b6aed3728b893a555b3bee55c.html#ga2cce681b6aed3728b893a555b3bee55c [@stdlib/array/complex64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/complex64 diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt index 944e59ca693e..a23afd4b0682 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt @@ -1,5 +1,5 @@ -{{alias}}( N, zx, strideX, zy, strideY ) +{{alias}}( N, x, strideX, y, strideY ) Calculate the dot product of two single-precision complex floating-point vectors. @@ -16,56 +16,47 @@ N: integer Number of indexed elements. - zx: Complex64Array + x: Complex64Array First input array. strideX: integer - Index increment for `zx`. + Stride length for `x`. - zy: Complex64Array + y: Complex64Array Second input array. strideY: integer - Index increment for `zy`. + Stride length for `y`. Returns ------- out: Complex64 - Scalar constant. + Dot product. Examples -------- // Standard usage: - > var zx = new {{alias:@stdlib/array/complex64}}( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); - > var zy = new {{alias:@stdlib/array/complex64}}( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); - > var z = {{alias}}( 3, zx, 1, zy, 1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( z ) - -52.0 - > var im = {{alias:@stdlib/complex/float32/imag}}( z ) - 82.0 + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, 7.0, 8.0, 9.0 ] ); + > var z = {{alias}}( x.length, x, 1, y, 1 ) + [ -20.0, 78.0 ] // Advanced indexing: - > var zx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > var zy = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); - > var z = {{alias}}( 2, zx, 2, zy, -1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( z ) - -2.0 - > var im = {{alias:@stdlib/complex/float32/imag}}( z ) - 14.0 + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + > var z = {{alias}}( 2, x, 2, y, -1 ) + [ -2.0, 14.0 ] // Using typed array views: - > var zx0 = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > var zy0 = new {{alias:@stdlib/array/complex64}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); - > var zx1 = new {{alias:@stdlib/array/complex64}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); - > var zy1 = new {{alias:@stdlib/array/complex64}}( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); - > var z = {{alias}}( 1, zx1, 1, zy1, 1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( z ) - -15.0 - > var im = {{alias:@stdlib/complex/float32/imag}}( z ) - 80.0 - - -{{alias}}.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY ) + > var x0 = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var y0 = new {{alias:@stdlib/array/complex64}}( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/complex64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); + > var z = {{alias}}( 1, x1, 1, y1, 1 ) + [ -15.0, 80.0 ] + + +{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) Computes the dot product of two single-precision complex floating-point vectors using alternative indexing semantics. @@ -77,48 +68,42 @@ N: integer Number of indexed elements. - zx: Complex64Array + x: Complex64Array First input array. strideX: integer - Index increment for `zx`. + Stride length for `x`. offsetX: integer - Starting index for `zx`. + Starting index for `x`. - zy: Complex64Array + y: Complex64Array Second input array. strideY: integer - Index increment for `zy`. + Stride length for `y`. offsetY: integer - Starting index for `zy`. + Starting index for `y`. Returns ------- out: Complex64 - Second input array. + Dot product. Examples -------- // Standard usage: - > var zx = new {{alias:@stdlib/array/complex64}}( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); - > var zy = new {{alias:@stdlib/array/complex64}}( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); - > var z = {{alias}}.ndarray( zx.length, zx, 1, 0, zy, 1, 0 ); - > var re = {{alias:@stdlib/complex/float32/real}}( z ) - -52.0 - > var im = {{alias:@stdlib/complex/float32/imag}}( z ) - 82.0 + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, 7.0, 8.0, 9.0 ] ); + > var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) + [ -20.0, 78.0 ] // Advanced indexing: - > var zx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - > var zy = new {{alias:@stdlib/array/complex64}}( [ 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 ] ); - > var z = {{alias}}.ndarray( 2, zx, 2, 1, zy, -1, zy.length-1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( z ) - -40.0 - > var im = {{alias:@stdlib/complex/float32/imag}}( z ) - 310.0 + > var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); + > var z = {{alias}}.ndarray( 1, x, 2, 1, y, -1, y.length-1 ) + [ -1.0, 7.0 ] See Also -------- From 3766509bc7c6ced608f49169a7ce996e43dcfb2c Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 22:32:12 +0530 Subject: [PATCH 06/19] Updated test comments and renaming of variables --- .../blas/base/cdotu/test/test.cdotu.js | 84 +++++++------- .../blas/base/cdotu/test/test.ndarray.js | 106 +++++++++--------- 2 files changed, 95 insertions(+), 95 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js index f6d9ffa68c9f..a079f17fed59 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js @@ -40,48 +40,48 @@ tape( 'the function has an arity of 5', function test( t ) { t.end(); }); -tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `zx` and `zy`', function test( t ) { +tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `x` and `y`', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); - zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); + x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); + y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); - dot = cdotu( 4, zx, 1, zy, 1 ); + dot = cdotu( 4, x, 1, y, 1 ); t.strictEqual( isSameComplex64( dot, new Complex64( 3, 70 ) ), true, 'returns expected value' ); - zx = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); - zy = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); - dot = cdotu( 2, zx, 1, zy, 1 ); + dot = cdotu( 2, x, 1, y, 1 ); t.strictEqual( isSameComplex64( dot, new Complex64( -18, 4 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0 + 0i`', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); - zy = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); - dot = cdotu( 0, zx, 1, zy, 1 ); + dot = cdotu( 0, x, 1, y, 1 ); t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); - dot = cdotu( -4, zx, 1, zy, 1 ); + dot = cdotu( -4, x, 1, y, 1 ); t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'the function supports an `zx` stride', function test( t ) { +tape( 'the function supports an `x` stride', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 2.0, // 0 -3.0, // 0 -5.0, @@ -89,7 +89,7 @@ tape( 'the function supports an `zx` stride', function test( t ) { 7.0, // 1 6.0 // 1 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 8.0, // 0 2.0, // 0 -3.0, // 1 @@ -98,17 +98,17 @@ tape( 'the function supports an `zx` stride', function test( t ) { 1.0 ]); - dot = cdotu( 2, zx, 2, zy, 1 ); + dot = cdotu( 2, x, 2, y, 1 ); t.strictEqual( isSameComplex64( dot, new Complex64( -17, -17 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'the function supports a `zy` stride', function test( t ) { +tape( 'the function supports a `y` stride', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 2.0, // 0 -3.0, // 0 -5.0, // 1 @@ -116,7 +116,7 @@ tape( 'the function supports a `zy` stride', function test( t ) { 6.0, -2.0 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 8.0, // 0 2.0, // 0 -3.0, @@ -125,17 +125,17 @@ tape( 'the function supports a `zy` stride', function test( t ) { 1.0 // 1 ]); - dot = cdotu( 2, zx, 1, zy, 2 ); + dot = cdotu( 2, x, 1, y, 2 ); t.strictEqual( isSameComplex64( dot, new Complex64( 35, -53 ) ), true, 'returns expected value' ); t.end(); }); tape( 'the function supports negative strides', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 1.0, // 1 2.0, // 1 3.0, @@ -143,7 +143,7 @@ tape( 'the function supports negative strides', function test( t ) { 5.0, // 0 6.0 // 0 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 7.0, // 1 8.0, // 1 9.0, // 0 @@ -152,17 +152,17 @@ tape( 'the function supports negative strides', function test( t ) { 12.0 ]); - dot = cdotu( 2, zx, -2, zy, -1 ); + dot = cdotu( 2, x, -2, y, -1 ); t.strictEqual( isSameComplex64( dot, new Complex64( -24, 126 ) ), true, 'returns expected value' ); t.end(); }); tape( 'the function supports complex access patterns', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 1.0, // 0 2.0, // 0 3.0, @@ -170,16 +170,16 @@ tape( 'the function supports complex access patterns', function test( t ) { 5.0, // 1 6.0 // 1 ]); - zy = new Complex64Array([ - 7.0, // 0 - 8.0, // 0 - 9.0, // 1 - 10.0, // 1 + y = new Complex64Array([ + 7.0, // 1 + 8.0, // 1 + 9.0, // 0 + 10.0, // 0 11.0, 12.0 ]); - dot = cdotu( 2, zx, 2, zy, -1 ); + dot = cdotu( 2, x, 2, y, -1 ); t.strictEqual( isSameComplex64( dot, new Complex64( -24, 110 ) ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js index fc9c1891c75c..4afdcae11537 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js @@ -40,21 +40,21 @@ tape( 'the function has an arity of 7', function test( t ) { t.end(); }); -tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `zx` and `zy`', function test( t ) { +tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `x` and `y`', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); - zy = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); + x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); + y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); - dot = cdotu( zx.length, zx, 1, 0, zy, 1, 0 ); + dot = cdotu( x.length, x, 1, 0, y, 1, 0 ); t.strictEqual(isSameComplex64( dot, new Complex64( 3, 70 ) ), true, 'returns expected value' ); - zx = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); - zy = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); - dot = cdotu( zx.length, zx, 1, 0, zy, 1, 0 ); + dot = cdotu( x.length, x, 1, 0, y, 1, 0 ); t.strictEqual( isSameComplex64( dot, new Complex64( -18, 4 ) ), true, 'returns expected value' ); t.end(); @@ -62,26 +62,26 @@ tape( 'the function calculates the dot product of two single-precision complex f tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); - zy = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); + x = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); - dot = cdotu( 0, zx, 1, 0, zy, 1, 0 ); + dot = cdotu( 0, x, 1, 0, y, 1, 0 ); t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); - dot = cdotu( -4, zx, 1, 0, zy, 1, 0 ); + dot = cdotu( -4, x, 1, 0, y, 1, 0 ); t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'the function supports an `zx` stride', function test( t ) { +tape( 'the function supports an `x` stride', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 2.0, // 0 -3.0, // 0 -5.0, @@ -89,7 +89,7 @@ tape( 'the function supports an `zx` stride', function test( t ) { 7.0, // 1 6.0 // 1 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 8.0, // 0 2.0, // 0 -3.0, // 1 @@ -98,17 +98,17 @@ tape( 'the function supports an `zx` stride', function test( t ) { 1.0 ]); - dot = cdotu( 2, zx, 2, 0, zy, 1, 0 ); + dot = cdotu( 2, x, 2, 0, y, 1, 0 ); t.strictEqual( isSameComplex64( dot, new Complex64( -17, -17 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'the function supports an `zx` offset', function test( t ) { +tape( 'the function supports an `x` offset', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 2.0, -3.0, -5.0, // 0 @@ -116,7 +116,7 @@ tape( 'the function supports an `zx` offset', function test( t ) { 7.0, // 1 6.0 // 1 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 8.0, // 0 2.0, // 0 -3.0, // 1 @@ -125,17 +125,17 @@ tape( 'the function supports an `zx` offset', function test( t ) { 1.0 ]); - dot = cdotu( 2, zx, 1, 1, zy, 1, 0 ); + dot = cdotu( 2, x, 1, 1, y, 1, 0 ); t.strictEqual( isSameComplex64( dot, new Complex64( -91, 41 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'the function supports a `zy` stride', function test( t ) { +tape( 'the function supports a `y` stride', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 2.0, // 0 -3.0, // 0 -5.0, // 1 @@ -143,7 +143,7 @@ tape( 'the function supports a `zy` stride', function test( t ) { 7.0, 6.0 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 8.0, // 0 2.0, // 0 -3.0, @@ -152,17 +152,17 @@ tape( 'the function supports a `zy` stride', function test( t ) { 1.0 // 1 ]); - dot = cdotu( 2, zx, 1, 0, zy, 2, 0 ); + dot = cdotu( 2, x, 1, 0, y, 2, 0 ); t.strictEqual( isSameComplex64( dot, new Complex64( 36, -49 ) ), true, 'returns expected value' ); t.end(); }); -tape( 'the function supports a `zy` offset', function test( t ) { +tape( 'the function supports a `y` offset', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 1.0, // 0 2.0, // 0 3.0, @@ -170,7 +170,7 @@ tape( 'the function supports a `zy` offset', function test( t ) { 5.0, // 1 6.0 // 1 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 7.0, 8.0, 9.0, // 0 @@ -179,17 +179,17 @@ tape( 'the function supports a `zy` offset', function test( t ) { 12.0 // 1 ]); - dot = cdotu( 2, zx, 2, 0, zy, 1, 1 ); + dot = cdotu( 2, x, 2, 0, y, 1, 1 ); t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); t.end(); }); tape( 'the function supports negative strides', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 1.0, // 1 2.0, // 1 3.0, @@ -197,7 +197,7 @@ tape( 'the function supports negative strides', function test( t ) { 5.0, // 0 6.0 // 0 ]); - zy = new Complex64Array([ + y = new Complex64Array([ 7.0, 8.0, 9.0, // 1 @@ -206,17 +206,17 @@ tape( 'the function supports negative strides', function test( t ) { 12.0 // 0 ]); - dot = cdotu( 2, zx, -2, zx.length-1, zy, -1, 2 ); + dot = cdotu( 2, x, -2, x.length-1, y, -1, 2 ); t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); t.end(); }); tape( 'the function supports complex access patterns', function test( t ) { var dot; - var zx; - var zy; + var x; + var y; - zx = new Complex64Array([ + x = new Complex64Array([ 1.0, // 0 2.0, // 0 3.0, @@ -224,16 +224,16 @@ tape( 'the function supports complex access patterns', function test( t ) { 5.0, // 1 6.0 // 1 ]); - zy = new Complex64Array([ - 7.0, // 0 - 8.0, // 0 - 9.0, // 1 - 10.0, // 1 + y = new Complex64Array([ + 7.0, // 1 + 8.0, // 1 + 9.0, // 0 + 10.0, // 0 11.0, 12.0 ]); - dot = cdotu( 2, zx, 2, 0, zy, -1, zy.length-2 ); + dot = cdotu( 2, x, 2, 0, y, -1, y.length-2 ); t.strictEqual( isSameComplex64( dot, new Complex64( -24, 110 ) ), true, 'returns expected value' ); t.end(); }); From a7edbb70fa6eacd3749cf2147ae65886a8b243f6 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 22:39:41 +0530 Subject: [PATCH 07/19] add examples --- .../@stdlib/blas/base/cdotu/examples/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js index 50eb26da8bce..3078afc1243b 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js @@ -27,11 +27,16 @@ function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -var zx = filledarrayBy( 10, 'complex64', rand ); -console.log( zx.toString() ); +var x = filledarrayBy( 10, 'complex64', rand ); +console.log( x.toString() ); -var zy = filledarrayBy( 10, 'complex64', rand ); -console.log( zy.toString() ); +var y = filledarrayBy( 10, 'complex64', rand ); +console.log( y.toString() ); -var out = cdotu.ndarray( zx.length, zx, 1, 0, zy, -1, zy.length-1 ); +// Compute the dot product: +var out = cdotu( x.length, x, 1, y, -1 ); +console.log( out.toString() ); + +// Compute the dot product using alternative indexing semantics: +out = cdotu.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); console.log( out.toString() ); From a8955b479bc25490957a9bb75ff07cf5b396a018 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 22:59:58 +0530 Subject: [PATCH 08/19] updated test and refactored bench --- lib/node_modules/@stdlib/blas/base/cdotu/README.md | 4 ++-- .../@stdlib/blas/base/cdotu/benchmark/benchmark.js | 6 ++++-- .../@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js | 6 ++++-- lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt | 2 +- lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts | 4 ++-- lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js | 2 +- .../@stdlib/blas/base/cdotu/test/test.ndarray.js | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/README.md b/lib/node_modules/@stdlib/blas/base/cdotu/README.md index 7dd3ea0db87e..84afd97c37ef 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotu/README.md @@ -53,7 +53,7 @@ var cdotu = require( '@stdlib/blas/base/cdotu' ); #### cdotu( N, x, strideX, y, strideY ) -Computes the dot product of vectors `x` and `y`. +Calculates the dot product of vectors `x` and `y`. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); @@ -106,7 +106,7 @@ var z = cdotu( 1, x1, 1, y1, 1 ); #### cdotu.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) -Computes the dot product of `x` and `y` using alternative indexing semantics. +Calculates the dot product of `x` and `y` using alternative indexing semantics. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js index ac7f054f7778..612d9f179b7a 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -25,6 +25,8 @@ 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 Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); var pkg = require( './../package.json' ).name; var cdotu = require( './../lib/cdotu.js' ); @@ -66,12 +68,12 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { d = cdotu( x.length, x, 1, y, 1 ); - if ( isnan( d ) ) { + if ( isnan( real( d ) ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( d ) ) { + if ( isnan( imag( d ) ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js index 8d53ad8f5aba..549447fe17f7 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -25,6 +25,8 @@ 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 Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); var pkg = require( './../package.json' ).name; var cdotu = require( './../lib/ndarray.js' ); @@ -66,12 +68,12 @@ function createBenchmark( N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { d = cdotu( x.length, x, 1, 0, y, 1, 0 ); - if ( isnan( d ) ) { + if ( isnan( real( d ) ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnan( d ) ) { + if ( isnan( imag( d ) ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt index a23afd4b0682..4ee244431e8b 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}( N, x, strideX, y, strideY ) - Calculate the dot product of two single-precision complex floating-point + Computes the dot product of two single-precision complex floating-point vectors. The `N` and stride parameters determine which elements in the strided diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts index 519c407075ed..426580678ea4 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts @@ -22,7 +22,7 @@ import cdotu = require( './index' ); // TESTS // -// The function returns Complex64... +// The function returns a complex number... { const x = new Complex64Array( 10 ); const y = new Complex64Array( 10 ); @@ -119,7 +119,7 @@ import cdotu = require( './index' ); cdotu( x.length, x, 1, y, 1, 10 ); // $ExpectError } -// Attached to main export is an `ndarray` method which returns a Complex64... +// Attached to main export is an `ndarray` method which returns a complex number... { const x = new Complex64Array( 10 ); const y = new Complex64Array( 10 ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js index a079f17fed59..f3549a9efc93 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js @@ -49,7 +49,7 @@ tape( 'the function calculates the dot product of two single-precision complex f y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); dot = cdotu( 4, x, 1, y, 1 ); - t.strictEqual( isSameComplex64( dot, new Complex64( 3, 70 ) ), true, 'returns expected value' ); + t.strictEqual( isSameComplex64( dot, new Complex64( 3.0, 70.0 ) ), true, 'returns expected value' ); x = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); y = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js index 4afdcae11537..b9d3e34d5d1e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js @@ -49,7 +49,7 @@ tape( 'the function calculates the dot product of two single-precision complex f y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); dot = cdotu( x.length, x, 1, 0, y, 1, 0 ); - t.strictEqual(isSameComplex64( dot, new Complex64( 3, 70 ) ), true, 'returns expected value' ); + t.strictEqual(isSameComplex64( dot, new Complex64( 3.0, 70.0 ) ), true, 'returns expected value' ); x = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); y = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); From ecff1d06cf027e49e60d8144aad2eac3f126c441 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 23:03:08 +0530 Subject: [PATCH 09/19] chore: update documentation --- lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt | 2 +- lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts | 2 +- lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotu/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt index 4ee244431e8b..62c6d150eeda 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt @@ -9,7 +9,7 @@ Indexing is relative to the first index. To introduce an offset, use a typed array view. - If `N <= 0`, the function returns `0 + 0i`. + If `N <= 0`, the function returns `0`. Parameters ---------- diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts index 7b6c23ade195..d2155ee32f27 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts @@ -28,7 +28,7 @@ import { Complex64 } from '@stdlib/types/complex'; */ interface Routine { /** - * Computes the dot product of vectors `x` and `y`. + * Calculates the dot product of vectors `x` and `y`. * * @param N - number of indexed elements * @param x - first input array diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js index 84ae3961f488..0073043e8923 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js @@ -27,7 +27,7 @@ var ndarray = require( './ndarray.js' ); // MAIN // /** -* Calculates the dot product of two single-precision complex floating-point vectors. +* Computes the dot product of two single-precision complex floating-point vectors. * * @param {PositiveInteger} N - number of indexed elements * @param {Complex64Array} x - first input array diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js index 7df887b335db..63f8216b353d 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js @@ -27,7 +27,7 @@ var muladd = require( '@stdlib/complex/float32/base/mul-add' ); // MAIN // /** -* Calculates the dot product of two single-precision complex floating-point vectors. +* Computes the dot product of two single-precision complex floating-point vectors. * * @param {integer} N - number of indexed elements * @param {Complex64Array} x - first input array diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/package.json b/lib/node_modules/@stdlib/blas/base/cdotu/package.json index 128c67121984..4a2e6b254cfe 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/package.json +++ b/lib/node_modules/@stdlib/blas/base/cdotu/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/cdotu", "version": "0.0.0", - "description": "Calculate the dot product of two single-precision complex floating-point vectors.", + "description": "Compute the dot product of two single-precision complex floating-point vectors.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From 81b86a6cc6c15e296c507d033d9ef59f66cb9975 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 23:07:41 +0530 Subject: [PATCH 10/19] add Assign API --- .../@stdlib/blas/base/cdotu/lib/assign.js | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js new file mode 100644 index 000000000000..ec10ac16195f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js @@ -0,0 +1,90 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var muladd = require( '@stdlib/complex/float32/base/mul-add' ).strided; +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); + + +// MAIN // + +/** +* Calculates the dot product of two single-precision complex floating-point vectors. +* +* @param {integer} N - number of indexed elements +* @param {Complex64Array} x - first input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Complex64Array} y - second input array +* @param {integer} strideY - `y` stride length +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @param {Complex64Array} out - output array +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {Complex64Array} dot product array +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); +* var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); +* +* var z = cdotu( 3, x, 1, 0, y, 1, 0, new Complex64Array( 1 ), 0 ); +* // returns [ -52.0, 82.0 ] +*/ +function cdotu( N, x, strideX, offsetX, y, strideY, offsetY, out, offsetOut ) { + var viewOut; + var viewX; + var viewY; + var ix; + var iy; + var io; + var sx; + var sy; + var i; + + if ( N <= 0 ) { + return out; + } + viewX = reinterpret( x, 0 ); + viewY = reinterpret( y, 0 ); + viewOut = reinterpret( out, 0 ); + + ix = offsetX * 2; + iy = offsetY * 2; + io = offsetOut * 2; + sx = strideX * 2; + sy = strideY * 2; + + viewOut[ io ] = 0.0; + viewOut[ io + 1 ] = 0.0; + + for ( i = 0; i < N; i++ ) { + muladd( viewX, 1, ix, viewY, 1, iy, viewOut, 1, io, viewOut, 1, io ); + ix += sx; + iy += sy; + } + return out; +} + + +// EXPORTS // + +module.exports = cdotu; From f10a40fa2c24eb35779a59ab5fad07b344d8e7d3 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 23:10:53 +0530 Subject: [PATCH 11/19] refactor assign --- lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js index ec10ac16195f..d8525dd51810 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js @@ -77,7 +77,7 @@ function cdotu( N, x, strideX, offsetX, y, strideY, offsetY, out, offsetOut ) { viewOut[ io + 1 ] = 0.0; for ( i = 0; i < N; i++ ) { - muladd( viewX, 1, ix, viewY, 1, iy, viewOut, 1, io, viewOut, 1, io ); + muladd( viewX, 1, ix, viewY, 1, iy, viewOut, 1, io, viewOut, 1, io ); // eslint-disable-line max-len ix += sx; iy += sy; } From 0de31eb6d419a258d4692b55860da47d50e885ac Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 23:16:14 +0530 Subject: [PATCH 12/19] updated copyright years and use assign API --- .../@stdlib/blas/base/cdotu/README.md | 2 +- .../blas/base/cdotu/benchmark/benchmark.js | 2 +- .../base/cdotu/benchmark/benchmark.ndarray.js | 2 +- .../blas/base/cdotu/docs/types/index.d.ts | 2 +- .../blas/base/cdotu/docs/types/test.ts | 2 +- .../@stdlib/blas/base/cdotu/examples/index.js | 2 +- .../@stdlib/blas/base/cdotu/lib/assign.js | 2 +- .../@stdlib/blas/base/cdotu/lib/cdotu.js | 2 +- .../@stdlib/blas/base/cdotu/lib/index.js | 2 +- .../@stdlib/blas/base/cdotu/lib/main.js | 2 +- .../@stdlib/blas/base/cdotu/lib/ndarray.js | 28 ++++++------------- .../blas/base/cdotu/test/test.cdotu.js | 2 +- .../@stdlib/blas/base/cdotu/test/test.js | 2 +- .../blas/base/cdotu/test/test.ndarray.js | 2 +- 14 files changed, 22 insertions(+), 32 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/README.md b/lib/node_modules/@stdlib/blas/base/cdotu/README.md index 84afd97c37ef..5fd23e1f4bc6 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotu/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2025 The Stdlib Authors. +Copyright (c) 2026 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js index 612d9f179b7a..3f262ebf6376 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js index 549447fe17f7..90308e21c699 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts index d2155ee32f27..b061ca0d52fb 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts index 426580678ea4..f9639675a3d1 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js index 3078afc1243b..606097d451c5 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js index d8525dd51810..7acdd6b00d89 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js index 0073043e8923..fe162b1ac2f7 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js index 9d590d21683d..de407bf5be4c 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js index e9627d52ef51..3da92be0e34e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js index 63f8216b353d..02e485671aad 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +21,16 @@ // MODULES // var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var muladd = require( '@stdlib/complex/float32/base/mul-add' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); +var fcn = require( './assign.js' ); // MAIN // /** -* Computes the dot product of two single-precision complex floating-point vectors. +* Calculates the dot product of two single-precision complex floating-point vectors. * * @param {integer} N - number of indexed elements * @param {Complex64Array} x - first input array @@ -48,23 +51,10 @@ var muladd = require( '@stdlib/complex/float32/base/mul-add' ); * // returns [ -52.0, 82.0 ] */ function cdotu( N, x, strideX, offsetX, y, strideY, offsetY ) { - var dot; - var ix; - var iy; - var i; + var out = new Complex64Array( 1 ); + fcn( N, x, strideX, offsetX, y, strideY, offsetY, out, 0 ); - dot = new Complex64( 0.0, 0.0 ); - if ( N <= 0 ) { - return dot; - } - ix = offsetX; - iy = offsetY; - for ( i = 0; i < N; i++ ) { - dot = muladd( x.get( ix ), y.get( iy ), dot ); - ix += strideX; - iy += strideY; - } - return dot; + return new Complex64( real( out.get( 0 ) ), imag( out.get( 0 ) ) ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js index f3549a9efc93..084689ab19d9 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js index 04a656870507..48e80e4e7bf8 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js index b9d3e34d5d1e..4919d384960b 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From ff9fc5c7221dee59ecee25369aab4bafa83dad76 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 23:17:47 +0530 Subject: [PATCH 13/19] use string format instead of concatination --- .../@stdlib/blas/base/cdotu/benchmark/benchmark.js | 3 ++- .../@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js index 3f262ebf6376..2127edd842c1 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -27,6 +27,7 @@ var pow = require( '@stdlib/math/base/special/pow' ); var Complex64Array = require( '@stdlib/array/complex64' ); var real = require( '@stdlib/complex/float32/real' ); var imag = require( '@stdlib/complex/float32/imag' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var cdotu = require( './../lib/cdotu.js' ); @@ -102,7 +103,7 @@ function main() { for ( i = min; i <= max; i++ ) { N = pow( 10, i ); f = createBenchmark( N ); - bench( pkg+':N='+N, f ); + bench( format( '%s:len=%d', pkg, N ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js index 90308e21c699..5e2a222b0bdc 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -27,6 +27,7 @@ var pow = require( '@stdlib/math/base/special/pow' ); var Complex64Array = require( '@stdlib/array/complex64' ); var real = require( '@stdlib/complex/float32/real' ); var imag = require( '@stdlib/complex/float32/imag' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var cdotu = require( './../lib/ndarray.js' ); @@ -102,7 +103,7 @@ function main() { for ( i = min; i <= max; i++ ) { N = pow( 10, i ); f = createBenchmark( N ); - bench( pkg+':ndarray:N='+N, f ); + bench( format( '%s:ndarray:len=%d', pkg, N ), f ); } } From 4eac5aebba5c911b3660018975c9bb8422d19f24 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 19 Jan 2026 23:46:24 +0530 Subject: [PATCH 14/19] update description --- lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt | 3 +-- lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt index 62c6d150eeda..bb578677497e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt @@ -61,8 +61,7 @@ vectors using alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the offset parameters support indexing based on a starting index. - + buffer, offset parameters support indexing based on starting indices. Parameters ---------- N: integer diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts index b061ca0d52fb..699e98ffe2fa 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/types/index.d.ts @@ -73,7 +73,7 @@ interface Routine { } /** -* Computes the dot product of two single-precision complex floating-point vectors. +* Calculates the dot product of two single-precision complex floating-point vectors. * * @param N - number of indexed elements * @param x - first input array From 1be9bb6bc9fc164ede383994ef4ea4ea0e38cfa5 Mon Sep 17 00:00:00 2001 From: kaustubh Date: Mon, 26 Jan 2026 13:43:24 +0530 Subject: [PATCH 15/19] commit added space --- lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt index bb578677497e..ca870e250dc9 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotu/docs/repl.txt @@ -62,6 +62,7 @@ While typed array views mandate a view offset based on the underlying buffer, offset parameters support indexing based on starting indices. + Parameters ---------- N: integer From 8e9ce7ef83d94fc3445d272c73357254de042d5e Mon Sep 17 00:00:00 2001 From: DhruvArvindSingh Date: Mon, 16 Mar 2026 23:35:34 +0530 Subject: [PATCH 16/19] feat: adds C and fortran implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/base/cdotu/benchmark/benchmark.js | 2 +- .../base/cdotu/benchmark/benchmark.native.js | 115 +++++ .../base/cdotu/benchmark/benchmark.ndarray.js | 4 +- .../benchmark/benchmark.ndarray.native.js | 115 +++++ .../@stdlib/blas/base/cdotu/binding.gyp | 265 ++++++++++ .../blas/base/cdotu/examples/c/example.c | 51 ++ .../@stdlib/blas/base/cdotu/include.gypi | 70 +++ .../cdotu/include/stdlib/blas/base/cdotu.h | 48 ++ .../include/stdlib/blas/base/cdotu_cblas.h | 43 ++ .../include/stdlib/blas/base/cdotu_fortran.h | 41 ++ .../blas/base/cdotu/lib/cdotu.native.js | 59 +++ .../@stdlib/blas/base/cdotu/lib/native.js | 35 ++ .../@stdlib/blas/base/cdotu/lib/ndarray.js | 39 +- .../lib/{assign.js => ndarray.native.js} | 53 +- .../@stdlib/blas/base/cdotu/manifest.json | 458 ++++++++++++++++++ .../@stdlib/blas/base/cdotu/package.json | 2 + .../@stdlib/blas/base/cdotu/src/Makefile | 70 +++ .../@stdlib/blas/base/cdotu/src/addon.c | 81 ++++ .../@stdlib/blas/base/cdotu/src/cdotu.c | 37 ++ .../@stdlib/blas/base/cdotu/src/cdotu.f | 101 ++++ .../@stdlib/blas/base/cdotu/src/cdotu_cblas.c | 54 +++ .../@stdlib/blas/base/cdotu/src/cdotu_f.c | 63 +++ .../blas/base/cdotu/src/cdotu_ndarray.c | 66 +++ .../@stdlib/blas/base/cdotu/src/cdotusub.f | 49 ++ .../blas/base/cdotu/test/test.cdotu.native.js | 226 +++++++++ .../base/cdotu/test/test.ndarray.native.js | 248 ++++++++++ 26 files changed, 2346 insertions(+), 49 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/include/stdlib/blas/base/cdotu.h create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/include/stdlib/blas/base/cdotu_cblas.h create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/include/stdlib/blas/base/cdotu_fortran.h create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/cdotu.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/lib/native.js rename lib/node_modules/@stdlib/blas/base/cdotu/lib/{assign.js => ndarray.native.js} (58%) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.f create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_cblas.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_f.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_ndarray.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/src/cdotusub.f create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.native.js diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js index 2127edd842c1..40d3d6a4d09f 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.js @@ -91,9 +91,9 @@ function createBenchmark( N ) { * @private */ function main() { - var N; var min; var max; + var N; var f; var i; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.native.js new file mode 100644 index 000000000000..8597933519f3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.native.js @@ -0,0 +1,115 @@ +/** +* @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 Complex64Array = require( '@stdlib/array/complex64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var cdotu = tryRequire( resolve( __dirname, './../lib/cdotu.native.js' ) ); +var opts = { + 'skip': ( cdotu instanceof Error ) +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var x; + var y; + + x = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = cdotu( x.length, x, 1, y, 1 ); + if ( isnan( real( d ) ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( imag( d ) ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = pow( 10, i ); + f = createBenchmark( N ); + bench( format( '%s::native:len=%d', pkg, N ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js index 5e2a222b0bdc..aab9755291f7 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.js @@ -91,9 +91,9 @@ function createBenchmark( N ) { * @private */ function main() { - var N; var min; var max; + var N; var f; var i; @@ -103,7 +103,7 @@ function main() { for ( i = min; i <= max; i++ ) { N = pow( 10, i ); f = createBenchmark( N ); - bench( format( '%s:ndarray:len=%d', pkg, N ), f ); + bench( format( '%s::native:ndarray:len=%d', pkg, N ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.native.js new file mode 100644 index 000000000000..755c649e3290 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/benchmark/benchmark.ndarray.native.js @@ -0,0 +1,115 @@ +/** +* @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 Complex64Array = require( '@stdlib/array/complex64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var real = require( '@stdlib/complex/float32/real' ); +var imag = require( '@stdlib/complex/float32/imag' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var cdotu = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( cdotu instanceof Error ) +}; +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var x; + var y; + + x = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( N*2, -100.0, 100.0, options ) ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = cdotu( x.length, x, 1, 0, y, 1, 0 ); + if ( isnan( real( d ) ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( imag( d ) ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = pow( 10, i ); + f = createBenchmark( N ); + bench( format( '%s::native:ndarray:len=%d', pkg, N ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/binding.gyp b/lib/node_modules/@stdlib/blas/base/cdotu/binding.gyp new file mode 100644 index 000000000000..60dce9d0b31a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/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/base/cdotu/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/cdotu/examples/c/example.c new file mode 100644 index 000000000000..66b2af3a74e1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/examples/c/example.c @@ -0,0 +1,51 @@ +/** +* @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/base/cdotu.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include + +int main( void ) { + // Create strided arrays: + const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; + const float y[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; + + // Specify the number of elements: + const int N = 4; + + // Specify strides: + const int strideX = 1; + const int strideY = 1; + + // Create a complex number to store the result: + stdlib_complex64_t z; + + // Compute the dot product: + c_cdotu( N, (const void *)x, strideX, (const void *)y, strideY, (void *)&z ); + + // Print the result: + printf( "dot: %f + %fi\n", stdlib_complex64_real( z ), stdlib_complex64_imag( z ) ); + + // Compute the dot product: + c_cdotu_ndarray( N, (const void *)x, strideX, 0, (const void *)y, strideY, 0, (void *)&z ); + + // Print the result: + printf( "dot: %f + %fi\n", stdlib_complex64_real( z ), stdlib_complex64_imag( z ) ); +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/include.gypi b/lib/node_modules/@stdlib/blas/base/cdotu/include.gypi new file mode 100644 index 000000000000..dcb556d250e8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/include.gypi @@ -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. + +# A GYP include file for building a Node.js native add-on. +# +# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +# +# Variable nesting hacks: +# +# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi +# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004 +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + 'variables': { + # Host BLAS library (to override -Dblas=): + 'blas%': '', + + # Path to BLAS library (to override -Dblas_dir=): + 'blas_dir%': '', + }, # end variables + + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '<@(blas_dir)', + '[ -52.0, 82.0 ] +*/ +function cdotu( N, x, strideX, y, strideY ) { + var viewX = reinterpret( x, 0 ); + var viewY = reinterpret( y, 0 ); + var obj = addon( N, viewX, strideX, viewY, strideY ); + return new Complex64( obj.re, obj.im ); +} + + +// EXPORTS // + +module.exports = cdotu; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/native.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/native.js new file mode 100644 index 000000000000..1829112470cd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/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 cdotu = require( './cdotu.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( cdotu, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = cdotu; diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js index 02e485671aad..018b2c52778c 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.js @@ -20,11 +20,8 @@ // MODULES // +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var Complex64Array = require( '@stdlib/array/complex64' ); -var real = require( '@stdlib/complex/float32/real' ); -var imag = require( '@stdlib/complex/float32/imag' ); -var fcn = require( './assign.js' ); // MAIN // @@ -51,10 +48,38 @@ var fcn = require( './assign.js' ); * // returns [ -52.0, 82.0 ] */ function cdotu( N, x, strideX, offsetX, y, strideY, offsetY ) { - var out = new Complex64Array( 1 ); - fcn( N, x, strideX, offsetX, y, strideY, offsetY, out, 0 ); + var viewX; + var viewY; + var tr; + var ti; + var ix; + var iy; + var sx; + var sy; + var i; - return new Complex64( real( out.get( 0 ) ), imag( out.get( 0 ) ) ); + if ( N <= 0 ) { + return new Complex64( 0.0, 0.0 ); + } + viewX = reinterpret( x, 0 ); + viewY = reinterpret( y, 0 ); + + ix = offsetX * 2; + iy = offsetY * 2; + sx = strideX * 2; + sy = strideY * 2; + + tr = 0.0; + ti = 0.0; + for ( i = 0; i < N; i++ ) { + tr += ( viewX[ ix ] * viewY[ iy ] ) - + ( viewX[ ix + 1 ] * viewY[ iy + 1 ] ); + ti += ( viewX[ ix ] * viewY[ iy + 1 ] ) + + ( viewX[ ix + 1 ] * viewY[ iy ] ); + ix += sx; + iy += sy; + } + return new Complex64( tr, ti ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.native.js similarity index 58% rename from lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js rename to lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.native.js index 7acdd6b00d89..5c0daae0f2f5 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/base/cdotu/lib/ndarray.native.js @@ -20,8 +20,9 @@ // MODULES // -var muladd = require( '@stdlib/complex/float32/base/mul-add' ).strided; var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var addon = require( './../src/addon.node' ); // MAIN // @@ -29,16 +30,14 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); /** * Calculates the dot product of two single-precision complex floating-point vectors. * -* @param {integer} N - number of indexed elements +* @param {PositiveInteger} N - number of indexed elements * @param {Complex64Array} x - first input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting index for `x` * @param {Complex64Array} y - second input array * @param {integer} strideY - `y` stride length * @param {NonNegativeInteger} offsetY - starting index for `y` -* @param {Complex64Array} out - output array -* @param {NonNegativeInteger} offsetOut - starting index for `out` -* @returns {Complex64Array} dot product array +* @returns {Complex64} dot product * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); @@ -46,42 +45,18 @@ var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); * var x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 7.0 ] ); * var y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 9.0 ] ); * -* var z = cdotu( 3, x, 1, 0, y, 1, 0, new Complex64Array( 1 ), 0 ); -* // returns [ -52.0, 82.0 ] +* var z = cdotu( 3, x, 1, 0, y, 1, 0 ); +* // returns [ -52.0, 82.0 ] */ -function cdotu( N, x, strideX, offsetX, y, strideY, offsetY, out, offsetOut ) { - var viewOut; - var viewX; - var viewY; - var ix; - var iy; - var io; - var sx; - var sy; - var i; +function cdotu( N, x, strideX, offsetX, y, strideY, offsetY ) { + var obj; + var vX; + var vY; - if ( N <= 0 ) { - return out; - } - viewX = reinterpret( x, 0 ); - viewY = reinterpret( y, 0 ); - viewOut = reinterpret( out, 0 ); - - ix = offsetX * 2; - iy = offsetY * 2; - io = offsetOut * 2; - sx = strideX * 2; - sy = strideY * 2; - - viewOut[ io ] = 0.0; - viewOut[ io + 1 ] = 0.0; - - for ( i = 0; i < N; i++ ) { - muladd( viewX, 1, ix, viewY, 1, iy, viewOut, 1, io, viewOut, 1, io ); // eslint-disable-line max-len - ix += sx; - iy += sy; - } - return out; + vX = reinterpret( x, 0 ); + vY = reinterpret( y, 0 ); + obj = addon.ndarray( N, vX, strideX, offsetX, vY, strideY, offsetY ); + return new Complex64( obj.re, obj.im ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/manifest.json b/lib/node_modules/@stdlib/blas/base/cdotu/manifest.json new file mode 100644 index 000000000000..011fe98e8f2f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/manifest.json @@ -0,0 +1,458 @@ +{ + "options": { + "task": "build", + "os": "linux", + "blas": "", + "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", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.f", + "./src/cdotusub.f", + "./src/cdotu_f.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/napi/create-complex-like", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset" + ] + }, + + { + "task": "build", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/napi/create-complex-like", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.f", + "./src/cdotusub.f", + "./src/cdotu_f.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/napi/create-complex-like", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/napi/create-complex-like", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/napi/create-complex-like", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotu_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + + { + "task": "build", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/blas/base/shared", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-strided-complex64array", + "@stdlib/napi/create-complex-like", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" + ] + }, + { + "task": "benchmark", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "", + "blas": "", + "wasm": true, + "src": [ + "./src/cdotu.c", + "./src/cdotu_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/package.json b/lib/node_modules/@stdlib/blas/base/cdotu/package.json index 4a2e6b254cfe..799063cd0b66 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/package.json +++ b/lib/node_modules/@stdlib/blas/base/cdotu/package.json @@ -18,7 +18,9 @@ "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", + "include": "./include", "lib": "./lib", + "src": "./src", "test": "./test" }, "types": "./docs/types", diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/Makefile b/lib/node_modules/@stdlib/blas/base/cdotu/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/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/base/cdotu/src/addon.c b/lib/node_modules/@stdlib/blas/base/cdotu/src/addon.c new file mode 100644 index 000000000000..78550800431c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/addon.c @@ -0,0 +1,81 @@ +/** +* @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/base/cdotu.h" +#include "stdlib/napi/export.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_strided_complex64array.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include "stdlib/napi/create_complex_like.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_complex64_t v; + + 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_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, Y, N, strideY, argv, 3 ); + + API_SUFFIX(c_cdotu)( N, (void *)X, strideX, (void *)Y, strideY, (void *)&v ); + + STDLIB_NAPI_CREATE_COMPLEX_LIKE( env, stdlib_complex64_real( v ), stdlib_complex64_imag( v ), out ); + + return out; +} + +/** +* 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_complex64_t v; + + 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_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, Y, N, strideY, argv, 4 ); + + API_SUFFIX(c_cdotu_ndarray)( N, (void *)X, strideX, offsetX, (void *)Y, strideY, offsetY, (void *)&v ); + + STDLIB_NAPI_CREATE_COMPLEX_LIKE( env, stdlib_complex64_real( v ), stdlib_complex64_imag( v ), out ); + + return out; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.c b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.c new file mode 100644 index 000000000000..498b2e5c7d20 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.c @@ -0,0 +1,37 @@ +/** +* @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/base/cdotu.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" + +/** +* Calculates the dot product of two single-precision complex floating-point vectors. +* +* @param N number of indexed elements +* @param X first input array +* @param strideX X stride length +* @param Y second input array +* @param strideY Y stride length +* @param dot output variable reference +*/ +void API_SUFFIX(c_cdotu)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY, void *dot ) { + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY ); + API_SUFFIX(c_cdotu_ndarray)( N, X, strideX, ox, Y, strideY, oy, dot ); +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.f b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.f new file mode 100644 index 000000000000..20908c757d11 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu.f @@ -0,0 +1,101 @@ +!> +! @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. +!< + +!> Calculates the dot product of two single-precision complex floating-point vectors. +! +! ## Notes +! +! * Modified version of reference BLAS level1 routine (version 3.7.0). Updated to "free form" Fortran 95. +! +! ## Authors +! +! * Univ. of Tennessee +! * Univ. of California Berkeley +! * Univ. of Colorado Denver +! * NAG Ltd. +! +! ## History +! +! * Jack Dongarra, linpack, 3/11/78. +! +! - modified 12/3/93, array(1) declarations changed to array(*) +! +! ## License +! +! From : +! +! > The reference BLAS is a freely-available software package. It is available from netlib via anonymous ftp and the World Wide Web. Thus, it can be included in commercial software packages (and has been). We only ask that proper credit be given to the authors. +! > +! > Like all software, it is copyrighted. It is not trademarked, but we do ask the following: +! > +! > * If you modify the source for these routines we ask that you change the name of the routine and comment the changes made to the original. +! > +! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support. +! +! @param {integer} N - number of indexed elements +! @param {Array} cx - first input array +! @param {integer} incx - `cx` stride length +! @param {Array} cy - second input array +! @param {integer} incy - `cy` stride length +! @returns {complex} dot product +!< +complex function cdotu( N, cx, incx, cy, incy ) + implicit none + ! .. + ! Scalar arguments: + integer :: incx, incy, N + ! .. + ! Array arguments: + complex :: cx(*), cy(*) + ! .. + ! Local scalars: + complex :: ctemp + integer :: i, ix, iy + ! .. + ctemp = (0.0,0.0) + cdotu = (0.0,0.0) + if ( N <= 0 ) then + return + end if + ! .. + if ( incx == 1 .AND. incy == 1 ) then + ! .. + ! Code for both increments equal to 1... + do i = 1, N + ctemp = ctemp + cx( i ) * cy( i ) + end do + else + ! .. + ! Code for unequal increments or equal increments not equal to 1... + ix = 1 + iy = 1 + if ( incx < 0 ) then + ix = ( -N + 1 ) * incx + 1 + end if + if ( incy < 0 ) then + iy = ( -N + 1 ) * incy + 1 + end if + do i = 1, N + ctemp = ctemp + cx( ix ) * cy( iy ) + ix = ix + incx + iy = iy + incy + end do + end if + cdotu = ctemp + return +end function cdotu \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_cblas.c b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_cblas.c new file mode 100644 index 000000000000..4ea97ccfc1b6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_cblas.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/base/cdotu.h" +#include "stdlib/blas/base/cdotu_cblas.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/min_view_buffer_index.h" + +/** +* Calculates the dot product of two single-precision complex floating-point vectors. +* +* @param N number of indexed elements +* @param X first input array +* @param strideX X stride length +* @param Y second input array +* @param strideY Y stride length +* @param dot output variable reference +*/ +void API_SUFFIX(c_cdotu)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY, void *dot ) { + API_SUFFIX(cblas_cdotu_sub)( N, X, strideX, Y, strideY, dot ); +} + +/** +* Calculates the dot product of two single-precision complex floating-point vectors using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X first input array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y second input array +* @param strideY Y stride length +* @param offsetY starting index for Y +* @param dot output variable reference +*/ +void API_SUFFIX(c_cdotu_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, void *dot ) { + X += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer + Y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); // adjust array pointer + API_SUFFIX(cblas_cdotu_sub)( N, X, strideX, Y, strideY, dot ); +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_f.c b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_f.c new file mode 100644 index 000000000000..87779c3fb4c6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_f.c @@ -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. +*/ + +#include "stdlib/blas/base/cdotu.h" +#include "stdlib/blas/base/cdotu_fortran.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/min_view_buffer_index.h" + +/** +* Calculates the dot product of two single-precision complex floating-point vectors. +* +* @param N number of indexed elements +* @param X first input array +* @param strideX X stride length +* @param Y second input array +* @param strideY Y stride length +* @param dot output variable reference +*/ +void API_SUFFIX(c_cdotu)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY, void *dot ) { + CBLAS_INT fN = N; + CBLAS_INT fstrideX = strideX; + CBLAS_INT fstrideY = strideY; + cdotusub( &fN, X, &fstrideX, Y, &fstrideY, dot ); +} + +/** +* Calculates the dot product of two single-precision complex floating-point vectors using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X first input array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y second input array +* @param strideY Y stride length +* @param offsetY starting index for Y +* @param dot output variable reference +*/ +void API_SUFFIX(c_cdotu_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, void *dot ) { + const float *x = (const float *)X; + const float *y = (const float *)Y; + CBLAS_INT fN = N; + CBLAS_INT fstrideX = strideX; + CBLAS_INT fstrideY = strideY; + + x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ) * 2; + y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ) * 2; + cdotusub( &fN, (const void *)x, &fstrideX, (const void *)y, &fstrideY, dot ); +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_ndarray.c b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_ndarray.c new file mode 100644 index 000000000000..50e0f4cf4169 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotu_ndarray.c @@ -0,0 +1,66 @@ +/** +* @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/base/cdotu.h" +#include "stdlib/blas/base/shared.h" + +/** +* Calculates the dot product of two single-precision complex floating-point vectors using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X first input array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y second input array +* @param strideY Y stride length +* @param offsetY starting index for Y +* @param dot output variable reference +*/ +void API_SUFFIX(c_cdotu_ndarray)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, void *dot ) { + const float *x = (const float *)X; + const float *y = (const float *)Y; + float *out = (float *)dot; + CBLAS_INT sx; + CBLAS_INT sy; + CBLAS_INT ix; + CBLAS_INT iy; + CBLAS_INT i; + float dr; + float di; + + out[ 0 ] = 0.0f; + out[ 1 ] = 0.0f; + if ( N <= 0 ) { + return; + } + sx = strideX * 2; + sy = strideY * 2; + ix = offsetX * 2; + iy = offsetY * 2; + + dr = 0.0f; + di = 0.0f; + for ( i = 0; i < N; i++ ) { + dr += ( x[ ix ] * y[ iy ] ) - ( x[ ix+1 ] * y[ iy+1 ] ); + di += ( x[ ix ] * y[ iy+1 ] ) + ( x[ ix+1 ] * y[ iy ] ); + ix += sx; + iy += sy; + } + out[ 0 ] = dr; + out[ 1 ] = di; +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotusub.f b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotusub.f new file mode 100644 index 000000000000..1a2e43ea0891 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/src/cdotusub.f @@ -0,0 +1,49 @@ +!> +! @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. +!< + +!> Wraps `cdotu` as a subroutine. +! +! @param {integer} N - number of indexed elements +! @param {Array} cx - first input array +! @param {integer} incx - `cx` stride length +! @param {Array} cy - second input array +! @param {integer} incy - `cy` stride length +! @param {complex} dot - output variable reference +!< +subroutine cdotusub( N, cx, incx, cy, incy, dot ) + implicit none + ! .. + ! External functions: + interface + complex function cdotu( N, cx, incx, cy, incy ) + complex :: cx(*), cy(*) + integer :: incx, incy, N + end function cdotu + end interface + ! .. + ! Scalar arguments: + integer :: incx, incy, N + complex :: dot + ! .. + ! Array arguments: + complex :: cx(*), cy(*) + ! .. + ! Find the dot product: + dot = cdotu( N, cx, incx, cy, incy ) + return +end subroutine cdotusub \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.native.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.native.js new file mode 100644 index 000000000000..361cc6f16403 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.cdotu.native.js @@ -0,0 +1,226 @@ +/** +* @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 tape = require( 'tape' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isSameComplex64 = require( '@stdlib/assert/is-same-complex64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var cdotu = tryRequire( resolve( __dirname, './../lib/cdotu.js' ) ); +var opts = { + 'skip': ( cdotu instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cdotu, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', opts, function test( t ) { + t.strictEqual( cdotu.length, 5, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `x` and `y`', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); + y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); + + dot = cdotu( 4, x, 1, y, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 3.0, 70.0 ) ), true, 'returns expected value' ); + + x = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); + + dot = cdotu( 2, x, 1, y, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -18, 4 ) ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); + + dot = cdotu( 0, x, 1, y, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + + dot = cdotu( -4, x, 1, y, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, + 6.0, + 7.0, // 1 + 6.0 // 1 + ]); + y = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, // 1 + 3.0, // 1 + -4.0, + 1.0 + ]); + + dot = cdotu( 2, x, 2, y, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -17, -17 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, // 1 + 7.0, // 1 + 6.0, + -2.0 + ]); + y = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, + 3.0, + -4.0, // 1 + 1.0 // 1 + ]); + + dot = cdotu( 2, x, 1, y, 2 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 35, -53 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 1 + 2.0, // 1 + 3.0, + 4.0, + 5.0, // 0 + 6.0 // 0 + ]); + y = new Complex64Array([ + 7.0, // 1 + 8.0, // 1 + 9.0, // 0 + 10.0, // 0 + 11.0, + 12.0 + ]); + + dot = cdotu( 2, x, -2, y, -1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -24, 126 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + y = new Complex64Array([ + 7.0, // 1 + 8.0, // 1 + 9.0, // 0 + 10.0, // 0 + 11.0, + 12.0 + ]); + + dot = cdotu( 2, x, 2, y, -1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -24, 110 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', opts, function test( t ) { + var dot; + var x0; + var y0; + var x1; + var y1; + + x0 = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + y0 = new Complex64Array([ + 7.0, + 8.0, + 9.0, // 0 + 10.0, // 0 + 11.0, // 1 + 12.0 // 1 + ]); + + x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*0 ); + y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); + + dot = cdotu( 2, x1, 2, y1, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.native.js new file mode 100644 index 000000000000..23af353b827f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotu/test/test.ndarray.native.js @@ -0,0 +1,248 @@ +/** +* @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 tape = require( 'tape' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isSameComplex64 = require( '@stdlib/assert/is-same-complex64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var cdotu = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( cdotu instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof cdotu, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', opts, function test( t ) { + t.strictEqual( cdotu.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of two single-precision complex floating-point vectors `x` and `y`', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array( [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ] ); + y = new Complex64Array( [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ] ); + + dot = cdotu( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual(isSameComplex64( dot, new Complex64( 3.0, 70.0 ) ), true, 'returns expected value' ); + + x = new Complex64Array( [ 3.0, -4.0, 1.0, 2.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, 8.0 ] ); + + dot = cdotu( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -18, 4 ) ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array( [ 3.0, -4.0, 1.0, 7.0 ] ); + y = new Complex64Array( [ 1.0, -2.0, 3.0, -3.0 ] ); + + dot = cdotu( 0, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + + dot = cdotu( -4, x, 1, 0, y, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 0, 0 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, + 6.0, + 7.0, // 1 + 6.0 // 1 + ]); + y = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, // 1 + 3.0, // 1 + -4.0, + 1.0 + ]); + + dot = cdotu( 2, x, 2, 0, y, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -17, -17 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` offset', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 2.0, + -3.0, + -5.0, // 0 + 6.0, // 0 + 7.0, // 1 + 6.0 // 1 + ]); + y = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, // 1 + 3.0, // 1 + -4.0, + 1.0 + ]); + + dot = cdotu( 2, x, 1, 1, y, 1, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -91, 41 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 2.0, // 0 + -3.0, // 0 + -5.0, // 1 + 6.0, // 1 + 7.0, + 6.0 + ]); + y = new Complex64Array([ + 8.0, // 0 + 2.0, // 0 + -3.0, + 3.0, + -4.0, // 1 + 1.0 // 1 + ]); + + dot = cdotu( 2, x, 1, 0, y, 2, 0 ); + t.strictEqual( isSameComplex64( dot, new Complex64( 36, -49 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` offset', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + y = new Complex64Array([ + 7.0, + 8.0, + 9.0, // 0 + 10.0, // 0 + 11.0, // 1 + 12.0 // 1 + ]); + + dot = cdotu( 2, x, 2, 0, y, 1, 1 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 1 + 2.0, // 1 + 3.0, + 4.0, + 5.0, // 0 + 6.0 // 0 + ]); + y = new Complex64Array([ + 7.0, + 8.0, + 9.0, // 1 + 10.0, // 1 + 11.0, // 0 + 12.0 // 0 + ]); + + dot = cdotu( 2, x, -2, x.length-1, y, -1, 2 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -28, 154 ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', opts, function test( t ) { + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, + 4.0, + 5.0, // 1 + 6.0 // 1 + ]); + y = new Complex64Array([ + 7.0, // 1 + 8.0, // 1 + 9.0, // 0 + 10.0, // 0 + 11.0, + 12.0 + ]); + + dot = cdotu( 2, x, 2, 0, y, -1, y.length-2 ); + t.strictEqual( isSameComplex64( dot, new Complex64( -24, 110 ) ), true, 'returns expected value' ); + t.end(); +}); From 725be68493c94913d9b8eefd7a6c3bbb8c1e23c5 Mon Sep 17 00:00:00 2001 From: DhruvArvindSingh Date: Mon, 16 Mar 2026 23:48:19 +0530 Subject: [PATCH 17/19] fix: readme.md --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: 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/base/cdotu/README.md | 144 +++++++++++++++++ .../blas/base/cdotu/examples/c/Makefile | 146 ++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotu/examples/c/Makefile diff --git a/lib/node_modules/@stdlib/blas/base/cdotu/README.md b/lib/node_modules/@stdlib/blas/base/cdotu/README.md index 5fd23e1f4bc6..6e1aca94fef6 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotu/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotu/README.md @@ -187,6 +187,150 @@ console.log( out.toString() ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/cdotu.h" +``` + +#### c_cdotu( N, \*X, strideX, \*Y, strideY, \*dot ) + +Calculates the dot product of two single-precision complex floating-point vectors. + +```c +#include "stdlib/complex/float32/ctor.h" + +const float x[] = { 4.0f, 2.0f, -3.0f, 5.0f, -1.0f, 7.0f }; +const float y[] = { 2.0f, 6.0f, -1.0f, -4.0f, 8.0f, 9.0f }; + +stdlib_complex64_t dot; +c_cdotu( 3, (void *)x, 1, (void *)y, 1, (void *)&dot ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] void*` first input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **Y**: `[in] void*` second input array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. +- **dot**: `[out] void*` output variable. + +```c +void c_cdotu( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY, void *dot ); +``` + +#### c_cdotu_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY, \*dot ) + +Calculates the dot product of two single-precision complex floating-point vectors using alternative indexing semantics. + +```c +#include "stdlib/complex/float32/ctor.h" + +const float x[] = { 4.0f, 2.0f, -3.0f, 5.0f, -1.0f, 7.0f }; +const float y[] = { 2.0f, 6.0f, -1.0f, -4.0f, 8.0f, 9.0f }; + +stdlib_complex64_t dot; +c_cdotu_ndarray( 3, (void *)x, 1, 0, (void *)y, 1, 0, (void *)&dot ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] void*` first input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **Y**: `[in] void*` second input array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. +- **offsetY**: `[in] CBLAS_INT` starting index for `Y`. +- **dot**: `[out] void*` output variable. + +```c +void c_cdotu_ndarray( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, void *dot ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/cdotu.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include "stdlib/complex/float32/ctor.h" +#include + +int main( void ) { + // Create strided arrays: + const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; + const float y[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; + + // Specify the number of elements: + const int N = 4; + + // Specify strides: + const int strideX = 1; + const int strideY = 1; + + // Create a complex number to store the result: + stdlib_complex64_t z; + + // Compute the dot product: + c_cdotu( N, (const void *)x, strideX, (const void *)y, strideY, (void *)&z ); + + // Print the result: + printf( "dot: %f + %fi\n", stdlib_complex64_real( z ), stdlib_complex64_imag( z ) ); + + // Compute the dot product: + c_cdotu_ndarray( N, (const void *)x, strideX, 0, (const void *)y, strideY, 0, (void *)&z ); + + // Print the result: + printf( "dot: %f + %fi\n", stdlib_complex64_real( z ), stdlib_complex64_imag( z ) ); +} +``` + +
+ + + +
+ + +