From aacd5663a0282b258e78d60155147c3c4e068e88 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 14 Jan 2025 10:34:34 +0000 Subject: [PATCH 01/17] feat: add javascript implementation of blas/base/cdotc --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: 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 --- --- 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/cdotc/README.md | 232 ++++++++++++++++ .../blas/base/cdotc/benchmark/benchmark.js | 110 ++++++++ .../base/cdotc/benchmark/benchmark.ndarray.js | 110 ++++++++ .../@stdlib/blas/base/cdotc/docs/repl.txt | 122 +++++++++ .../blas/base/cdotc/docs/types/index.d.ts | 107 ++++++++ .../blas/base/cdotc/docs/types/test.ts | 249 ++++++++++++++++++ .../@stdlib/blas/base/cdotc/examples/index.js | 38 +++ .../@stdlib/blas/base/cdotc/lib/cdotc.js | 72 +++++ .../@stdlib/blas/base/cdotc/lib/index.js | 87 ++++++ .../@stdlib/blas/base/cdotc/lib/main.js | 35 +++ .../@stdlib/blas/base/cdotc/lib/ndarray.js | 86 ++++++ .../@stdlib/blas/base/cdotc/package.json | 83 ++++++ .../blas/base/cdotc/test/test.cdotc.js | 215 +++++++++++++++ .../@stdlib/blas/base/cdotc/test/test.js | 82 ++++++ .../blas/base/cdotc/test/test.ndarray.js | 215 +++++++++++++++ 15 files changed, 1843 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md new file mode 100644 index 000000000000..ae7ee0a69880 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -0,0 +1,232 @@ + + +# cdotc + +> Calculate the dot product of two single-precision complex vectors. + +
+ +The [dot product][dot-product] (or scalar product) is defined as + +
+ + + +
+ +## Usage + +```javascript +var cdotc = require( '@stdlib/blas/base/cdotc' ); +``` + +#### cdotc( N, x, strideX, y, strideY ) + +Calculates the dot product of complex vectors `x` and `y`. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); + +var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); + +var out = cdotc( x.length, x, 1, y, 1 ); +// returns + +var re = realf( out ); +// returns 54 + +var im = imagf( out ); +// returns -80 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **x**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideX**: index increment for `x`. +- **y**: input [`Complex64Array`][@stdlib/array/complex64]. +- **strideY**: index increment for `y`. + +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 value in `x` and the first `N` elements of `y` in reverse order, + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); + +var x = new Complex64Array( [ -1.0, -9.0, 2.0, -8.0 ] ); +var y = new Complex64Array( [ -5.0, 1.0, -6.0, 7.0 ] ); + +var out = cdotc( x.length, x, 1, y, -1 ); +// returns + +var re = realf( out ); +// returns -75 + +var im = imagf( out ); +// returns -99 +``` + +#### cdotc.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + +Calculates the dot product of `x` and `y` using alternative indexing semantics. + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); + +var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); + +var out = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); +// returns + +var re = realf( out ); +// returns 54 + +var im = imagf( out ); +// returns -80 +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. +- **offsetY**: starting index for `y`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the dot product of every other value in `x` starting from the second value with the last 2 elements in `y` in reverse order + +```javascript +var Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); + +var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); + +var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); +// returns + +var re = realf( out ); +// returns -55 + +var im = imagf( out ); +// returns 23 +``` + +
+ + + +
+ +## Notes + +- If `N <= 0`, both functions return complex64 with real and imagnary as `0.0`. +- `cdotc()` corresponds to the [BLAS][blas] level 1 function [`cdotc`][cdotc]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) ); +} + +var cx = filledarrayBy( 10, 'complex64', rand ); +console.log( cx.toString() ); + +var cy = filledarrayBy( 10, 'complex64', rand ); +console.log( cy.toString() ); + +// Perform dot product of cx and cy +var out = cdotc.ndarray( cx.length, cx, 1, 0, cy, -1, cy.length-1 ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js new file mode 100644 index 000000000000..ee925781620f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js @@ -0,0 +1,110 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var pkg = require( './../package.json' ).name; +var cdotc = require( './../lib/cdotc.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 cx; + var cy; + + cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = cdotc( cx.length, cx, 1, cy, 1 ); + if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..9a61f62f32a7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js @@ -0,0 +1,110 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var pkg = require( './../package.json' ).name; +var cdotc = 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 cx; + var cy; + + cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = cdotc( cx.length, cx, 1, 0, cy, 1, 0 ); + if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt new file mode 100644 index 000000000000..977e2e46af90 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt @@ -0,0 +1,122 @@ + +{{alias}}( N, x, strideX, y, strideY ) + Computes the dot product of two single-precision complex 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`. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Complex64Array + First input array. + + strideX: integer + Index increment for `x`. + + y: Complex64Array + Second input array. + + strideY: integer + Index increment for `y`. + + Returns + ------- + out: Complex64 + The dot product. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); + > var out = {{alias}}( x.length, x, 1, y, 1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( out ) + 54 + > var im = {{alias:@stdlib/complex/float32/imag}}( out ) + -80 + + // Strides: + > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); + > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); + > out = {{alias}}( 2, x, 2, y, 1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( out ) + 54 + > var im = {{alias:@stdlib/complex/float32/imag}}( out ) + -80 + + +{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + Computes the dot product of two single-precision complex 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. + + x: Complex64Array + First input array. + + strideX: integer + Index increment for `x`. + + offsetX: integer + Starting index for `x`. + + y: Complex64Array + Second input array. + + strideY: integer + Index increment for `y`. + + offsetY: integer + Starting index for `y`. + + Returns + ------- + out: Complex64 + The dot product. + + Examples + -------- + // Standard usage: + > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); + > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); + > var out = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ); + > var re = {{alias:@stdlib/complex/float32/real}}( out ) + 54 + > var im = {{alias:@stdlib/complex/float32/imag}}( out ) + -80 + + // Strides: + > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); + > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); + > out = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 ); + > var re = {{alias:@stdlib/complex/float32/real}}( out ) + 54 + > var im = {{alias:@stdlib/complex/float32/imag}}( out ) + -80 + + // Using offset indices: + > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); + > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); + > out = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ); + > var re = {{alias:@stdlib/complex/float32/real}}( out ) + 61 + > var im = {{alias:@stdlib/complex/float32/imag}}( out ) + -72 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts new file mode 100644 index 000000000000..949080bec76a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts @@ -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. +*/ + +import { Complex64 } from '@stdlib/types/complex'; +import { Complex64Array } from '@stdlib/types/array'; + + +// TypeScript Version: 4.1 + +/** +* Interface describing `cdotc`. +*/ +interface Routine { + /** + * Computes the dot product of two single-precision complex vectors. + * + * @param N - number of indexed elements + * @param x - first input complex array + * @param strideX - `x` stride length + * @param y - second input complex array + * @param strideY - `y` stride length + * @returns dot product + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var x = new Complex64Array( [ 7, -8, -1, -9 ] ); + * var y = new Complex64Array( [ 6, -6, -9, 5 ] ); + * + * var z = cdotc( x.length, x, 1, y, 1 ); + * // returns + */ + ( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64; + + /** + * Computes the dot product of `x` and `y` 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` + * @returns dot product + * + * @example + * var Complex64Array = require( '@stdlib/array/complex64' ); + * + * var x = new Complex64Array( [ 7, -8, -1, -9 ] ); + * var y = new Complex64Array( [ 6, -6, -9, 5 ] ); + * + * var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); + * // returns + */ + ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64; +} + +/** +* Computes the dot product of `x` and `y`. +* +* @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 +* @returns dot product +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 7, -8, -1, -9 ] ); +* var y = new Complex64Array( [ 6, -6, -9, 5 ] ); +* +* var z = cdotc( x.length, x, 1, y, 1 ); +* // returns +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* +* var x = new Complex64Array( [ 7, -8, -1, -9 ] ); +* var y = new Complex64Array( [ 6, -6, -9, 5 ] ); +* +* var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns +*/ +declare var cdotc: Routine; + + +// EXPORTS // + +export = cdotc; diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts new file mode 100644 index 000000000000..15d22a09fb7d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts @@ -0,0 +1,249 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2020 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex64Array = require( '@stdlib/array/complex64' ); +import cdotc = require( './index' ); + + +// TESTS // + +// The function returns a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc( 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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc( '10', x, 1, y, 1 ); // $ExpectError + cdotc( true, x, 1, y, 1 ); // $ExpectError + cdotc( false, x, 1, y, 1 ); // $ExpectError + cdotc( null, x, 1, y, 1 ); // $ExpectError + cdotc( undefined, x, 1, y, 1 ); // $ExpectError + cdotc( [], x, 1, y, 1 ); // $ExpectError + cdotc( {}, x, 1, y, 1 ); // $ExpectError + cdotc( ( 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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc( x.length, 10, 1, y, 1 ); // $ExpectError + cdotc( x.length, '10', 1, y, 1 ); // $ExpectError + cdotc( x.length, true, 1, y, 1 ); // $ExpectError + cdotc( x.length, false, 1, y, 1 ); // $ExpectError + cdotc( x.length, null, 1, y, 1 ); // $ExpectError + cdotc( x.length, undefined, 1, y, 1 ); // $ExpectError + cdotc( x.length, [], 1, y, 1 ); // $ExpectError + cdotc( x.length, {}, 1, y, 1 ); // $ExpectError + cdotc( 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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc( x.length, x, '10', y, 1 ); // $ExpectError + cdotc( x.length, x, true, y, 1 ); // $ExpectError + cdotc( x.length, x, false, y, 1 ); // $ExpectError + cdotc( x.length, x, null, y, 1 ); // $ExpectError + cdotc( x.length, x, undefined, y, 1 ); // $ExpectError + cdotc( x.length, x, [], y, 1 ); // $ExpectError + cdotc( x.length, x, {}, y, 1 ); // $ExpectError + cdotc( 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 x = new Complex64Array( 10 ); + + cdotc( x.length, x, 1, 10, 1 ); // $ExpectError + cdotc( x.length, x, 1, '10', 1 ); // $ExpectError + cdotc( x.length, x, 1, true, 1 ); // $ExpectError + cdotc( x.length, x, 1, false, 1 ); // $ExpectError + cdotc( x.length, x, 1, null, 1 ); // $ExpectError + cdotc( x.length, x, 1, undefined, 1 ); // $ExpectError + cdotc( x.length, x, 1, [], 1 ); // $ExpectError + cdotc( x.length, x, 1, {}, 1 ); // $ExpectError + cdotc( 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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc( x.length, x, 1, y, '10' ); // $ExpectError + cdotc( x.length, x, 1, y, true ); // $ExpectError + cdotc( x.length, x, 1, y, false ); // $ExpectError + cdotc( x.length, x, 1, y, null ); // $ExpectError + cdotc( x.length, x, 1, y, undefined ); // $ExpectError + cdotc( x.length, x, 1, y, [] ); // $ExpectError + cdotc( x.length, x, 1, y, {} ); // $ExpectError + cdotc( x.length, x, 1, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc(); // $ExpectError + cdotc( x.length ); // $ExpectError + cdotc( x.length, x ); // $ExpectError + cdotc( x.length, x, 1 ); // $ExpectError + cdotc( x.length, x, 1, y ); // $ExpectError + cdotc( x.length, x, 1, y, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Complex64... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray( '10', x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( true, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( false, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( null, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( undefined, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( [], x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( {}, x, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray( x.length, 10, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, '10', 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, true, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, false, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, null, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, undefined, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, [], 1, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, {}, 1, 0, y, 1, 0 ); // $ExpectError + cdotc.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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray( x.length, x, '10', 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, true, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, false, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, null, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, undefined, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, [], 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, {}, 0, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, ( x: number ): number => x, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray( x.length, x, 1, '10', y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, true, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, false, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, null, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, undefined, y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, [], y, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, {}, y, 1, 0 ); // $ExpectError + cdotc.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 x = new Complex64Array( 10 ); + + cdotc.ndarray( x.length, x, 1, 0, 10, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, '10', 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, true, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, false, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, null, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, undefined, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, [], 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, {}, 1, 0 ); // $ExpectError + cdotc.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 x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray( x.length, x, 1, 0, y, '10', 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, true, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, false, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, null, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, undefined, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, [], 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, {}, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray( x.length, x, 1, 0, y, 1, '10' ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, true ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, false ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, null ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, undefined ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, [] ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, {} ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const x = new Complex64Array( 10 ); + const y = new Complex64Array( 10 ); + + cdotc.ndarray(); // $ExpectError + cdotc.ndarray( x.length ); // $ExpectError + cdotc.ndarray( x.length, x ); // $ExpectError + cdotc.ndarray( x.length, x, 1 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1 ); // $ExpectError + cdotc.ndarray( x.length, x, 1, 0, y, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js new file mode 100644 index 000000000000..b49249750b74 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 filledarrayBy = require( '@stdlib/array/filled-by' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var cdotc = require( './../lib' ); + +function rand() { + return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) ); +} + +var cx = filledarrayBy( 10, 'complex64', rand ); +console.log( cx.toString() ); + +var cy = filledarrayBy( 10, 'complex64', rand ); +console.log( cy.toString() ); + +// Perform dot product of cx and cy +var out = cdotc.ndarray( cx.length, cx, 1, 0, cy, -1, cy.length-1 ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js new file mode 100644 index 000000000000..90610ee5852b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js @@ -0,0 +1,72 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 Complex64 = require( '@stdlib/complex/float32/ctor' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Computes the dot product of `x` and `y`. +* +* @param {PositiveInteger} N - number of indexed elements +* @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 Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +* var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); +* +* var out = cdotc( x.length, x, 1, y, 1 ); +* // returns +* +* var re = realf( out ); +* // returns 54 +* +* var im = imagf( out ); +* // returns -80 +*/ +function cdotc( N, x, strideX, y, strideY ) { + var ix; + var iy; + if ( N <= 0 ) { + return new Complex64( 0, 0 ); + } + ix = stride2offset( N, strideX ); + iy = stride2offset( N, strideY ); + return ndarray( N, x, strideX, ix, y, strideY, iy ); +} + + +// EXPORTS // + +module.exports = cdotc; diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js new file mode 100644 index 000000000000..b9b3df1b7019 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js @@ -0,0 +1,87 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2019 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 vectors. +* +* @module @stdlib/blas/base/cdotc +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* var cdotc = require( '@stdlib/blas/base/cdotc' ); +* +* var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +* var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); +* var out = cdotc( x.length, x, 1, y, 1 ); +* // returns +* +* var re = realf( out ); +* // returns 54 +* +* var im = imagf( out ); +* // returns -80 +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* var cdotc = require( '@stdlib/blas/base/cdotc' ); +* +* var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +* var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); +* +* var out = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns +* +* var re = realf( out ); +* // returns 54 +* +* var im = imagf( out ); +* // returns -80 +*/ + +// 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 cdotc; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + cdotc = main; +} else { + cdotc = tmp; +} + + +// EXPORTS // + +module.exports = cdotc; + +// exports: { "ndarray": "sdot.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js new file mode 100644 index 000000000000..d14c235cb5f3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2019 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 cdotc = require( './cdotc.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( cdotc, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = cdotc; diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js new file mode 100644 index 000000000000..f61569bdb65d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2023 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 cmul = require( '@stdlib/complex/float32/base/mul' ); +var cadd = require( '@stdlib/complex/float32/base/add' ); +var conj = require( '@stdlib/complex/float32/conj' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); + + +// MAIN // + +/** +* Computes the dot product of `x` and `y`. +* +* @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` +* @returns {Complex64} dot product +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var realf = require( '@stdlib/complex/float32/real' ); +* var imagf = require( '@stdlib/complex/float32/imag' ); +* +* var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +* var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); +* +* var out = cdotc( x.length, x, 1, 0, y, 1, 0 ); +* // returns +* +* var re = realf( out ); +* // returns 54 +* +* var im = imagf( out ); +* // returns -80 +*/ +function cdotc( N, x, strideX, offsetX, y, strideY, offsetY ) { + var conjX; + var dot; + var ix; + var iy; + var i; + + dot = new Complex64( 0, 0 ); + if ( N <= 0 ) { + return dot; + } + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + conjX = conj( x.get( ix ) ); + dot = cadd( dot, cmul( conjX, y.get( iy ) ) ); + ix += strideX; + iy += strideY; + } + return dot; +} + + +// EXPORTS // + +module.exports = cdotc; diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/package.json b/lib/node_modules/@stdlib/blas/base/cdotc/package.json new file mode 100644 index 000000000000..782b3cfc6a21 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/package.json @@ -0,0 +1,83 @@ +{ + "name": "@stdlib/blas/base/cdotc", + "version": "0.0.0", + "description": "Calculate the dot product of two single-precision complex 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", + "browser": "./lib/main.js", + "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", + "cdotc", + "dot", + "product", + "dot product", + "scalar", + "scalar product", + "inner", + "inner product", + "linear", + "algebra", + "subroutines", + "vector", + "array", + "ndarray", + "complex", + "complex64", + "float32", + "float", + "single", + "float32array" + ], + "__stdlib__": { + "wasm": false + } +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js new file mode 100644 index 000000000000..a05367bcd719 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js @@ -0,0 +1,215 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2019 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 Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var cdotc = require( './../lib/cdotc.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.deepEqual( typeof cdotc, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', function test( t ) { + t.deepEqual( cdotc.length, 5, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of vectors `x` and `y`', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array( [ + 0.7, // 0 + -0.8, // 0 + -0.4, // 1 + -0.7 // 1 + ] ); + y = new Complex64Array( [ + 0.6, // 0 + -0.6, // 0 + -0.9, // 1 + 0.5 // 1 + ] ); + expected = new Complex64( 0.91, -0.77 ); + + dot = cdotc( x.length, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns Complex( 0.0, 0.0 )', function test( t ) { + var expected; + var dot; + var x; + var y; + + expected = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [-0.1, -0.9, 0.2, -0.8 ] ); + y = new Complex64Array( [ 0.7, -0.6, 0.1, -0.5 ] ); + + dot = cdotc( 0, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + dot = cdotc( -4, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, 2, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, // 0 + 5, // 0 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( -55, 23 ); + + dot = cdotc( 2, x, 2, y, -1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `y` stride', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, + 5, + 7, // 1 + -6, // 1 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, y, 2 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 1 + -8, // 1 + -4, // 0 + -7, // 0 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, + 5, + 7, // 0 + -6, // 0 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, -1, y, -2 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js new file mode 100644 index 000000000000..4475219c985e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2019 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 cdotc = 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 cdotc, '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 cdotc.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 cdotc = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cdotc, 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 cdotc; + var main; + + main = require( './../lib/cdotc.js' ); + + cdotc = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( cdotc, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js new file mode 100644 index 000000000000..3e9b390bddf3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js @@ -0,0 +1,215 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2019 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 Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var cdotc = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.deepEqual( typeof cdotc, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.deepEqual( cdotc.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of complex vectors `x` and `y`', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array( [ + 0.7, // 0 + -0.8, // 0 + -0.4, // 1 + -0.7 // 1 + ] ); + y = new Complex64Array( [ + 0.6, // 0 + -0.6, // 0 + -0.9, // 1 + 0.5 // 1 + ] ); + expected = new Complex64( 0.91, -0.77 ); + + dot = cdotc( x.length, x, 1, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns Complex( 0.0, 0.0 )', function test( t ) { + var expected; + var dot; + var x; + var y; + + expected = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ -0.1, -0.9, 0.2, -0.8 ] ); + y = new Complex64Array( [ 0.7, -0.6, 0.1, -0.5 ] ); + + dot = cdotc( 0, x, 1, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + dot = cdotc( -4, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, 2, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, // 0 + 5, // 0 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( -55, 23 ); + + dot = cdotc( 2, x, 2, 0, y, -1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `y` stride', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, + 5, + 7, // 1 + -6, // 1 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, 0, y, 2, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 1 + -8, // 1 + -4, // 0 + -7, // 0 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, + 5, + 7, // 0 + -6, // 0 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, -1, 1, y, -2, 2 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); From 556f4f5dccbd93849d50e07dc4bab0da4cf26572 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 14 Jan 2025 14:09:16 +0000 Subject: [PATCH 02/17] fix: fixing markdown example --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/blas/base/cdotc/README.md | 3 +++ lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index ae7ee0a69880..1d1ace828400 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -47,6 +47,7 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var realf = require( '@stdlib/complex/float32/real' ); var imagf = require( '@stdlib/complex/float32/imag' ); +var cdotc = require( '@stdlib/blas/base/cdotc' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); @@ -99,6 +100,7 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var realf = require( '@stdlib/complex/float32/real' ); var imagf = require( '@stdlib/complex/float32/imag' ); +var cdotc = require( '@stdlib/blas/base/cdotc' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); @@ -125,6 +127,7 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var realf = require( '@stdlib/complex/float32/real' ); var imagf = require( '@stdlib/complex/float32/imag' ); +var cdotc = require( '@stdlib/blas/base/cdotc' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js index 90610ee5852b..5acc6dcb0a2c 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js @@ -42,6 +42,7 @@ var ndarray = require( './ndarray.js' ); * var Complex64 = require( '@stdlib/complex/float32/ctor' ); * var realf = require( '@stdlib/complex/float32/real' ); * var imagf = require( '@stdlib/complex/float32/imag' ); +* var cdotc = require( '@stdlib/blas/base/cdotc' ); * * var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); * var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); From 498ea050c5eee724b9b1f7763ab4d34ce6cd45b4 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 14 Jan 2025 14:20:04 +0000 Subject: [PATCH 03/17] fix: style fix --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- 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: failed --- --- .../@stdlib/blas/base/cdotc/test/test.cdotc.js | 10 +++++----- .../@stdlib/blas/base/cdotc/test/test.ndarray.js | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js index a05367bcd719..6aa2cad026d8 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js @@ -45,18 +45,18 @@ tape( 'the function calculates the dot product of vectors `x` and `y`', function var x; var y; - x = new Complex64Array( [ + x = new Complex64Array([ 0.7, // 0 -0.8, // 0 -0.4, // 1 -0.7 // 1 - ] ); - y = new Complex64Array( [ + ]); + y = new Complex64Array([ 0.6, // 0 -0.6, // 0 -0.9, // 1 0.5 // 1 - ] ); + ]); expected = new Complex64( 0.91, -0.77 ); dot = cdotc( x.length, x, 1, y, 1 ); @@ -154,7 +154,7 @@ tape( 'the function supports an `y` stride', function test( t ) { var x; var y; - x = new Complex64Array([ + x = new Complex64Array( [ 7, // 0 -8, // 0 -4, // 1 diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js index 3e9b390bddf3..9b37e2836027 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js @@ -45,18 +45,18 @@ tape( 'the function calculates the dot product of complex vectors `x` and `y`', var x; var y; - x = new Complex64Array( [ + x = new Complex64Array([ 0.7, // 0 -0.8, // 0 -0.4, // 1 -0.7 // 1 - ] ); - y = new Complex64Array( [ + ]); + y = new Complex64Array([ 0.6, // 0 -0.6, // 0 -0.9, // 1 0.5 // 1 - ] ); + ]); expected = new Complex64( 0.91, -0.77 ); dot = cdotc( x.length, x, 1, 0, y, 1, 0 ); From 340f4df2f0301e4b92c57347dcaf5eafe87d3488 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 14 Jan 2025 14:28:04 +0000 Subject: [PATCH 04/17] fix: fixing style --- 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- 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: passed - 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: passed --- --- lib/node_modules/@stdlib/blas/base/cdotc/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index 1d1ace828400..c6d304d424dc 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -47,7 +47,6 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var realf = require( '@stdlib/complex/float32/real' ); var imagf = require( '@stdlib/complex/float32/imag' ); -var cdotc = require( '@stdlib/blas/base/cdotc' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); @@ -100,7 +99,6 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var realf = require( '@stdlib/complex/float32/real' ); var imagf = require( '@stdlib/complex/float32/imag' ); -var cdotc = require( '@stdlib/blas/base/cdotc' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); @@ -127,7 +125,6 @@ var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var realf = require( '@stdlib/complex/float32/real' ); var imagf = require( '@stdlib/complex/float32/imag' ); -var cdotc = require( '@stdlib/blas/base/cdotc' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); @@ -167,6 +164,7 @@ var im = imagf( out ); var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var filledarrayBy = require( '@stdlib/array/filled-by' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var cdotc = require( '@stdlib/blas/base/cdotc' ); function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) ); From 1003bd7fee515b283b4b7568d4eb3997da98fa36 Mon Sep 17 00:00:00 2001 From: Vinit Pandit Date: Tue, 14 Jan 2025 14:30:55 +0000 Subject: [PATCH 05/17] fix: fixing spaces --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- 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: passed --- --- lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js index 6aa2cad026d8..6212ea5cada5 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js @@ -154,7 +154,7 @@ tape( 'the function supports an `y` stride', function test( t ) { var x; var y; - x = new Complex64Array( [ + x = new Complex64Array([ 7, // 0 -8, // 0 -4, // 1 From ff192a2db104d209db463c2df8818d31061d0496 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:32:13 +0000 Subject: [PATCH 06/17] chore: update copyright years --- lib/node_modules/@stdlib/blas/base/cdotc/README.md | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js | 2 +- .../@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/test/test.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index c6d304d424dc..80ba8bccceb7 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2023 The Stdlib Authors. +Copyright (c) 2025 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js index ee925781620f..76aed09d1699 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js index 9a61f62f32a7..04b506e3bd19 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts index 15d22a09fb7d..62bcc7daa6b0 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js index b49249750b74..4beccfc55d72 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js index 5acc6dcb0a2c..0d7cb535ec27 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js index b9b3df1b7019..7edda9aeb5f6 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js index d14c235cb5f3..da0894150706 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js index f61569bdb65d..084fa0e243c0 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2023 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js index 6212ea5cada5..b036aa60b7cd 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js index 4475219c985e..3d88e15dccb8 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js index 9b37e2836027..a333a7f60c40 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2019 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 2a06c82f170a8c5d3298194426ac47b5ea7a621f Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 13 Jun 2025 12:59:46 +0530 Subject: [PATCH 07/17] chore: update implementation --- .../@stdlib/blas/base/cdotc/README.md | 77 ++-------- .../blas/base/cdotc/benchmark/benchmark.js | 15 +- .../base/cdotc/benchmark/benchmark.ndarray.js | 15 +- .../@stdlib/blas/base/cdotc/docs/repl.txt | 39 ++--- .../blas/base/cdotc/docs/types/index.d.ts | 18 +-- .../@stdlib/blas/base/cdotc/examples/index.js | 17 ++- .../@stdlib/blas/base/cdotc/lib/cdotc.js | 19 +-- .../@stdlib/blas/base/cdotc/lib/index.js | 26 +--- .../@stdlib/blas/base/cdotc/lib/ndarray.js | 20 +-- .../blas/base/cdotc/test/test.cdotc.js | 89 +++++++++-- .../blas/base/cdotc/test/test.ndarray.js | 143 ++++++++++++++++-- 11 files changed, 282 insertions(+), 196 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index 80ba8bccceb7..9229c223fd18 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -20,7 +20,7 @@ limitations under the License. # cdotc -> Calculate the dot product of two single-precision complex vectors. +> Calculate the dot product `x^H * y` of `x` and `y`.
@@ -40,25 +40,17 @@ var cdotc = require( '@stdlib/blas/base/cdotc' ); #### cdotc( N, x, strideX, y, strideY ) -Calculates the dot product of complex vectors `x` and `y`. +Calculates the dot product `x^H * y` of `x` and `y`. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); var out = cdotc( x.length, x, 1, y, 1 ); -// returns - -var re = realf( out ); -// returns 54 - -var im = imagf( out ); -// returns -80 +// returns [ 54.0, -80.0 ] ``` The function has the following parameters: @@ -74,43 +66,27 @@ The `N` and stride parameters determine which elements in the strided arrays are ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var x = new Complex64Array( [ -1.0, -9.0, 2.0, -8.0 ] ); var y = new Complex64Array( [ -5.0, 1.0, -6.0, 7.0 ] ); var out = cdotc( x.length, x, 1, y, -1 ); -// returns - -var re = realf( out ); -// returns -75 - -var im = imagf( out ); -// returns -99 +// returns [ -75.0, -99.0 ] ``` #### cdotc.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) -Calculates the dot product of `x` and `y` using alternative indexing semantics. +Calculates the dot product `x^H * y` of `x` and `y` using alternative indexing semantics. ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); var out = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); -// returns - -var re = realf( out ); -// returns 54 - -var im = imagf( out ); -// returns -80 +// returns [ 54.0, -80.0 ] ``` The function has the following additional parameters: @@ -123,20 +99,12 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the ```javascript var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); -// returns - -var re = realf( out ); -// returns -55 - -var im = imagf( out ); -// returns 23 +// returns [ -55.0, 23.0 ] ```
@@ -170,14 +138,14 @@ function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) ); } -var cx = filledarrayBy( 10, 'complex64', rand ); -console.log( cx.toString() ); +var x = filledarrayBy( 10, 'complex64', rand ); +console.log( x.toString() ); -var cy = filledarrayBy( 10, 'complex64', rand ); -console.log( cy.toString() ); +var y = filledarrayBy( 10, 'complex64', rand ); +console.log( y.toString() ); -// Perform dot product of cx and cy -var out = cdotc.ndarray( cx.length, cx, 1, 0, cy, -1, cy.length-1 ); +// Perform dot product of x and y +var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); console.log( out ); ``` @@ -189,15 +157,6 @@ console.log( out ); @@ -216,16 +175,6 @@ console.log( out ); [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray - - -[@stdlib/blas/base/zdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotc - -[@stdlib/blas/base/cdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/cdotu - -[@stdlib/blas/base/zdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotu - -[@stdlib/blas/cdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/cdotc - diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js index 76aed09d1699..4ae564ea250e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js @@ -26,7 +26,6 @@ var pow = require( '@stdlib/math/base/special/pow' ); var Complex64Array = require( '@stdlib/array/complex64' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var pkg = require( './../package.json' ).name; var cdotc = require( './../lib/cdotc.js' ); @@ -48,11 +47,11 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var cx; - var cy; + var x; + var y; - cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); - cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); return benchmark; @@ -68,13 +67,13 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = cdotc( cx.length, cx, 1, cy, 1 ); - if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + out = cdotc( x.length, x, 1, y, 1 ); + if ( isnanf( realf( out ) ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + if ( isnanf( realf( out ) ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js index 04b506e3bd19..75e511633293 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js @@ -26,7 +26,6 @@ var pow = require( '@stdlib/math/base/special/pow' ); var Complex64Array = require( '@stdlib/array/complex64' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var pkg = require( './../package.json' ).name; var cdotc = require( './../lib/ndarray.js' ); @@ -48,11 +47,11 @@ var options = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var cx; - var cy; + var x; + var y; - cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); - cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); return benchmark; @@ -68,13 +67,13 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - out = cdotc( cx.length, cx, 1, 0, cy, 1, 0 ); - if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + out = cdotc( x.length, x, 1, 0, y, 1, 0 ); + if ( isnanf( realf( out ) ) ) { b.fail( 'should not return NaN' ); } } b.toc(); - if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) { + if ( isnanf( realf( out ) ) ) { b.fail( 'should not return NaN' ); } b.pass( 'benchmark finished' ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt index 977e2e46af90..c480e3994495 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt @@ -29,7 +29,7 @@ Returns ------- - out: Complex64 + z: Complex64 The dot product. Examples @@ -37,20 +37,14 @@ // Standard usage: > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); - > var out = {{alias}}( x.length, x, 1, y, 1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( out ) - 54 - > var im = {{alias:@stdlib/complex/float32/imag}}( out ) - -80 + > var z = {{alias}}( x.length, x, 1, y, 1 ); + [ 54.0, -80.0 ] // Strides: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); - > out = {{alias}}( 2, x, 2, y, 1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( out ) - 54 - > var im = {{alias:@stdlib/complex/float32/imag}}( out ) - -80 + > z = {{alias}}( 2, x, 2, y, 1 ); + [ 54.0, -80.0 ] {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) @@ -85,7 +79,7 @@ Returns ------- - out: Complex64 + z: Complex64 The dot product. Examples @@ -93,29 +87,20 @@ // Standard usage: > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); - > var out = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ); - > var re = {{alias:@stdlib/complex/float32/real}}( out ) - 54 - > var im = {{alias:@stdlib/complex/float32/imag}}( out ) - -80 + > var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ); + [ 54.0, -80.0 ] // Strides: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); - > out = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 ); - > var re = {{alias:@stdlib/complex/float32/real}}( out ) - 54 - > var im = {{alias:@stdlib/complex/float32/imag}}( out ) - -80 + > z = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 ); + [ 54.0, -80.0 ] // Using offset indices: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); - > out = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ); - > var re = {{alias:@stdlib/complex/float32/real}}( out ) - 61 - > var im = {{alias:@stdlib/complex/float32/imag}}( out ) - -72 + > z = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ); + [ 54.0, -80.0 ] See Also -------- diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts index 949080bec76a..b29f3902dddf 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts @@ -25,9 +25,9 @@ import { Complex64Array } from '@stdlib/types/array'; /** * Interface describing `cdotc`. */ -interface Routine { +interface Rzine { /** - * Computes the dot product of two single-precision complex vectors. + * Computes the dot product `x^H * y` of `x` and `y`. * * @param N - number of indexed elements * @param x - first input complex array @@ -43,12 +43,12 @@ interface Routine { * var y = new Complex64Array( [ 6, -6, -9, 5 ] ); * * var z = cdotc( x.length, x, 1, y, 1 ); - * // returns + * // returns [ 54.0, -80.0 ] */ ( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64; /** - * Computes the dot product of `x` and `y` using alternative indexing semantics. + * Computes the dot product `x^H * y` of `x` and `y` using alternative indexing semantics. * * @param N - number of indexed elements * @param x - first input array @@ -66,13 +66,13 @@ interface Routine { * var y = new Complex64Array( [ 6, -6, -9, 5 ] ); * * var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); - * // returns + * // returns [ 54.0, -80.0 ] */ ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64; } /** -* Computes the dot product of `x` and `y`. +* Computes the dot product `x^H * y` of `x` and `y`. * * @param N - number of indexed elements * @param x - first input array @@ -88,7 +88,7 @@ interface Routine { * var y = new Complex64Array( [ 6, -6, -9, 5 ] ); * * var z = cdotc( x.length, x, 1, y, 1 ); -* // returns +* // returns [ 54.0, -80.0 ] * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); @@ -97,9 +97,9 @@ interface Routine { * var y = new Complex64Array( [ 6, -6, -9, 5 ] ); * * var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); -* // returns +* // returns [ 54.0, -80.0 ] */ -declare var cdotc: Routine; +declare var cdotc: Rzine; // EXPORTS // diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js index 4beccfc55d72..02a5e9a48b36 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js @@ -27,12 +27,15 @@ function rand() { return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) ); } -var cx = filledarrayBy( 10, 'complex64', rand ); -console.log( cx.toString() ); +var x = filledarrayBy( 10, 'complex64', rand ); +console.log( x.toString() ); -var cy = filledarrayBy( 10, 'complex64', rand ); -console.log( cy.toString() ); +var y = filledarrayBy( 10, 'complex64', rand ); +console.log( y.toString() ); -// Perform dot product of cx and cy -var out = cdotc.ndarray( cx.length, cx, 1, 0, cy, -1, cy.length-1 ); -console.log( out ); +// Perform dot product of x and y +var z = cdotc( x.length, x, 1, 0, y, 1, 0 ); +console.log( z ); + +z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); +console.log( z ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js index 0d7cb535ec27..01278fbcc6bc 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js @@ -21,14 +21,13 @@ // MODULES // var stride2offset = require( '@stdlib/strided/base/stride2offset' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); var ndarray = require( './ndarray.js' ); // MAIN // /** -* Computes the dot product of `x` and `y`. +* Computes the dot product `x^H * y` of `x` and `y`. * * @param {PositiveInteger} N - number of indexed elements * @param {Complex64Array} x - first input array @@ -40,28 +39,18 @@ var ndarray = require( './ndarray.js' ); * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); * var cdotc = require( '@stdlib/blas/base/cdotc' ); * * var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); * var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); * -* var out = cdotc( x.length, x, 1, y, 1 ); -* // returns -* -* var re = realf( out ); -* // returns 54 -* -* var im = imagf( out ); -* // returns -80 +* var z = cdotc( x.length, x, 1, y, 1 ); +* // returns [ 54.0, -80.0 ] */ function cdotc( N, x, strideX, y, strideY ) { var ix; var iy; - if ( N <= 0 ) { - return new Complex64( 0, 0 ); - } + ix = stride2offset( N, strideX ); iy = stride2offset( N, strideY ); return ndarray( N, x, strideX, ix, y, strideY, iy ); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js index 7edda9aeb5f6..08f53c6045c2 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js @@ -19,46 +19,30 @@ 'use strict'; /** -* BLAS level 1 routine to compute the dot product of two single-precision complex vectors. +* BLAS level 1 routine to compute the dot product `x^H * y` of `x` and `y`. * * @module @stdlib/blas/base/cdotc * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); * var cdotc = require( '@stdlib/blas/base/cdotc' ); * * var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); * var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); -* var out = cdotc( x.length, x, 1, y, 1 ); -* // returns -* -* var re = realf( out ); -* // returns 54 -* -* var im = imagf( out ); -* // returns -80 +* var z = cdotc( x.length, x, 1, y, 1 ); +* // returns [ 54.0, -80.0 ] * * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); * var cdotc = require( '@stdlib/blas/base/cdotc' ); * * var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); * var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); * -* var out = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); -* // returns -* -* var re = realf( out ); -* // returns 54 -* -* var im = imagf( out ); -* // returns -80 +* var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns [ 54.0, -80.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js index 084fa0e243c0..a9961f71b53e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js @@ -20,8 +20,8 @@ // MODULES // -var cmul = require( '@stdlib/complex/float32/base/mul' ); -var cadd = require( '@stdlib/complex/float32/base/add' ); +var mul = require( '@stdlib/complex/float32/base/mul' ); +var add = require( '@stdlib/complex/float32/base/add' ); var conj = require( '@stdlib/complex/float32/conj' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); @@ -29,7 +29,7 @@ var Complex64 = require( '@stdlib/complex/float32/ctor' ); // MAIN // /** -* Computes the dot product of `x` and `y`. +* Computes the dot product `x^H * y` of `x` and `y`. * * @param {integer} N - number of indexed elements * @param {Complex64Array} x - first input array @@ -43,20 +43,12 @@ var Complex64 = require( '@stdlib/complex/float32/ctor' ); * @example * var Complex64Array = require( '@stdlib/array/complex64' ); * var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); * * var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); * var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); * -* var out = cdotc( x.length, x, 1, 0, y, 1, 0 ); -* // returns -* -* var re = realf( out ); -* // returns 54 -* -* var im = imagf( out ); -* // returns -80 +* var z = cdotc( x.length, x, 1, 0, y, 1, 0 ); +* // returns [ 54.0, -80.0 ] */ function cdotc( N, x, strideX, offsetX, y, strideY, offsetY ) { var conjX; @@ -73,7 +65,7 @@ function cdotc( N, x, strideX, offsetX, y, strideY, offsetY ) { iy = offsetY; for ( i = 0; i < N; i++ ) { conjX = conj( x.get( ix ) ); - dot = cadd( dot, cmul( conjX, y.get( iy ) ) ); + dot = add( dot, mul( conjX, y.get( iy ) ) ); ix += strideX; iy += strideY; } diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js index b036aa60b7cd..a11772e8cadf 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js @@ -83,7 +83,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu t.end(); }); -tape( 'the function supports an `x` stride', function test( t ) { +tape( 'the function supports a `x` stride', function test( t ) { var expected; var dot; var x; @@ -115,40 +115,39 @@ tape( 'the function supports an `x` stride', function test( t ) { t.end(); }); -tape( 'the function supports complex access patterns', function test( t ) { +tape( 'the function supports a negative `x` stride', function test( t ) { var expected; var dot; var x; var y; x = new Complex64Array([ + -1, // 1 + -9, // 1 7, // 0 -8, // 0 -4, -7, - -1, // 1 - -9, // 1 2, -8 ]); y = new Complex64Array([ - 6, // 1 - -6, // 1 - -9, // 0 - 5, // 0 + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 7, -6, 1, -5 ]); - expected = new Complex64( -55, 23 ); - - dot = cdotc( 2, x, 2, y, -1 ); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, -1, y, 1 ); t.deepEqual( dot, expected, 'returns expected value' ); t.end(); }); -tape( 'the function supports an `y` stride', function test( t ) { +tape( 'the function supports a `y` stride', function test( t ) { var expected; var dot; var x; @@ -181,6 +180,39 @@ tape( 'the function supports an `y` stride', function test( t ) { t.end(); }); +tape( 'the function supports a negative `y` stride', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 7, // 1 + -6, // 1 + 6, // 0 + -6, // 0 + -9, + 5, + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, y, -1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports negative strides', function test( t ) { var expected; var dot; @@ -213,3 +245,36 @@ tape( 'the function supports negative strides', function test( t ) { t.deepEqual( dot, expected, 'returns expected value' ); t.end(); }); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, // 0 + 5, // 0 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( -55, 23 ); + + dot = cdotc( 2, x, 2, y, -1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js index a333a7f60c40..f551f5110e54 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js @@ -83,7 +83,7 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu t.end(); }); -tape( 'the function supports an `x` stride', function test( t ) { +tape( 'the function supports a `x` stride', function test( t ) { var expected; var dot; var x; @@ -115,40 +115,67 @@ tape( 'the function supports an `x` stride', function test( t ) { t.end(); }); -tape( 'the function supports complex access patterns', function test( t ) { +tape( 'the function supports a negative `x` stride', function test( t ) { var expected; var dot; var x; var y; x = new Complex64Array([ + -1, // 1 + -9, // 1 7, // 0 -8, // 0 -4, -7, - -1, // 1 - -9, // 1 2, -8 ]); y = new Complex64Array([ - 6, // 1 - -6, // 1 - -9, // 0 - 5, // 0 + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 7, -6, 1, -5 ]); - expected = new Complex64( -55, 23 ); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, -1, 1, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); - dot = cdotc( 2, x, 2, 0, y, -1, 1 ); +tape( 'the function supports a `x` offset', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 0.0, + 0.0, + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0 // 1 + ]); + y = new Complex64Array([ + -5.0, // 0 + 1.0, // 0 + -6.0, // 1 + 7.0 // 1 + ]); + expected = new Complex64( 7.0, 56.0 ); + + dot = cdotc( 2, x, 1, 1, y, 1, 0 ); t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); }); -tape( 'the function supports an `y` stride', function test( t ) { +tape( 'the function supports a `y` stride', function test( t ) { var expected; var dot; var x; @@ -181,6 +208,67 @@ tape( 'the function supports an `y` stride', function test( t ) { t.end(); }); +tape( 'the function supports a negative `y` stride', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 7, // 1 + -6, // 1 + 6, // 0 + -6, // 0 + -9, + 5, + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, 0, y, -1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` offset', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0 // 1 + ]); + y = new Complex64Array([ + 0.0, + 0.0, + -5.0, // 0 + 1.0, // 0 + -6.0, // 1 + 7.0 // 1 + ]); + expected = new Complex64( 7.0, 56.0 ); + + dot = cdotc( 2, x, 1, 0, y, 1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports negative strides', function test( t ) { var expected; var dot; @@ -213,3 +301,36 @@ tape( 'the function supports negative strides', function test( t ) { t.deepEqual( dot, expected, 'returns expected value' ); t.end(); }); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, // 0 + 5, // 0 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( -55, 23 ); + + dot = cdotc( 2, x, 2, 0, y, -1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); From 5d0a0aa104b47ebaa7bcc56a49e4fcf05a65c59e Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:01:10 +0530 Subject: [PATCH 08/17] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js index 08f53c6045c2..75513172ed8e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js @@ -68,4 +68,4 @@ if ( isError( tmp ) ) { module.exports = cdotc; -// exports: { "ndarray": "sdot.ndarray" } +// exports: { "ndarray": "cdotc.ndarray" } From 862b74c443226511832fe207c021a7f2f3fa6036 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:29:25 +0530 Subject: [PATCH 09/17] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js index 02a5e9a48b36..6ad42d3322f4 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js @@ -34,7 +34,7 @@ var y = filledarrayBy( 10, 'complex64', rand ); console.log( y.toString() ); // Perform dot product of x and y -var z = cdotc( x.length, x, 1, 0, y, 1, 0 ); +var z = cdotc( x.length, x, 1, y, 1 ); console.log( z ); z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); From de970d606c404b5a785af985928f905b4b00fdde Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:33:04 +0530 Subject: [PATCH 10/17] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt index c480e3994495..85e6ae5b0fee 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt @@ -37,13 +37,13 @@ // Standard usage: > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); - > var z = {{alias}}( x.length, x, 1, y, 1 ); + > var z = {{alias}}( x.length, x, 1, y, 1 ) [ 54.0, -80.0 ] // Strides: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); - > z = {{alias}}( 2, x, 2, y, 1 ); + > z = {{alias}}( 2, x, 2, y, 1 ) [ 54.0, -80.0 ] @@ -87,19 +87,19 @@ // Standard usage: > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); - > var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ); + > var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) [ 54.0, -80.0 ] // Strides: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); - > z = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 ); + > z = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 ) [ 54.0, -80.0 ] // Using offset indices: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); - > z = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ); + > z = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ) [ 54.0, -80.0 ] See Also From 9798c3e2dd3c390c4d30c082690fae58ed7d45dd Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:37:44 +0530 Subject: [PATCH 11/17] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt index 85e6ae5b0fee..e24cda2fc75a 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt @@ -38,13 +38,13 @@ > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); > var z = {{alias}}( x.length, x, 1, y, 1 ) - [ 54.0, -80.0 ] + [ 54.0, -80.0 ] // Strides: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); > z = {{alias}}( 2, x, 2, y, 1 ) - [ 54.0, -80.0 ] + [ 54.0, -80.0 ] {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) @@ -88,19 +88,19 @@ > var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] ); > var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] ); > var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) - [ 54.0, -80.0 ] + [ 54.0, -80.0 ] // Strides: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); > z = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 ) - [ 54.0, -80.0 ] + [ 54.0, -80.0 ] // Using offset indices: > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); > z = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ) - [ 54.0, -80.0 ] + [ 54.0, -80.0 ] See Also -------- From c6c4d097b21c3e3ac0fd9ed8291ae5d24e408ca6 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 13 Jun 2025 13:41:52 +0530 Subject: [PATCH 12/17] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt index e24cda2fc75a..cade653ad7c5 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt @@ -100,7 +100,7 @@ > x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] ); > y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] ); > z = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 ) - [ 54.0, -80.0 ] + [ 61.0, -72.0 ] See Also -------- From e9651eb406e83390526d63401d41d3a9f4f854d4 Mon Sep 17 00:00:00 2001 From: Dhruv Singh Date: Mon, 16 Mar 2026 20:16:55 +0000 Subject: [PATCH 13/17] Try --- .../base/cdotc/benchmark/benchmark.native.js | 109 ++++ .../benchmark/benchmark.ndarray.native.js | 109 ++++ .../blas/base/cdotc/benchmark/c/Makefile | 52 ++ .../base/cdotc/benchmark/c/benchmark.length.c | 79 +++ .../base/cdotc/benchmark/fortran/Makefile | 49 ++ .../benchmark/fortran/benchmark.length.f | 94 ++++ .../@stdlib/blas/base/cdotc/binding.gyp | 155 ++++++ .../blas/base/cdotc/examples/c/Makefile | 52 ++ .../blas/base/cdotc/examples/c/example.c | 44 ++ .../@stdlib/blas/base/cdotc/include.gypi | 70 +++ .../cdotc/include/stdlib/blas/base/cdotc.h | 49 ++ .../include/stdlib/blas/base/cdotc_cblas.h | 54 ++ .../include/stdlib/blas/base/cdotc_fortran.h | 43 ++ .../blas/base/cdotc/lib/cdotc.native.js | 59 ++ .../@stdlib/blas/base/cdotc/lib/native.js | 35 ++ .../blas/base/cdotc/lib/ndarray.native.js | 61 +++ .../@stdlib/blas/base/cdotc/manifest.json | 505 ++++++++++++++++++ .../@stdlib/blas/base/cdotc/package.json | 5 +- .../@stdlib/blas/base/cdotc/src/addon.c | 84 +++ .../@stdlib/blas/base/cdotc/src/cdotc.c | 37 ++ .../@stdlib/blas/base/cdotc/src/cdotc.f | 104 ++++ .../@stdlib/blas/base/cdotc/src/cdotc_cblas.c | 62 +++ .../@stdlib/blas/base/cdotc/src/cdotc_f.c | 62 +++ .../blas/base/cdotc/src/cdotc_ndarray.c | 65 +++ .../@stdlib/blas/base/cdotc/src/cdotcsub.f | 49 ++ .../blas/base/cdotc/test/test.cdotc.native.js | 288 ++++++++++ .../base/cdotc/test/test.ndarray.native.js | 344 ++++++++++++ 27 files changed, 2718 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/include/stdlib/blas/base/cdotc.h create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/include/stdlib/blas/base/cdotc_cblas.h create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/include/stdlib/blas/base/cdotc_fortran.h create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js new file mode 100644 index 000000000000..f569d0e1da3a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js @@ -0,0 +1,109 @@ +/** +* @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 pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var realf = require( '@stdlib/complex/float32/real' ); +var pkg = require( './../package.json' ).name; +var cdotc = require( './../lib/cdotc.native.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 x; + var y; + + x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = cdotc( x.length, x, 1, y, 1 ); + if ( isnanf( realf( out ) ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( realf( out ) ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':native:len='+len, f ); + } +} + +main(); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js new file mode 100644 index 000000000000..1c1b201e953c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js @@ -0,0 +1,109 @@ +/** +* @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 pow = require( '@stdlib/math/base/special/pow' ); +var Complex64Array = require( '@stdlib/array/complex64' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var realf = require( '@stdlib/complex/float32/real' ); +var pkg = require( './../package.json' ).name; +var cdotc = require( './../lib/ndarray.native.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 x; + var y; + + x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = cdotc( x.length, x, 1, 0, y, 1, 0 ); + if ( isnanf( realf( out ) ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( realf( out ) ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':ndarray:native:len='+len, f ); + } +} + +main(); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile new file mode 100644 index 000000000000..033e371232fc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile @@ -0,0 +1,52 @@ +# @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. + +# Makefile for compiling C benchmark files. + +# Compiler settings: +CC ?= gcc + +# Include directories: +INCLUDE ?= -I../../../include -I$(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( '-I' + arr[i] ); }") + +# Compiler flags: +CFLAGS ?= -O3 -std=c99 -Wall -fPIC $(INCLUDE) + +# Source files: +SRCS := benchmark.length.c + +# Object files: +OBJS := $(SRCS:.c=.o) + +# Executable: +TARGET := benchmark + +# Default target: +.PHONY: all clean + +# Build executable: +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) -o $@ $^ $(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[i] ); }") + +# Compile source files: +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +# Clean generated files: +clean: + rm -f $(OBJS) $(TARGET) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..0a6f2594d3da --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include +#include +#include + +#define ITERATIONS 1000000 + +/** +* Benchmarks the cdotc function. +* +* @param len - array length +* @return elapsed time in seconds +*/ +double benchmark( int len ) { + stdlib_complex64_t *x; + stdlib_complex64_t *y; + stdlib_complex64_t dot; + clock_t start; + clock_t end; + double t; + int i; + + x = (stdlib_complex64_t *)malloc( len * sizeof( stdlib_complex64_t ) ); + y = (stdlib_complex64_t *)malloc( len * sizeof( stdlib_complex64_t ) ); + + for ( i = 0; i < len; i++ ) { + x[ i ] = stdlib_complex64_from_real( (float)i ); + y[ i ] = stdlib_complex64_from_real( (float)(len - i) ); + } + + start = clock(); + for ( i = 0; i < ITERATIONS; i++ ) { + dot = c_cdotc( len, (void *)x, 1, (void *)y, 1 ); + } + end = clock(); + + t = (double)(end - start) / (double)CLOCKS_PER_SEC; + + free( x ); + free( y ); + + return t; +} + +int main( void ) { + int len; + int i; + + printf( "Benchmarking cdotc...\n" ); + + for ( i = 1; i <= 6; i++ ) { + len = 1; + len <<= i; + printf( "len=%d: %f seconds\n", len, benchmark( len ) ); + } + + return 0; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile new file mode 100644 index 000000000000..db884e0c019a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile @@ -0,0 +1,49 @@ +# @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. + +# Makefile for compiling Fortran benchmark files. + +# Compiler settings: +FC ?= gfortran + +# Compiler flags: +FFLAGS ?= -O3 -std=f95 -Wall -fPIC + +# Source files: +SRCS := benchmark.length.f ../../src/cdotc.f + +# Object files: +OBJS := $(SRCS:.f=.o) + +# Executable: +TARGET := benchmark + +# Default target: +.PHONY: all clean + +# Build executable: +all: $(TARGET) + +$(TARGET): $(OBJS) + $(FC) $(FFLAGS) -o $@ $^ + +# Compile source files: +%.o: %.f + $(FC) $(FFLAGS) -c $< -o $@ + +# Clean generated files: +clean: + rm -f $(OBJS) $(TARGET) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f new file mode 100644 index 000000000000..2c28a22bf21e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f @@ -0,0 +1,94 @@ +!> +! @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. +!< + +!> +! Benchmarks the cdotc function. +! +! ## Notes +! +! * Modified version of reference BLAS level1 routine (version 3.12.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 array +! @param {integer} strideX - `cx` stride length +! @param {Array} cy - second array +! @param {integer} strideY - `cy` stride length +! @returns {complex} the dot product +!< +program benchmark + implicit none + ! .. + ! External functions: + complex :: cdotc + external cdotc + ! .. + ! Local scalars: + integer :: i, j, len + real :: start, finish + complex :: dot + ! .. + ! Local arrays: + complex, allocatable :: cx(:), cy(:) + ! .. + ! Parameters: + integer, parameter :: ITERATIONS = 1000000 + ! .. + print *, "Benchmarking cdotc..." + do i = 1, 6 + len = 2**i + allocate( cx(len) ) + allocate( cy(len) ) + do j = 1, len + cx(j) = cmplx( real(j), 0.0 ) + cy(j) = cmplx( real(len - j + 1), 0.0 ) + end do + call cpu_time( start ) + do j = 1, ITERATIONS + dot = cdotc( len, cx, 1, cy, 1 ) + end do + call cpu_time( finish ) + print *, "len=", len, ": ", finish - start, " seconds" + deallocate( cx ) + deallocate( cy ) + end do +end program benchmark \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp b/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp new file mode 100644 index 000000000000..6ebfcedbfae0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp @@ -0,0 +1,155 @@ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + }, + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile new file mode 100644 index 000000000000..8a3a6ac42570 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile @@ -0,0 +1,52 @@ +# @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. + +# Makefile for compiling C example files. + +# Compiler settings: +CC ?= gcc + +# Include directories: +INCLUDE ?= -I../../../include -I$(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( '-I' + arr[i] ); }") + +# Compiler flags: +CFLAGS ?= -O3 -std=c99 -Wall -fPIC $(INCLUDE) + +# Source files: +SRCS := example.c + +# Object files: +OBJS := $(SRCS:.c=.o) + +# Executable: +TARGET := example + +# Default target: +.PHONY: all clean + +# Build executable: +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) -o $@ $^ $(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[i] ); }") + +# Compile source files: +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +# Clean generated files: +clean: + rm -f $(OBJS) $(TARGET) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c new file mode 100644 index 000000000000..e99122ed7478 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c @@ -0,0 +1,44 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.h" +#include + +int main( void ) { + stdlib_complex64_t x[ 2 ]; + stdlib_complex64_t y[ 2 ]; + stdlib_complex64_t dot; + + // Create complex arrays: + x[ 0 ] = stdlib_complex64_from_real_imag( 7.0f, -8.0f ); + x[ 1 ] = stdlib_complex64_from_real_imag( -1.0f, -9.0f ); + + y[ 0 ] = stdlib_complex64_from_real_imag( 6.0f, -6.0f ); + y[ 1 ] = stdlib_complex64_from_real_imag( -9.0f, 5.0f ); + + // Compute the dot product: + dot = c_cdotc( 2, (void *)x, 1, (void *)y, 1 ); + + // Print the result: + printf( "cdotc( x, y ) = %f + %fi\n", stdlib_complex64_real( dot ), stdlib_complex64_imag( dot ) ); + + return 0; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/include.gypi b/lib/node_modules/@stdlib/blas/base/cdotc/include.gypi new file mode 100644 index 000000000000..2b91ef3e7ad6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/include.gypi @@ -0,0 +1,70 @@ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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)', + '[ 54.0, -80.0 ] +*/ +function cdotc( N, x, strideX, y, strideY ) { + var viewX = reinterpret( x, 0 ); + var viewY = reinterpret( y, 0 ); + return addon( N, viewX, strideX, viewY, strideY ); +} + + +// EXPORTS // + +module.exports = cdotc; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js new file mode 100644 index 000000000000..e2b70b25e453 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var cdotc = require( './cdotc.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( cdotc, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = cdotc; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js new file mode 100644 index 000000000000..354a47c54c95 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js @@ -0,0 +1,61 @@ +/** +* @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 reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* Computes the dot product `x^H * y` of `x` and `y` using alternative indexing semantics. +* +* @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` +* @returns {Complex64} dot product +* +* @example +* var Complex64Array = require( '@stdlib/array/complex64' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); +* var cdotc = require( '@stdlib/blas/base/cdotc' ); +* +* var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] ); +* var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] ); +* +* var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns [ 54.0, -80.0 ] +*/ +function cdotc( N, x, strideX, offsetX, y, strideY, offsetY ) { + var viewX = reinterpret( x, 0 ); + var viewY = reinterpret( y, 0 ); + return addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY ); +} + + +// EXPORTS // + +module.exports = cdotc; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json b/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json new file mode 100644 index 000000000000..883f976be201 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json @@ -0,0 +1,505 @@ +{ + "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/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/napi/export", + "@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", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + + { + "task": "build", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/export", + "@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/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/complex/float32/ctor" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/complex/float32/ctor" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/napi/export", + "@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", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/export", + "@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/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/complex/float32/ctor" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/complex/float32/ctor" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/napi/export", + "@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/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/complex/float32/ctor" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/cdotc_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/complex/float32/ctor" + ] + }, + + { + "task": "build", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/napi/export", + "@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", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + { + "task": "benchmark", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + { + "task": "examples", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + }, + + { + "task": "build", + "os": "", + "blas": "", + "wasm": true, + "src": [ + "./src/cdotc.c", + "./src/cdotc_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/base/mul", + "@stdlib/complex/float32/base/add", + "@stdlib/complex/float32/conj" + ] + } + ] +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/package.json b/lib/node_modules/@stdlib/blas/base/cdotc/package.json index 782b3cfc6a21..eaef3595f031 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/package.json +++ b/lib/node_modules/@stdlib/blas/base/cdotc/package.json @@ -15,11 +15,14 @@ ], "main": "./lib", "browser": "./lib/main.js", + "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", + "include": "./include", "lib": "./lib", + "src": "./src", "test": "./test" }, "types": "./docs/types", @@ -80,4 +83,4 @@ "__stdlib__": { "wasm": false } -} +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c new file mode 100644 index 000000000000..ae62be0f9aa6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_strided_complex64array.h" +#include "stdlib/napi/create_complex_like.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/real.h" +#include "stdlib/complex/float32/imag.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; + CBLAS_INT ix; + CBLAS_INT iy; + + STDLIB_NAPI_ARGV( env, info, argv, argc, 5 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, Y, N, strideY, argv, 3 ); + + ix = stdlib_strided_stride2offset( N, strideX ); + iy = stdlib_strided_stride2offset( N, strideY ); + v = API_SUFFIX(c_cdotc_ndarray)( N, (void *)X, strideX, ix, (void *)Y, strideY, iy ); + 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_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX64ARRAY( env, Y, N, strideY, argv, 4 ); + + v = API_SUFFIX(c_cdotc_ndarray)( N, (void *)X, strideX, offsetX, (void *)Y, strideY, offsetY ); + 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 ) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c new file mode 100644 index 000000000000..26124d3a2a25 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c @@ -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. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" + +/** +* Computes the dot product `x^H * y` 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 +* @return dot product +*/ +stdlib_complex64_t API_SUFFIX(c_cdotc)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY ) { + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY ); + return API_SUFFIX(c_cdotc_ndarray)( N, X, strideX, ox, Y, strideY, oy ); +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f new file mode 100644 index 000000000000..a22b105e3c0f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f @@ -0,0 +1,104 @@ +!> +! @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. +!< + +!> Computes the dot product `x^H * y` of two single-precision complex vectors. +! +! ## Notes +! +! * Modified version of reference BLAS level1 routine (version 3.12.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 array +! @param {integer} strideX - `cx` stride length +! @param {Array} cy - second array +! @param {integer} strideY - `cy` stride length +! @returns {complex} the dot product +!< +complex function cdotc( N, cx, strideX, cy, strideY ) + implicit none + ! .. + ! Scalar arguments: + integer :: strideX, strideY, N + ! .. + ! Array arguments: + complex, intent(in) :: cx(*), cy(*) + ! .. + ! Local scalars: + complex :: ctemp + integer :: ix, iy, i + ! .. + ! Intrinsic functions: + intrinsic conjg + ! .. + ctemp = (0.0, 0.0) + cdotc = (0.0, 0.0) + ! .. + if ( N <= 0 ) then + return + end if + ! .. + ! If both strides are equal to `1`, use unrolled loops... + if ( strideX == 1 .AND. strideY == 1 ) then + do i = 1, N + ctemp = ctemp + conjg( cx( i ) ) * cy( i ) + end do + else + if ( strideX < 0 ) then + ix = ((1-N)*strideX) + 1 + else + ix = 1 + endif + if ( strideY < 0 ) then + iy = ((1-N)*strideY) + 1 + else + iy = 1 + endif + do i = 1, N + ctemp = ctemp + conjg( cx( ix ) ) * cy( iy ) + ix = ix + strideX + iy = iy + strideY + end do + endif + cdotc = ctemp + return +end function cdotc \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c new file mode 100644 index 000000000000..e9ed57d3b47d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/blas/base/cdotc_cblas.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/min-view-buffer-index.h" +#include "stdlib/complex/float32/ctor.h" + +/** +* Computes the dot product `x^H * y` 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 +* @return dot product +*/ +stdlib_complex64_t API_SUFFIX(c_cdotc)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY ) { + stdlib_complex64_t dot; + cblas_cdotc_sub( N, X, strideX, Y, strideY, &dot ); + return dot; +} + +/** +* Computes the dot product `x^H * y` of two single-precision complex floating-point vectors using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X first array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y second array +* @param strideY Y stride length +* @param offsetY starting index for Y +* @return the dot product +*/ +stdlib_complex64_t API_SUFFIX(c_cdotc_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 ) { + stdlib_complex64_t dot; + stdlib_complex64_t *ip1 = (stdlib_complex64_t *)X; + stdlib_complex64_t *ip2 = (stdlib_complex64_t *)Y; + + ip1 += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); + ip2 += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); + cblas_cdotc_sub( N, ip1, strideX, ip2, strideY, &dot ); + return dot; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c new file mode 100644 index 000000000000..9a10c4dc0d65 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c @@ -0,0 +1,62 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/blas/base/cdotc_fortran.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/min_view_buffer_index.h" +#include "stdlib/complex/float32/ctor.h" + +/** +* Computes the dot product `x^H * y` 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 +* @return dot product +*/ +stdlib_complex64_t API_SUFFIX(c_cdotc)( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY ) { + stdlib_complex64_t dot; + cdotcsub( &N, X, &strideX, Y, &strideY, &dot ); + return dot; +} + +/** +* Computes the dot product `x^H * y` of two single-precision complex floating-point vectors using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X first array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y second array +* @param strideY Y stride length +* @param offsetY starting index for Y +* @return the dot product +*/ +stdlib_complex64_t API_SUFFIX(c_cdotc_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 ) { + stdlib_complex64_t dot; + stdlib_complex64_t *ip1 = (stdlib_complex64_t *)X; + stdlib_complex64_t *ip2 = (stdlib_complex64_t *)Y; + + ip1 += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); + ip2 += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); + cdotcsub( &N, ip1, &strideX, ip2, &strideY, &dot ); + return dot; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c new file mode 100644 index 000000000000..305cc28d15f7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c @@ -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. +*/ + +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/base/mul.h" +#include "stdlib/complex/float32/base/add.h" +#include "stdlib/complex/float32/conj.h" +#include + +/** +* Computes the dot product `x^H * y` 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 +* @return dot product +*/ +stdlib_complex64_t API_SUFFIX(c_cdotc_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 ) { + stdlib_complex64_t dot; + stdlib_complex64_t conjX; + stdlib_complex64_t xy; + int64_t ix; + int64_t iy; + int64_t i; + + dot = stdlib_complex64_from_float32( 0.0f ); + if ( N <= 0 ) { + return dot; + } + ix = (int64_t)offsetX; + iy = (int64_t)offsetY; + + stdlib_complex64_t *ip1 = (stdlib_complex64_t *)X; + stdlib_complex64_t *ip2 = (stdlib_complex64_t *)Y; + + for ( i = 0; i < N; i++ ) { + conjX = stdlib_complex64_conj( ip1[ ix ] ); + xy = stdlib_base_complex64_mul( conjX, ip2[ iy ] ); + dot = stdlib_base_complex64_add( dot, xy ); + ix += strideX; + iy += strideY; + } + return dot; +} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f new file mode 100644 index 000000000000..a8b9ddc87c39 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f @@ -0,0 +1,49 @@ +!> +! @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. +!< + +!> Wraps `cdotc` as a subroutine. +! +! @param {integer} N - number of indexed elements +! @param {Array} cx - first array +! @param {integer} strideX - `cx` stride length +! @param {Array} cy - second array +! @param {integer} strideY - `cy` stride length +! @param {complex} dot - output variable reference +!< +subroutine cdotcsub( N, cx, strideX, cy, strideY, dot ) + implicit none + ! .. + ! External functions: + interface + complex function cdotc( N, cx, strideX, cy, strideY ) + complex :: cx(*), cy(*) + integer :: strideX, strideY, N + end function cdotc + end interface + ! .. + ! Scalar arguments: + integer :: strideX, strideY, N + complex :: dot + ! .. + ! Array arguments: + complex :: cx(*), cy(*) + ! .. + ! Compute the dot product: + dot = cdotc( N, cx, strideX, cy, strideY ) + return +end subroutine cdotcsub \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js new file mode 100644 index 000000000000..1c5830913f00 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js @@ -0,0 +1,288 @@ +/** +* @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 Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var cdotc = require( './../lib/cdotc.native.js' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.deepEqual( typeof cdotc, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', opts, function test( t ) { + t.deepEqual( cdotc.length, 5, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of vectors `x` and `y`', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 0.7, // 0 + -0.8, // 0 + -0.4, // 1 + -0.7 // 1 + ]); + y = new Complex64Array([ + 0.6, // 0 + -0.6, // 0 + -0.9, // 1 + 0.5 // 1 + ]); + expected = new Complex64( 0.91, -0.77 ); + + dot = cdotc( x.length, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns Complex( 0.0, 0.0 )', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + expected = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ -0.1, -0.9, 0.2, -0.8 ] ); + y = new Complex64Array( [ 0.7, -0.6, 0.1, -0.5 ] ); + + dot = cdotc( 0, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + dot = cdotc( -4, x, 1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `x` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, 2, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative `x` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + -1, // 1 + -9, // 1 + 7, // 0 + -8, // 0 + -4, + -7, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, -1, y, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, + 5, + 7, // 1 + -6, // 1 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, y, 2 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative `y` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 7, // 1 + -6, // 1 + 6, // 0 + -6, // 0 + -9, + 5, + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, y, -1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 1 + -8, // 1 + -4, // 0 + -7, // 0 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, + 5, + 7, // 0 + -6, // 0 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, -1, y, -2 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, // 0 + 5, // 0 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( -55, 23 ); + + dot = cdotc( 2, x, 2, y, -1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js new file mode 100644 index 000000000000..99ee3a7232ee --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js @@ -0,0 +1,344 @@ +/** +* @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 Complex64Array = require( '@stdlib/array/complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var cdotc = require( './../lib/ndarray.native.js' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.deepEqual( typeof cdotc, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', opts, function test( t ) { + t.deepEqual( cdotc.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function calculates the dot product of complex vectors `x` and `y`', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 0.7, // 0 + -0.8, // 0 + -0.4, // 1 + -0.7 // 1 + ]); + y = new Complex64Array([ + 0.6, // 0 + -0.6, // 0 + -0.9, // 1 + 0.5 // 1 + ]); + expected = new Complex64( 0.91, -0.77 ); + + dot = cdotc( x.length, x, 1, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns Complex( 0.0, 0.0 )', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + expected = new Complex64( 0.0, 0.0 ); + x = new Complex64Array( [ -0.1, -0.9, 0.2, -0.8 ] ); + y = new Complex64Array( [ 0.7, -0.6, 0.1, -0.5 ] ); + + dot = cdotc( 0, x, 1, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + dot = cdotc( -4, x, 1, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `x` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, 2, 0, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative `x` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + -1, // 1 + -9, // 1 + 7, // 0 + -8, // 0 + -4, + -7, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, // 1 + 5, // 1 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( 54, -80 ); + dot = cdotc( 2, x, -1, 1, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `x` offset', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 0.0, + 0.0, + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0 // 1 + ]); + y = new Complex64Array([ + -5.0, // 0 + 1.0, // 0 + -6.0, // 1 + 7.0 // 1 + ]); + expected = new Complex64( 7.0, 56.0 ); + + dot = cdotc( 2, x, 1, 1, y, 1, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports a `y` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 0 + -6, // 0 + -9, + 5, + 7, // 1 + -6, // 1 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, 0, y, 2, 0 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative `y` stride', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, // 1 + -7, // 1 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 7, // 1 + -6, // 1 + 6, // 0 + -6, // 0 + -9, + 5, + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, 1, 0, y, -1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` offset', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 1.0, // 0 + 2.0, // 0 + 3.0, // 1 + 4.0 // 1 + ]); + y = new Complex64Array([ + 0.0, + 0.0, + -5.0, // 0 + 1.0, // 0 + -6.0, // 1 + 7.0 // 1 + ]); + expected = new Complex64( 7.0, 56.0 ); + + dot = cdotc( 2, x, 1, 0, y, 1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports negative strides', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 1 + -8, // 1 + -4, // 0 + -7, // 0 + -1, + -9, + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, + 5, + 7, // 0 + -6, // 0 + 1, + -5 + ]); + expected = new Complex64( 104, 79 ); + + dot = cdotc( 2, x, -1, 1, y, -2, 2 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', opts, function test( t ) { + var expected; + var dot; + var x; + var y; + + x = new Complex64Array([ + 7, // 0 + -8, // 0 + -4, + -7, + -1, // 1 + -9, // 1 + 2, + -8 + ]); + y = new Complex64Array([ + 6, // 1 + -6, // 1 + -9, // 0 + 5, // 0 + 7, + -6, + 1, + -5 + ]); + expected = new Complex64( -55, 23 ); + + dot = cdotc( 2, x, 2, 0, y, -1, 1 ); + t.deepEqual( dot, expected, 'returns expected value' ); + t.end(); +}); \ No newline at end of file From 3203733bcf400e8f0846a87091e77c659a2101c6 Mon Sep 17 00:00:00 2001 From: DhruvArvindSingh Date: Tue, 17 Mar 2026 04:43:54 +0530 Subject: [PATCH 14/17] feat: add 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: 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: 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/cdotc/README.md | 2 +- .../blas/base/cdotc/benchmark/benchmark.js | 2 +- .../base/cdotc/benchmark/benchmark.native.js | 4 +- .../base/cdotc/benchmark/benchmark.ndarray.js | 2 +- .../benchmark/benchmark.ndarray.native.js | 4 +- .../@stdlib/blas/base/cdotc/binding.gyp | 116 +++++++++++++- .../blas/base/cdotc/docs/types/index.d.ts | 2 +- .../blas/base/cdotc/docs/types/test.ts | 2 +- .../blas/base/cdotc/examples/c/Makefile | 144 +++++++++++++++--- .../blas/base/cdotc/examples/c/example.c | 12 +- .../@stdlib/blas/base/cdotc/examples/index.js | 2 +- .../@stdlib/blas/base/cdotc/include.gypi | 4 +- .../cdotc/include/stdlib/blas/base/cdotc.h | 8 +- .../include/stdlib/blas/base/cdotc_cblas.h | 21 +-- .../include/stdlib/blas/base/cdotc_fortran.h | 10 +- .../blas/base/cdotc/lib/cdotc.native.js | 6 +- .../@stdlib/blas/base/cdotc/lib/native.js | 2 +- .../@stdlib/blas/base/cdotc/lib/ndarray.js | 39 +++-- .../blas/base/cdotc/lib/ndarray.native.js | 6 +- .../@stdlib/blas/base/cdotc/manifest.json | 38 +++-- .../@stdlib/blas/base/cdotc/package.json | 2 +- .../@stdlib/blas/base/cdotc/src/Makefile | 70 +++++++++ .../@stdlib/blas/base/cdotc/src/addon.c | 4 +- .../@stdlib/blas/base/cdotc/src/cdotc.c | 4 +- .../@stdlib/blas/base/cdotc/src/cdotc.f | 4 +- .../@stdlib/blas/base/cdotc/src/cdotc_cblas.c | 6 +- .../@stdlib/blas/base/cdotc/src/cdotc_f.c | 4 +- .../blas/base/cdotc/src/cdotc_ndarray.c | 14 +- .../@stdlib/blas/base/cdotc/src/cdotcsub.f | 8 +- .../blas/base/cdotc/test/test.cdotc.js | 2 +- .../blas/base/cdotc/test/test.cdotc.native.js | 4 +- .../@stdlib/blas/base/cdotc/test/test.js | 2 +- .../blas/base/cdotc/test/test.ndarray.js | 2 +- .../base/cdotc/test/test.ndarray.native.js | 4 +- 34 files changed, 426 insertions(+), 130 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/src/Makefile diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index 9229c223fd18..7d1cee2b37c2 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -115,7 +115,7 @@ var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); ## Notes -- If `N <= 0`, both functions return complex64 with real and imagnary as `0.0`. +- If `N <= 0`, both functions return complex64 with real and imaginary as `0.0`. - `cdotc()` corresponds to the [BLAS][blas] level 1 function [`cdotc`][cdotc]. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js index 4ae564ea250e..0d269158e792 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js index f569d0e1da3a..83dbd451257e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,4 +106,4 @@ function main() { } } -main(); \ No newline at end of file +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js index 75e511633293..31c9151eaf0f 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js index 1c1b201e953c..9282b76b99bd 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,4 +106,4 @@ function main() { } } -main(); \ No newline at end of file +main(); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp b/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp index 6ebfcedbfae0..60dce9d0b31a 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp +++ b/lib/node_modules/@stdlib/blas/base/cdotc/binding.gyp @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,7 +28,55 @@ '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': [ @@ -113,6 +161,68 @@ }, ], # end condition (OS!="win") ], # end conditions + + # Define custom build actions for particular inputs: + 'rules': [ + { + # Define a rule for processing Fortran files: + 'extension': 'f', + + # Define the pathnames to be used as inputs when performing processing: + 'inputs': [ + # Full path of the current input: + '<(RULE_INPUT_PATH)' + ], + + # Define the outputs produced during processing: + 'outputs': [ + # Store an output object file in a directory for placing intermediate results (only accessible within a single target): + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).<(obj)' + ], + + # Define the rule for compiling Fortran based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + + # Rule to compile Fortran on Windows: + { + 'rule_name': 'compile_fortran_windows', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Windows...', + + 'process_outputs_as_sources': 0, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + }, + + # Rule to compile Fortran on non-Windows: + { + 'rule_name': 'compile_fortran_linux', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Linux...', + + 'process_outputs_as_sources': 1, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '-fPIC', # generate platform-independent code + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + } + ], # end condition (OS=="win") + ], # end conditions + }, # end rule (extension=="f") + ], # end rules }, # end target <(addon_target_name) # Target to copy a generated add-on to a standard location: @@ -152,4 +262,4 @@ ], # end actions }, # end target copy_addon ], # end targets -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts index b29f3902dddf..77cbf7d4c7ea 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts index 62bcc7daa6b0..6aa5fb9b0cbf 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile index 8a3a6ac42570..6aed70daf167 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile @@ -1,6 +1,7 @@ +#/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2024 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. @@ -13,40 +14,133 @@ # 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. +#/ -# Makefile for compiling C example files. +# VARIABLES # -# Compiler settings: -CC ?= gcc +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif -# Include directories: -INCLUDE ?= -I../../../include -I$(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( '-I' + arr[i] ); }") +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= -# Compiler flags: -CFLAGS ?= -O3 -std=c99 -Wall -fPIC $(INCLUDE) +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= -# Source files: -SRCS := example.c +# List of C targets: +c_targets := example.out -# Object files: -OBJS := $(SRCS:.c=.o) -# Executable: -TARGET := example +# RULES # -# Default target: -.PHONY: all clean +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all -# Build executable: -all: $(TARGET) +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) -$(TARGET): $(OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[i] ); }") +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< -# Compile source files: -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ +.PHONY: run -# Clean generated files: +#/ +# Removes generated files. +# +# @example +# make clean +#/ clean: - rm -f $(OBJS) $(TARGET) \ No newline at end of file + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c index e99122ed7478..929a3ce20d3e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,11 @@ int main( void ) { stdlib_complex64_t dot; // Create complex arrays: - x[ 0 ] = stdlib_complex64_from_real_imag( 7.0f, -8.0f ); - x[ 1 ] = stdlib_complex64_from_real_imag( -1.0f, -9.0f ); + x[ 0 ] = stdlib_complex64( 7.0f, -8.0f ); + x[ 1 ] = stdlib_complex64( -1.0f, -9.0f ); - y[ 0 ] = stdlib_complex64_from_real_imag( 6.0f, -6.0f ); - y[ 1 ] = stdlib_complex64_from_real_imag( -9.0f, 5.0f ); + y[ 0 ] = stdlib_complex64( 6.0f, -6.0f ); + y[ 1 ] = stdlib_complex64( -9.0f, 5.0f ); // Compute the dot product: dot = c_cdotc( 2, (void *)x, 1, (void *)y, 1 ); @@ -41,4 +41,4 @@ int main( void ) { printf( "cdotc( x, y ) = %f + %fi\n", stdlib_complex64_real( dot ), stdlib_complex64_imag( dot ) ); return 0; -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js index 6ad42d3322f4..9851062d3758 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/include.gypi b/lib/node_modules/@stdlib/blas/base/cdotc/include.gypi index 2b91ef3e7ad6..dcb556d250e8 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/include.gypi +++ b/lib/node_modules/@stdlib/blas/base/cdotc/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,4 +67,4 @@ '[ 54.0, -80.0 ] */ function cdotc( N, x, strideX, offsetX, y, strideY, offsetY ) { - var conjX; - var dot; + var viewX; + var viewY; + var tr; + var ti; var ix; var iy; + var sx; + var sy; var i; - dot = new Complex64( 0, 0 ); if ( N <= 0 ) { - return dot; + return new Complex64( 0.0, 0.0 ); } - ix = offsetX; - iy = offsetY; + 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++ ) { - conjX = conj( x.get( ix ) ); - dot = add( dot, mul( conjX, y.get( iy ) ) ); - ix += strideX; - iy += strideY; + 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 dot; + return new Complex64( tr, ti ); } diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js index 354a47c54c95..cd29d8392d6b 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js @@ -21,6 +21,7 @@ // MODULES // var reinterpret = require( '@stdlib/strided/base/reinterpret-complex64' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var addon = require( './../src/addon.node' ); @@ -52,10 +53,11 @@ var addon = require( './../src/addon.node' ); function cdotc( N, x, strideX, offsetX, y, strideY, offsetY ) { var viewX = reinterpret( x, 0 ); var viewY = reinterpret( y, 0 ); - return addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY ); + var v = addon.ndarray( N, viewX, strideX, offsetX, viewY, strideY, offsetY ); + return new Complex64( v.re, v.im ); } // EXPORTS // -module.exports = cdotc; \ No newline at end of file +module.exports = cdotc; diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json b/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json index 883f976be201..fdedb20eca6f 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/cdotc/manifest.json @@ -101,7 +101,9 @@ "@stdlib/complex/float32/ctor", "@stdlib/complex/float32/base/mul", "@stdlib/complex/float32/base/add", - "@stdlib/complex/float32/conj" + "@stdlib/complex/float32/conj", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, @@ -153,7 +155,9 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/complex/float32/ctor" + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, { @@ -175,7 +179,9 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/complex/float32/ctor" + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, @@ -252,7 +258,9 @@ "@stdlib/complex/float32/ctor", "@stdlib/complex/float32/base/mul", "@stdlib/complex/float32/base/add", - "@stdlib/complex/float32/conj" + "@stdlib/complex/float32/conj", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, @@ -302,7 +310,9 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/complex/float32/ctor" + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, { @@ -323,7 +333,9 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/complex/float32/ctor" + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, @@ -375,7 +387,9 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/complex/float32/ctor" + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, { @@ -397,7 +411,9 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/complex/float32/ctor" + "@stdlib/complex/float32/ctor", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, @@ -474,7 +490,9 @@ "@stdlib/complex/float32/ctor", "@stdlib/complex/float32/base/mul", "@stdlib/complex/float32/base/add", - "@stdlib/complex/float32/conj" + "@stdlib/complex/float32/conj", + "@stdlib/complex/float32/real", + "@stdlib/complex/float32/imag" ] }, @@ -502,4 +520,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/package.json b/lib/node_modules/@stdlib/blas/base/cdotc/package.json index eaef3595f031..dacf8f6025fc 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/package.json +++ b/lib/node_modules/@stdlib/blas/base/cdotc/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/cdotc", "version": "0.0.0", - "description": "Calculate the dot product of two single-precision complex vectors.", + "description": "Calculate the dot product of two single-precision complex vectors, conjugating the first vector.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/src/addon.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c index ae62be0f9aa6..2187a0e53483 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,4 +81,4 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) { return out; } -STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) \ No newline at end of file +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c index 26124d3a2a25..1014dd49993c 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,4 +34,4 @@ stdlib_complex64_t API_SUFFIX(c_cdotc)( const CBLAS_INT N, const void *X, const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY ); return API_SUFFIX(c_cdotc_ndarray)( N, X, strideX, ox, Y, strideY, oy ); -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f index a22b105e3c0f..408d9b94a9e5 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc.f @@ -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. @@ -101,4 +101,4 @@ endif cdotc = ctemp return -end function cdotc \ No newline at end of file +end function cdotc diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c index e9ed57d3b47d..9c395b1a5a43 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_cblas.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ #include "stdlib/blas/base/cdotc.h" #include "stdlib/blas/base/cdotc_cblas.h" #include "stdlib/blas/base/shared.h" -#include "stdlib/strided/base/min-view-buffer-index.h" +#include "stdlib/strided/base/min_view_buffer_index.h" #include "stdlib/complex/float32/ctor.h" /** @@ -59,4 +59,4 @@ stdlib_complex64_t API_SUFFIX(c_cdotc_ndarray)( const CBLAS_INT N, const void *X ip2 += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); cblas_cdotc_sub( N, ip1, strideX, ip2, strideY, &dot ); return dot; -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c index 9a10c4dc0d65..69d3647099d0 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_f.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,4 +59,4 @@ stdlib_complex64_t API_SUFFIX(c_cdotc_ndarray)( const CBLAS_INT N, const void *X ip2 += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); cdotcsub( &N, ip1, &strideX, ip2, &strideY, &dot ); return dot; -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c index 305cc28d15f7..f9253e4db8a6 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotc_ndarray.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,16 +40,16 @@ stdlib_complex64_t API_SUFFIX(c_cdotc_ndarray)( const CBLAS_INT N, const void *X stdlib_complex64_t dot; stdlib_complex64_t conjX; stdlib_complex64_t xy; - int64_t ix; - int64_t iy; - int64_t i; + CBLAS_INT ix; + CBLAS_INT iy; + CBLAS_INT i; dot = stdlib_complex64_from_float32( 0.0f ); if ( N <= 0 ) { return dot; } - ix = (int64_t)offsetX; - iy = (int64_t)offsetY; + ix = offsetX; + iy = offsetY; stdlib_complex64_t *ip1 = (stdlib_complex64_t *)X; stdlib_complex64_t *ip2 = (stdlib_complex64_t *)Y; @@ -62,4 +62,4 @@ stdlib_complex64_t API_SUFFIX(c_cdotc_ndarray)( const CBLAS_INT N, const void *X iy += strideY; } return dot; -} \ No newline at end of file +} diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f index a8b9ddc87c39..9439db50e2c7 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f +++ b/lib/node_modules/@stdlib/blas/base/cdotc/src/cdotcsub.f @@ -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. @@ -31,7 +31,7 @@ subroutine cdotcsub( N, cx, strideX, cy, strideY, dot ) ! External functions: interface complex function cdotc( N, cx, strideX, cy, strideY ) - complex :: cx(*), cy(*) + complex, intent(in) :: cx(*), cy(*) integer :: strideX, strideY, N end function cdotc end interface @@ -41,9 +41,9 @@ end function cdotc complex :: dot ! .. ! Array arguments: - complex :: cx(*), cy(*) + complex, intent(in) :: cx(*), cy(*) ! .. ! Compute the dot product: dot = cdotc( N, cx, strideX, cy, strideY ) return -end subroutine cdotcsub \ No newline at end of file +end subroutine cdotcsub diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js index a11772e8cadf..ca53b9381440 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.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/cdotc/test/test.cdotc.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js index 1c5830913f00..0cb6f31ae216 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.cdotc.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -285,4 +285,4 @@ tape( 'the function supports complex access patterns', opts, function test( t ) dot = cdotc( 2, x, 2, y, -1 ); t.deepEqual( dot, expected, 'returns expected value' ); t.end(); -}); \ No newline at end of file +}); diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js index 3d88e15dccb8..d5cbd0c19aeb 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js index f551f5110e54..df5427d3d651 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js index 99ee3a7232ee..4ca8e5a6be1b 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/test/test.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -341,4 +341,4 @@ tape( 'the function supports complex access patterns', opts, function test( t ) dot = cdotc( 2, x, 2, 0, y, -1, 1 ); t.deepEqual( dot, expected, 'returns expected value' ); t.end(); -}); \ No newline at end of file +}); From 2d2434801750ebe23c27ab8beebfe4596c853bcb Mon Sep 17 00:00:00 2001 From: DhruvArvindSingh Date: Tue, 17 Mar 2026 04:55:29 +0530 Subject: [PATCH 15/17] docs: upgrade cdotc README --- .../@stdlib/blas/base/cdotc/README.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index 7d1cee2b37c2..782b8b786b48 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/README.md @@ -153,10 +153,157 @@ console.log( out ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/cdotc.h" +``` + +#### c_cdotc( N, \*X, strideX, \*Y, strideY ) + +Calculates the dot product `x^H * y` of `x` and `y`. + +```c +#include "stdlib/complex/float32/ctor.h" + +float x[] = { 7.0f, -8.0f, -1.0f, -9.0f }; +float y[] = { 6.0f, -6.0f, -9.0f, 5.0f }; + +stdlib_complex64_t out = c_cdotc( 2, (void *)x, 1, (void *)y, 1 ); +``` + +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`. + +```c +stdlib_complex64_t c_cdotc( const CBLAS_INT N, const void *X, const CBLAS_INT strideX, const void *Y, const CBLAS_INT strideY ); +``` + +#### c_cdotc_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY ) + +Calculates the dot product `x^H * y` of `x` and `y` using alternative indexing semantics. + +```c +#include "stdlib/complex/float32/ctor.h" + +float x[] = { 7.0f, -8.0f, -1.0f, -9.0f }; +float y[] = { 6.0f, -6.0f, -9.0f, 5.0f }; + +stdlib_complex64_t out = c_cdotc_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0 ); +``` + +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`. + +```c +stdlib_complex64_t c_cdotc_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 ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/cdotc.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/float32/reim.h" +#include + +int main( void ) { + // Create strided arrays of interleaved real and imaginary components: + float x[] = { 7.0f, -8.0f, -1.0f, -9.0f }; + float y[] = { 6.0f, -6.0f, -9.0f, 5.0f }; + + // Specify the number of elements: + const int N = 2; + + // Specify stride lengths: + const int strideX = 1; + const int strideY = 1; + + // Compute the dot product: + stdlib_complex64_t dot = c_cdotc( N, (void *)x, strideX, (void *)y, strideY ); + + // Print the result: + float re; + float im; + stdlib_complex64_reim( dot, &re, &im ); + printf( "cdotc( x, y ) = %f + %fi\n", re, im ); + + // Compute the dot product using alternative indexing semantics: + dot = c_cdotc_ndarray( N, (void *)x, -strideX, 1, (void *)y, strideY, 0 ); + + // Print the result: + stdlib_complex64_reim( dot, &re, &im ); + printf( "cdotc( x, y ) = %f + %fi\n", re, im ); +} +``` + +
+ + + +
+ + + @@ -175,6 +322,12 @@ console.log( out ); [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray + + +[@stdlib/blas/base/cdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/cdotu + +[@stdlib/blas/base/zdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotc + From 73f10f59d9d53f150547f12c2013dd72d477b7b7 Mon Sep 17 00:00:00 2001 From: DhruvArvindSingh Date: Wed, 18 Mar 2026 17:51:05 +0530 Subject: [PATCH 16/17] fix: copyright years --- lib/node_modules/@stdlib/blas/base/cdotc/README.md | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile | 2 +- .../@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c | 2 +- .../@stdlib/blas/base/cdotc/benchmark/fortran/Makefile | 2 +- .../blas/base/cdotc/benchmark/fortran/benchmark.length.f | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.native.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js | 2 +- lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/README.md b/lib/node_modules/@stdlib/blas/base/cdotc/README.md index 782b8b786b48..2f7d6947b6ae 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/README.md +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile index 033e371232fc..b70100bfe624 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c index 0a6f2594d3da..f45ee0c51257 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile index db884e0c019a..85dceb6ccd59 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f index 2c28a22bf21e..a2b51a6ee59a 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f +++ b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f @@ -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/cdotc/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile index 6aed70daf167..c8f8e9a1517b 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile +++ b/lib/node_modules/@stdlib/blas/base/cdotc/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2024 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/cdotc/lib/cdotc.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js index 01278fbcc6bc..5f1e0a07f087 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.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/cdotc/lib/cdotc.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.native.js index 24fab1ebb010..4bf6c3e44e7a 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/cdotc.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js index 75513172ed8e..0043d2da0022 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/lib/main.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js index da0894150706..57740ab97494 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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/cdotc/lib/native.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js index fe89f03b1719..0702e321c187 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js index d528b185de15..5d1eee66169e 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/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. diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js index cd29d8392d6b..a6023526c218 100644 --- a/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/cdotc/lib/ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 18adc3ac7459bba3a53398ae4753c25966f4a728 Mon Sep 17 00:00:00 2001 From: DhruvArvindSingh Date: Wed, 18 Mar 2026 17:57:12 +0530 Subject: [PATCH 17/17] fix: deleted c and fortran benchmark --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../blas/base/cdotc/benchmark/c/Makefile | 52 ---------- .../base/cdotc/benchmark/c/benchmark.length.c | 79 ---------------- .../base/cdotc/benchmark/fortran/Makefile | 49 ---------- .../benchmark/fortran/benchmark.length.f | 94 ------------------- 4 files changed, 274 deletions(-) delete mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile delete mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c delete mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile delete mode 100644 lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile deleted file mode 100644 index b70100bfe624..000000000000 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2026 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Makefile for compiling C benchmark files. - -# Compiler settings: -CC ?= gcc - -# Include directories: -INCLUDE ?= -I../../../include -I$(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( '-I' + arr[i] ); }") - -# Compiler flags: -CFLAGS ?= -O3 -std=c99 -Wall -fPIC $(INCLUDE) - -# Source files: -SRCS := benchmark.length.c - -# Object files: -OBJS := $(SRCS:.c=.o) - -# Executable: -TARGET := benchmark - -# Default target: -.PHONY: all clean - -# Build executable: -all: $(TARGET) - -$(TARGET): $(OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(shell node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[i] ); }") - -# Compile source files: -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -# Clean generated files: -clean: - rm -f $(OBJS) $(TARGET) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c deleted file mode 100644 index f45ee0c51257..000000000000 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/c/benchmark.length.c +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2026 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "stdlib/blas/base/cdotc.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float32/real.h" -#include "stdlib/complex/float32/imag.h" -#include -#include -#include - -#define ITERATIONS 1000000 - -/** -* Benchmarks the cdotc function. -* -* @param len - array length -* @return elapsed time in seconds -*/ -double benchmark( int len ) { - stdlib_complex64_t *x; - stdlib_complex64_t *y; - stdlib_complex64_t dot; - clock_t start; - clock_t end; - double t; - int i; - - x = (stdlib_complex64_t *)malloc( len * sizeof( stdlib_complex64_t ) ); - y = (stdlib_complex64_t *)malloc( len * sizeof( stdlib_complex64_t ) ); - - for ( i = 0; i < len; i++ ) { - x[ i ] = stdlib_complex64_from_real( (float)i ); - y[ i ] = stdlib_complex64_from_real( (float)(len - i) ); - } - - start = clock(); - for ( i = 0; i < ITERATIONS; i++ ) { - dot = c_cdotc( len, (void *)x, 1, (void *)y, 1 ); - } - end = clock(); - - t = (double)(end - start) / (double)CLOCKS_PER_SEC; - - free( x ); - free( y ); - - return t; -} - -int main( void ) { - int len; - int i; - - printf( "Benchmarking cdotc...\n" ); - - for ( i = 1; i <= 6; i++ ) { - len = 1; - len <<= i; - printf( "len=%d: %f seconds\n", len, benchmark( len ) ); - } - - return 0; -} \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile deleted file mode 100644 index 85dceb6ccd59..000000000000 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# @license Apache-2.0 -# -# Copyright (c) 2026 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Makefile for compiling Fortran benchmark files. - -# Compiler settings: -FC ?= gfortran - -# Compiler flags: -FFLAGS ?= -O3 -std=f95 -Wall -fPIC - -# Source files: -SRCS := benchmark.length.f ../../src/cdotc.f - -# Object files: -OBJS := $(SRCS:.f=.o) - -# Executable: -TARGET := benchmark - -# Default target: -.PHONY: all clean - -# Build executable: -all: $(TARGET) - -$(TARGET): $(OBJS) - $(FC) $(FFLAGS) -o $@ $^ - -# Compile source files: -%.o: %.f - $(FC) $(FFLAGS) -c $< -o $@ - -# Clean generated files: -clean: - rm -f $(OBJS) $(TARGET) \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f b/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f deleted file mode 100644 index a2b51a6ee59a..000000000000 --- a/lib/node_modules/@stdlib/blas/base/cdotc/benchmark/fortran/benchmark.length.f +++ /dev/null @@ -1,94 +0,0 @@ -!> -! @license Apache-2.0 -! -! Copyright (c) 2026 The Stdlib Authors. -! -! Licensed under the Apache License, Version 2.0 (the "License"); -! you may not use this file except in compliance with the License. -! You may obtain a copy of the License at -! -! http://www.apache.org/licenses/LICENSE-2.0 -! -! Unless required by applicable law or agreed to in writing, software -! distributed under the License is distributed on an "AS IS" BASIS, -! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -! See the License for the specific language governing permissions and -! limitations under the License. -!< - -!> -! Benchmarks the cdotc function. -! -! ## Notes -! -! * Modified version of reference BLAS level1 routine (version 3.12.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 array -! @param {integer} strideX - `cx` stride length -! @param {Array} cy - second array -! @param {integer} strideY - `cy` stride length -! @returns {complex} the dot product -!< -program benchmark - implicit none - ! .. - ! External functions: - complex :: cdotc - external cdotc - ! .. - ! Local scalars: - integer :: i, j, len - real :: start, finish - complex :: dot - ! .. - ! Local arrays: - complex, allocatable :: cx(:), cy(:) - ! .. - ! Parameters: - integer, parameter :: ITERATIONS = 1000000 - ! .. - print *, "Benchmarking cdotc..." - do i = 1, 6 - len = 2**i - allocate( cx(len) ) - allocate( cy(len) ) - do j = 1, len - cx(j) = cmplx( real(j), 0.0 ) - cy(j) = cmplx( real(len - j + 1), 0.0 ) - end do - call cpu_time( start ) - do j = 1, ITERATIONS - dot = cdotc( len, cx, 1, cy, 1 ) - end do - call cpu_time( finish ) - print *, "len=", len, ": ", finish - start, " seconds" - deallocate( cx ) - deallocate( cy ) - end do -end program benchmark \ No newline at end of file