From c921c63c12fc09ac2849c69024a234a7fc8cdf7f Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Wed, 12 Feb 2025 22:42:44 +0530 Subject: [PATCH 1/3] feat: add /complex/float32/base/mul --- .../complex/float32/base/add/README.md | 55 ++++ .../base/add/benchmark/benchmark.asssign.js | 70 +++++ .../base/add/benchmark/benchmark.strided.js | 68 ++++ .../complex/float32/base/add/docs/repl.txt | 87 ++++++ .../float32/base/add/docs/types/index.d.ts | 102 +++++- .../float32/base/add/docs/types/test.ts | 290 ++++++++++++++++++ .../complex/float32/base/add/lib/assign.js | 55 ++++ .../complex/float32/base/add/lib/index.js | 9 + .../complex/float32/base/add/lib/strided.js | 60 ++++ .../float32/base/add/test/test.assign.js | 132 ++++++++ .../complex/float32/base/add/test/test.js | 80 +---- .../float32/base/add/test/test.main.js | 110 +++++++ .../float32/base/add/test/test.strided.js | 158 ++++++++++ .../complex/float32/base/mul/lib/assign.js | 55 ++++ .../complex/float32/base/mul/lib/index.js | 15 +- .../complex/float32/base/mul/lib/strided.js | 64 ++++ .../float32/base/mul/test/test.assign.js | 132 ++++++++ .../complex/float32/base/mul/test/test.js | 82 +---- .../float32/base/mul/test/test.main.js | 111 +++++++ .../float32/base/mul/test/test.strided.js | 158 ++++++++++ 20 files changed, 1745 insertions(+), 148 deletions(-) create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.asssign.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.strided.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/lib/assign.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/lib/strided.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/test/test.assign.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/add/test/test.strided.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/lib/assign.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/lib/strided.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/test/test.assign.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/test/test.strided.js diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/README.md b/lib/node_modules/@stdlib/complex/float32/base/add/README.md index d50e2be39cf1..ef310ca78d49 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/README.md +++ b/lib/node_modules/@stdlib/complex/float32/base/add/README.md @@ -57,6 +57,61 @@ var im = imagf( v ); // returns 5.0 ``` +#### add.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) + +Adds two single-precision complex floating-point numbers and assigns results to a provided output array. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var out = new Float32Array( 2 ); +var v = add.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); +// returns [ 3.0, 4.0 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **re1**: real component of the first complex number. +- **im1**: imaginary component of the first complex number. +- **re2**: real component of the second complex number. +- **im2**: imaginary component of the second complex number. +- **out**: output array. +- **strideOut**: stride length for `out`. +- **offsetOut**: starting index for `out`. + +#### add.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) + +Adds two single-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var z1 = new Float32Array( [ 5.0, 3.0 ] ); +var z2 = new Float32Array( [ -2.0, 1.0 ] ); +var out = new Float32Array( 2 ); + +var v = add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ); +// returns [ 3.0, 4.0 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **z1**: first complex number strided array view. +- **sz1**: stride length for `z1`. +- **oz1**: starting index for `z1`. +- **z2**: second complex number strided array view. +- **sz2**: stride length for `z2`. +- **oz2**: starting index for `z2`. +- **out**: output array. +- **so**: stride length for `out`. +- **oo**: starting index for `out`. + diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.asssign.js b/lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.asssign.js new file mode 100644 index 000000000000..e8f42f99dc54 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.asssign.js @@ -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. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Float32Array = require( '@stdlib/array/float32' ); +var pkg = require( './../package.json' ).name; +var add = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// MAIN // + +bench( pkg+':assign', function benchmark( b ) { + var out; + var re; + var im; + var N; + var i; + var j; + var k; + + N = 100; + re = uniform( N, -500.0, 500.0, options ); + im = uniform( N, -500.0, 500.0, options ); + + out = new Float32Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = i % N; + k = ( i+1 ) % N; + out = add.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( isnanf( out[ 0 ] ) || isnanf( out[ 1 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.strided.js b/lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.strided.js new file mode 100644 index 000000000000..a349a4f61936 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/benchmark/benchmark.strided.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Float32Array = require( '@stdlib/array/float32' ); +var pkg = require( './../package.json' ).name; +var add = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// MAIN // + +bench( pkg+':strided', function benchmark( b ) { + var out; + var z1; + var z2; + var N; + var i; + var j; + + N = 50; + z1 = uniform( N*2, -500.0, 500.0, options ); + z2 = uniform( N*2, -500.0, 500.0, options ); + + out = new Float32Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = ( i % N ) * 2; + out = add.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( isnanf( out[ 0 ] ) || isnanf( out[ 1 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/docs/repl.txt b/lib/node_modules/@stdlib/complex/float32/base/add/docs/repl.txt index af76c86758f6..06e0737f8493 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/docs/repl.txt +++ b/lib/node_modules/@stdlib/complex/float32/base/add/docs/repl.txt @@ -26,6 +26,93 @@ > var im = {{alias:@stdlib/complex/float32/imag}}( out ) 6.0 + +{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) + Adds two single-precision complex floating-point numbers and assigns results + to a provided output array. + + Parameters + ---------- + re1: number + Real component of the first complex number. + + im1: number + Imaginary component of the first complex number. + + re2: number + Real component of the second complex number. + + im2: number + Imaginary component of the second complex number. + + out: ArrayLikeObject + Output array. + + strideOut: integer + Stride length. + + offsetOut: integer + Starting index. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var out = new {{alias:@stdlib/array/float32}}( 2 ); + > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) + [ 3.0, 4.0 ] + + +{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) + Adds two single-precision complex floating-point numbers stored in real- + valued strided array views and assigns results to a provided strided output + array. + + Parameters + ---------- + z1: ArrayLikeObject + First complex number view. + + sz1: integer + Stride length for `z1`. + + oz1: integer + Starting index for `z1`. + + z2: ArrayLikeObject + Second complex number view. + + sz2: integer + Stride length for `z2`. + + oz2: integer + Starting index for `z2`. + + out: ArrayLikeObject + Output array. + + so: integer + Stride length for `out`. + + oo: integer + Starting index for `out`. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var z1 = new {{alias:@stdlib/array/float32}}( [ 5.0, 3.0 ] ); + > var z2 = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0 ] ); + > var out = new {{alias:@stdlib/array/float32}}( 2 ); + > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) + [ 3.0, 4.0 ] + See Also -------- diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/index.d.ts b/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/index.d.ts index c92f43197db2..3d2523147c35 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/index.d.ts @@ -21,6 +21,87 @@ /// import { Complex64 } from '@stdlib/types/complex'; +import { Collection, NumericArray } from '@stdlib/types/array'; + +/** +* Interface for adding two single-precision complex floating-point numbers. +*/ +interface Add { + /** + * Adds two single-precision complex floating-point numbers. + * + * @param z1 - complex number + * @param z2 - complex number + * @returns result + * + * @example + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * var real = require( '@stdlib/complex/float32/real' ); + * var imag = require( '@stdlib/complex/float32/imag' ); + * + * var z = new Complex64( 5.0, 3.0 ); + * // returns + * + * var out = add( z, z ); + * // returns + * + * var re = real( out ); + * // returns 10.0 + * + * var im = imag( out ); + * // returns 6.0 + */ + ( z1: Complex64, z2: Complex64 ): Complex64; + + /** + * Adds two single-precision complex floating-point numbers and assigns results to a provided output array. + * + * @param re1 - real component of the first complex number + * @param im1 - imaginary component of the first complex number + * @param re2 - real component of the second complex number + * @param im2 - imaginary component of the second complex number + * @param out - output array + * @param strideOut - stride length + * @param offsetOut - starting index + * @returns output array + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var out = new Float32Array( 2 ); + * var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); + * // returns [ 10.0, 6.0 ] + * + * var bool = ( out === v ); + * // returns true + */ + assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; + + /** + * Adds two single-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. + * + * @param z1 - first complex number view + * @param strideZ1 - stride length for `z1` + * @param offsetZ1 - starting index for `z1` + * @param z2 - second complex number view + * @param strideZ2 - stride length for `z2` + * @param offsetZ2 - starting index for `z2` + * @param out - output array + * @param strideOut - stride length for `out` + * @param offsetOut - starting index for `out` + * @returns output array + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var z1 = new Float32Array( [ 5.0, 3.0 ] ); + * var z2 = new Float32Array( [ 5.0, 3.0 ] ); + * + * var out = add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); + * // returns [ 10.0, 6.0 ] + */ + strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; +} /** * Adds two single-precision complex floating-point numbers. @@ -45,8 +126,27 @@ import { Complex64 } from '@stdlib/types/complex'; * * var im = imagf( out ); * // returns 6.0 +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var out = new Float32Array( 2 ); +* var v = add.assign( 5.0, 3.0, 5.0, 3.0, out, 1, 0 ); +* // returns [ 10.0, 6.0 ] +* +* var bool = ( out === v ); +* // returns true +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var z1 = new Float32Array( [ 5.0, 3.0 ] ); +* var z2 = new Float32Array( [ 5.0, 3.0 ] ); +* +* var out = add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); +* // returns [ 10.0, 6.0 ] */ -declare function add( z1: Complex64, z2: Complex64 ): Complex64; +declare var add: Add; // EXPORTS // diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/test.ts b/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/test.ts index ef556a9a3d20..f345b7f40acb 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/test.ts +++ b/lib/node_modules/@stdlib/complex/float32/base/add/docs/types/test.ts @@ -65,3 +65,293 @@ import add = require( './index' ); add( z ); // $ExpectError add( z, z, z ); // $ExpectError } + +// Attached to the main export is an `assign` method which returns a collection... +{ + add.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + add.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `assign` method is provided a first argument which is not a number... +{ + const out = new Float32Array( 2 ); + + add.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a second argument which is not a number... +{ + const out = new Float32Array( 2 ); + + add.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a third argument which is not a number... +{ + const out = new Float32Array( 2 ); + + add.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +{ + const out = new Float32Array( 2 ); + + add.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... +{ + add.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... +{ + const out = new Float32Array( 2 ); + + add.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... +{ + const out = new Float32Array( 2 ); + + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... +{ + const out = new Float32Array( 2 ); + + add.assign(); // $ExpectError + add.assign( 1.0 ); // $ExpectError + add.assign( 1.0, 2.0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError + add.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError +} + +// Attached to the main export is a `strided` method which returns a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + + add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + add.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + add.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a second argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a third argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( 2 ); + + add.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + + add.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + add.strided(); // $ExpectError + add.strided( z1 ); // $ExpectError + add.strided( z1, 1 ); // $ExpectError + add.strided( z1, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError + add.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError +} + diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/lib/assign.js b/lib/node_modules/@stdlib/complex/float32/base/add/lib/assign.js new file mode 100644 index 000000000000..bdf3260ceaf3 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/lib/assign.js @@ -0,0 +1,55 @@ +/** +* @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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Adds two single-precision complex floating-point numbers and assigns results to a provided output array. +* +* @param {number} re1 - real component of the first complex number +* @param {number} im1 - imaginary component of the first complex number +* @param {number} re2 - real component of the second complex number +* @param {number} im2 - imaginary component of the second complex number +* @param {Collection} out - output array +* @param {integer} strideOut - stride length +* @param {NonNegativeInteger} offsetOut - starting index +* @returns {Collection} output array +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float32Array( 2 ), 1, 0 ); +* // returns [ 3.0, 4.0 ] +*/ +function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { + out[ offsetOut ] = float64ToFloat32( re1 + re2 ); + out[ offsetOut+strideOut ] = float64ToFloat32( im1 + im2 ); + return out; +} + + +// EXPORTS // + +module.exports = assign; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/lib/index.js b/lib/node_modules/@stdlib/complex/float32/base/add/lib/index.js index d9c476391adc..071df540f25d 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/lib/index.js +++ b/lib/node_modules/@stdlib/complex/float32/base/add/lib/index.js @@ -44,7 +44,16 @@ // MODULES // +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); var main = require( './main.js' ); +var assign = require( './assign.js' ); +var strided = require( './strided.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); +setReadOnly( main, 'strided', strided ); // EXPORTS // diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/lib/strided.js b/lib/node_modules/@stdlib/complex/float32/base/add/lib/strided.js new file mode 100644 index 000000000000..6c86067df6f5 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/lib/strided.js @@ -0,0 +1,60 @@ +/** +* @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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Adds two single-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. +* +* @param {Float32Array} z1 - first complex number view +* @param {integer} strideZ1 - stride length for `z1` +* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` +* @param {Float32Array} z2 - second complex number view +* @param {integer} strideZ2 - stride length for `z2` +* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` +* @param {Collection} out - output array +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {Collection} output array +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var z1 = new Float32Array( [ 5.0, 3.0 ] ); +* var z2 = new Float32Array( [ -2.0, 1.0 ] ); +* +* var out = strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); +* // returns [ 3.0, 4.0 ] +*/ +function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len + out[ offsetOut ] = float64ToFloat32( z1[ offsetZ1 ] + z2[ offsetZ2 ] ); + out[ offsetOut+strideOut ] = float64ToFloat32( z1[ offsetZ1+strideZ1 ] + z2[ offsetZ2+strideZ2 ] ); // eslint-disable-line max-len + return out; +} + + +// EXPORTS // + +module.exports = strided; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.assign.js b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.assign.js new file mode 100644 index 000000000000..10af95f26bb6 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.assign.js @@ -0,0 +1,132 @@ +/** +* @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 isSameFloat32Array = require( '@stdlib/assert/is-same-Float32Array' ); +var Float32Array = require( '@stdlib/array/float32' ); +var add = require( './../lib/assign.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof add, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function adds two complex numbers', function test( t ) { + var expected; + var out; + var v; + + out = new Float32Array( 2 ); + v = add( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); + + expected = new Float32Array( [ 3.0, 4.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 4 ); + v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); + + expected = new Float32Array( [ 3.0, 0.0, 4.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 4 ); + v = add( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); + + expected = new Float32Array( [ 0.0, 3.0, 0.0, 4.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 4 ); + v = add( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); + + expected = new Float32Array( [ 0.0, 4.0, 0.0, 3.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { + var expected; + var out; + var v; + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, 4.0 ] ); + + v = add( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, 4.0 ] ); + + v = add( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, 4.0 ] ); + + v = add( NaN, 3.0, NaN, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ 3.0, NaN ] ); + + v = add( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ 3.0, NaN ] ); + + v = add( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ 3.0, NaN ] ); + + v = add( 5.0, NaN, -2.0, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = add( NaN, NaN, NaN, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.js b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.js index 9bd2c4813402..b6267b0d0a85 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.js +++ b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.js @@ -21,10 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); +var isMethod = require( '@stdlib/assert/is-method' ); var add = require( './../lib' ); @@ -36,75 +33,14 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function adds two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = add( z1, z2 ); - - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( isMethod( add, 'assign' ), true, 'returns expected value' ); t.end(); }); -tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( imagf( v ), 4.0, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, 1.0 ); - - v = add( z1, z2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, NaN ); - - v = add( z1, z2 ); - t.strictEqual( realf( v ), 3.0, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, NaN ); - z2 = new Complex64( NaN, NaN ); - - v = add( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - +tape( 'attached to the main export is a `strided` method', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( isMethod( add, 'strided' ), true, 'returns expected value' ); t.end(); -}); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js new file mode 100644 index 000000000000..fb1f0e6b62d7 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js @@ -0,0 +1,110 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); +var add = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof add, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function adds two complex numbers', function test( t ) { + var z1; + var z2; + var v; + + z1 = new Complex64( 5.0, 3.0 ); + z2 = new Complex64( -2.0, 1.0 ); + + v = add( z1, z2 ); + + t.strictEqual( real( v ), 3.0, 'returns expected value' ); + t.strictEqual( imag( v ), 4.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, the resulting component is `NaN`', function test( t ) { + var z1; + var z2; + var v; + + z1 = new Complex64( NaN, 3.0 ); + z2 = new Complex64( -2.0, 1.0 ); + + v = add( z1, z2 ); + t.strictEqual( isnanf( real( v ) ), true, 'returns expected value' ); + t.strictEqual( imag( v ), 4.0, 'returns expected value' ); + + z1 = new Complex64( 5.0, 3.0 ); + z2 = new Complex64( NaN, 1.0 ); + + v = add( z1, z2 ); + t.strictEqual( isnanf( real( v ) ), true, 'returns expected value' ); + t.strictEqual( imag( v ), 4.0, 'returns expected value' ); + + z1 = new Complex64( NaN, 3.0 ); + z2 = new Complex64( NaN, 1.0 ); + + v = add( z1, z2 ); + t.strictEqual( isnanf( real( v ) ), true, 'returns expected value' ); + t.strictEqual( imag( v ), 4.0, 'returns expected value' ); + + z1 = new Complex64( 5.0, NaN ); + z2 = new Complex64( -2.0, 1.0 ); + + v = add( z1, z2 ); + t.strictEqual( real( v ), 3.0, 'returns expected value' ); + t.strictEqual( isnanf( imag( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( 5.0, 3.0 ); + z2 = new Complex64( -2.0, NaN ); + + v = add( z1, z2 ); + t.strictEqual( real( v ), 3.0, 'returns expected value' ); + t.strictEqual( isnanf( imag( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( 5.0, NaN ); + z2 = new Complex64( -2.0, NaN ); + + v = add( z1, z2 ); + t.strictEqual( real( v ), 3.0, 'returns expected value' ); + t.strictEqual( isnanf( imag( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( NaN, NaN ); + z2 = new Complex64( NaN, NaN ); + + v = add( z1, z2 ); + t.strictEqual( isnanf( real( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imag( v ) ), true, 'returns expected value' ); + + t.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.strided.js b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.strided.js new file mode 100644 index 000000000000..0fe8df122ce8 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.strided.js @@ -0,0 +1,158 @@ +/** +* @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 isSameFloat32Array = require( '@stdlib/assert/is-same-float32array' ); +var Float32Array = require( '@stdlib/array/float64' ); +var add = require( './../lib/strided.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof add, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function adds two complex numbers', function test( t ) { + var expected; + var out; + var z1; + var z2; + var v; + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 2 ); + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + + expected = new Float32Array( [ 3.0, 4.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 0.0, 3.0, 0.0 ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 4 ); + v = add( z1, 2, 0, z2, 1, 0, out, 2, 0 ); + + expected = new Float32Array( [ 3.0, 0.0, 4.0, 0.0 ] ); + console.log( v ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ 0.0, -2.0, 0.0, 1.0 ] ); + out = new Float32Array( 4 ); + v = add( z1, 1, 0, z2, 2, 1, out, 2, 1 ); + + expected = new Float32Array( [ 0.0, 3.0, 0.0, 4.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 3.0, 5.0 ] ); + z2 = new Float32Array( [ 1.0, -2.0 ] ); + out = new Float32Array( 4 ); + v = add( z1, -1, 1, z2, -1, 1, out, -2, 3 ); + + expected = new Float32Array( [ 0.0, 4.0, 0.0, 3.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, the output component is `NaN`', function test( t ) { + var expected; + var out; + var z1; + var z2; + var v; + + z1 = new Float32Array( [ NaN, 3.0 ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, 4.0 ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ NaN, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, 4.0 ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ NaN, 3.0 ] ); + z2 = new Float32Array( [ NaN, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, 4.0 ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, NaN ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ 3.0, NaN ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ -2.0, NaN ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ 3.0, NaN ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, NaN ] ); + z2 = new Float32Array( [ -2.0, NaN ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ 3.0, NaN ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ NaN, NaN ] ); + z2 = new Float32Array( [ NaN, NaN ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = add( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/lib/assign.js b/lib/node_modules/@stdlib/complex/float32/base/mul/lib/assign.js new file mode 100644 index 000000000000..90f1a772dbfe --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/lib/assign.js @@ -0,0 +1,55 @@ +/** +* @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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Multiplies two single-precision complex floating-point numbers and assigns results to a provided output array. +* +* @param {number} re1 - real component of the first complex number +* @param {number} im1 - imaginary component of the first complex number +* @param {number} re2 - real component of the second complex number +* @param {number} im2 - imaginary component of the second complex number +* @param {Collection} out - output array +* @param {integer} strideOut - stride length +* @param {NonNegativeInteger} offsetOut - starting index +* @returns {Collection} output array +* +* @example +* var Float32Array = require( '@stdlib/array/float64' ); +* +* var out = assign( 5.0, 3.0, -2.0, 1.0, new Float32Array( 2 ), 1, 0 ); +* // returns [ -13.0, -1.0 ] +*/ +function assign( re1, im1, re2, im2, out, strideOut, offsetOut ) { + out[ offsetOut ] = float64ToFloat32(re1*re2) - float64ToFloat32(im1*im2); + out[ offsetOut+strideOut ] = float64ToFloat32(re1*im2) + float64ToFloat32(im1*re2); + return out; +} + + +// EXPORTS // + +module.exports = assign; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/lib/index.js b/lib/node_modules/@stdlib/complex/float32/base/mul/lib/index.js index c2c20212cabd..0e085e9f5cf1 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/lib/index.js +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2021 The Stdlib Authors. +* Copyright (c) 2018 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ /** * Multiply two single-precision complex floating-point numbers. * -* @module @stdlib/complex/float32/base/mul +* @module @stdlib/complex/float64/base/mul * * @example * var Complex64 = require( '@stdlib/complex/float32/ctor' ); @@ -47,9 +47,20 @@ // MODULES // +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); var main = require( './main.js' ); +var assign = require( './assign.js' ); +var strided = require( './strided.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); +setReadOnly( main, 'strided', strided ); // EXPORTS // module.exports = main; + +// exports: { "assign": "main.assign", "strided": "main.strided" } \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/lib/strided.js b/lib/node_modules/@stdlib/complex/float32/base/mul/lib/strided.js new file mode 100644 index 000000000000..4f8ce3078182 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/lib/strided.js @@ -0,0 +1,64 @@ +/** +* @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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Multiplies two single-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. +* +* @param {Float32Array} z1 - first complex number view +* @param {integer} strideZ1 - stride length for `z1` +* @param {NonNegativeInteger} offsetZ1 - starting index for `z1` +* @param {Float32Array} z2 - second complex number view +* @param {integer} strideZ2 - stride length for `z2` +* @param {NonNegativeInteger} offsetZ2 - starting index for `z2` +* @param {Collection} out - output array +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {Collection} output array +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var z1 = new Float32Array( [ 5.0, 3.0 ] ); +* var z2 = new Float32Array( [ -2.0, 1.0 ] ); +* +* var out = strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); +* // returns [ -13.0, -1.0 ] +*/ +function strided( z1, strideZ1, offsetZ1, z2, strideZ2, offsetZ2, out, strideOut, offsetOut ) { // eslint-disable-line max-len + var re1 = z1[ offsetZ1 ]; + var im1 = z1[ offsetZ1+strideZ1 ]; + var re2 = z2[ offsetZ2 ]; + var im2 = z2[ offsetZ2+strideZ2 ]; + out[ offsetOut ] = float64ToFloat32(re1*re2) - float64ToFloat32(im1*im2); + out[ offsetOut+strideOut ] = float64ToFloat32(re1*im2) + float64ToFloat32(im1*re2); + return out; +} + + +// EXPORTS // + +module.exports = strided; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.assign.js b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.assign.js new file mode 100644 index 000000000000..58d63a126b91 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.assign.js @@ -0,0 +1,132 @@ +/** +* @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 isSameFloat32Array = require( '@stdlib/assert/is-same-float32array' ); +var Float32Array = require( '@stdlib/array/float32' ); +var mul = require( './../lib/assign.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mul, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function multiplies two complex numbers', function test( t ) { + var expected; + var out; + var v; + + out = new Float32Array( 2 ); + v = mul( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); + + expected = new Float32Array( [ -13.0, -1.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 4 ); + v = mul( 5.0, 3.0, -2.0, 1.0, out, 2, 0 ); + + expected = new Float32Array( [ -13.0, 0.0, -1.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 4 ); + v = mul( 5.0, 3.0, -2.0, 1.0, out, 2, 1 ); + + expected = new Float32Array( [ 0.0, -13.0, 0.0, -1.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 4 ); + v = mul( 5.0, 3.0, -2.0, 1.0, out, -2, 3 ); + + expected = new Float32Array( [ 0.0, -1.0, 0.0, -13.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { + var expected; + var out; + var v; + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( NaN, 3.0, -2.0, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( 5.0, 3.0, NaN, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( NaN, 3.0, NaN, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( 5.0, NaN, -2.0, 1.0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( 5.0, 3.0, -2.0, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( 5.0, NaN, -2.0, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( NaN, NaN, NaN, NaN, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.js b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.js index 44b0e4fc1803..fd8480ae80da 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.js +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2021 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. @@ -21,10 +21,7 @@ // MODULES // var tape = require( 'tape' ); -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var Complex64 = require( '@stdlib/complex/float32/ctor' ); -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); +var isMethod = require( '@stdlib/assert/is-method' ); var mul = require( './../lib' ); @@ -36,75 +33,14 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function multiples two complex numbers', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = mul( z1, z2 ); - - t.strictEqual( realf( v ), -13.0, 'returns expected value' ); - t.strictEqual( imagf( v ), -1.0, 'returns expected value' ); - +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( isMethod( mul, 'assign' ), true, 'returns expected value' ); t.end(); }); -tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { - var z1; - var z2; - var v; - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( -2.0, 1.0 ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, 3.0 ); - z2 = new Complex64( NaN, 1.0 ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, 1.0 ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, 3.0 ); - z2 = new Complex64( -2.0, NaN ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( 5.0, NaN ); - z2 = new Complex64( -2.0, NaN ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - - z1 = new Complex64( NaN, NaN ); - z2 = new Complex64( NaN, NaN ); - - v = mul( z1, z2 ); - t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); - t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); - +tape( 'attached to the main export is a `strided` method', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( isMethod( mul, 'strided' ), true, 'returns expected value' ); t.end(); -}); +}); \ No newline at end of file diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js new file mode 100644 index 000000000000..242d666bee6b --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js @@ -0,0 +1,111 @@ + +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); +var realf = require( '@stdlib/complex/float32/real' ); +var imagf = require( '@stdlib/complex/float32/imag' ); +var mul = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mul, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function multiplies two complex numbers', function test( t ) { + var z1; + var z2; + var v; + + z1 = new Complex64( 5.0, 3.0 ); + z2 = new Complex64( -2.0, 1.0 ); + + v = mul( z1, z2 ); + + t.strictEqual( realf( v ), -13.0, 'returns expected value' ); + t.strictEqual( imagf( v ), -1.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { + var z1; + var z2; + var v; + + z1 = new Complex64( NaN, 3.0 ); + z2 = new Complex64( -2.0, 1.0 ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( 5.0, 3.0 ); + z2 = new Complex64( NaN, 1.0 ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( NaN, 3.0 ); + z2 = new Complex64( NaN, 1.0 ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( 5.0, NaN ); + z2 = new Complex64( -2.0, 1.0 ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( 5.0, 3.0 ); + z2 = new Complex64( -2.0, NaN ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( 5.0, NaN ); + z2 = new Complex64( -2.0, NaN ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + z1 = new Complex64( NaN, NaN ); + z2 = new Complex64( NaN, NaN ); + + v = mul( z1, z2 ); + t.strictEqual( isnanf( realf( v ) ), true, 'returns expected value' ); + t.strictEqual( isnanf( imagf( v ) ), true, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.strided.js b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.strided.js new file mode 100644 index 000000000000..ef43502b4a12 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.strided.js @@ -0,0 +1,158 @@ +/** +* @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 isSameFloat32Array = require( '@stdlib/assert/is-same-float32array' ); +var Float32Array = require( '@stdlib/array/float32' ); +var mul = require( './../lib/strided.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof mul, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function multiplies two complex numbers', function test( t ) { + var expected; + var out; + var z1; + var z2; + var v; + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 2 ); + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + + expected = new Float32Array( [ -13.0, -1.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 0.0, 3.0, 0.0 ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 4 ); + v = mul( z1, 2, 0, z2, 1, 0, out, 2, 0 ); + + expected = new Float32Array( [ -13.0, 0.0, -1.0, 0.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ 0.0, -2.0, 0.0, 1.0 ] ); + out = new Float32Array( 4 ); + v = mul( z1, 1, 0, z2, 2, 1, out, 2, 1 ); + + expected = new Float32Array( [ 0.0, -13.0, 0.0, -1.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 3.0, 5.0 ] ); + z2 = new Float32Array( [ 1.0, -2.0 ] ); + out = new Float32Array( 4 ); + v = mul( z1, -1, 1, z2, -1, 1, out, -2, 3 ); + + expected = new Float32Array( [ 0.0, -1.0, 0.0, -13.0 ] ); + + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if a real or imaginary component is `NaN`, all components are `NaN`', function test( t ) { + var expected; + var out; + var z1; + var z2; + var v; + + z1 = new Float32Array( [ NaN, 3.0 ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ NaN, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ NaN, 3.0 ] ); + z2 = new Float32Array( [ NaN, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, NaN ] ); + z2 = new Float32Array( [ -2.0, 1.0 ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, 3.0 ] ); + z2 = new Float32Array( [ -2.0, NaN ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ 5.0, NaN ] ); + z2 = new Float32Array( [ -2.0, NaN ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + z1 = new Float32Array( [ NaN, NaN ] ); + z2 = new Float32Array( [ NaN, NaN ] ); + out = new Float32Array( 2 ); + expected = new Float32Array( [ NaN, NaN ] ); + + v = mul( z1, 1, 0, z2, 1, 0, out, 1, 0 ); + t.strictEqual( v, out, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( out, expected ), true, 'returns expected value' ); + + t.end(); +}); \ No newline at end of file From 6ea47e54e880ff3c7e6a22ae709d6b99f5acbde3 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Wed, 12 Feb 2025 23:22:04 +0530 Subject: [PATCH 2/3] feat: add /complex/float32/base/mul --- .../complex/float32/base/mul/README.md | 59 +++- .../base/mul/benchmark/benchmark.assign.js | 70 +++++ .../base/mul/benchmark/benchmark.strided.js | 68 +++++ .../complex/float32/base/mul/docs/repl.txt | 87 ++++++ .../float32/base/mul/docs/types/index.d.ts | 105 ++++++- .../float32/base/mul/docs/types/test.ts | 289 ++++++++++++++++++ 6 files changed, 675 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.assign.js create mode 100644 lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.strided.js diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/README.md b/lib/node_modules/@stdlib/complex/float32/base/mul/README.md index 8f84c9e03136..669d007aa1be 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/README.md +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/README.md @@ -58,6 +58,61 @@ var im = imagf( v ); // returns -1.0 ``` +#### mul.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) + +Multiplies two single-precision complex floating-point numbers and assigns results to a provided output array. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var out = new Float32Array( 2 ); +var v = mul.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); +// returns [ -13.0, -1.0 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **re1**: real component of the first complex number. +- **im1**: imaginary component of the first complex number. +- **re2**: real component of the second complex number. +- **im2**: imaginary component of the second complex number. +- **out**: output array. +- **strideOut**: stride length for `out`. +- **offsetOut**: starting index for `out`. + +#### mul.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) + +Multiplies two single-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var z1 = new Float32Array( [ 5.0, 3.0 ] ); +var z2 = new Float32Array( [ -2.0, 1.0 ] ); +var out = new Float32Array( 2 ); + +var v = mul.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ); +// returns [ -13.0, -1.0 ] + +var bool = ( out === v ); +// returns true +``` + +The function supports the following parameters: + +- **z1**: first complex number strided array view. +- **sz1**: stride length for `z1`. +- **oz1**: starting index for `z1`. +- **z2**: second complex number strided array view. +- **sz2**: stride length for `z2`. +- **oz2**: starting index for `z2`. +- **out**: output array. +- **so**: stride length for `out`. +- **oo**: starting index for `out`. + @@ -212,7 +267,7 @@ int main( void ) { ## See Also -- [`@stdlib/complex/float32/base/add`][@stdlib/complex/float32/base/add]: add two single-precision complex floating-point numbers. +- [`@stdlib/complex/float64/base/add`][@stdlib/complex/float64/base/add]: add two double-precision complex floating-point numbers. - [`@stdlib/complex/float64/base/mul`][@stdlib/complex/float64/base/mul]: multiply two double-precision complex floating-point numbers. - [`@stdlib/math/base/ops/csubf`][@stdlib/math/base/ops/csubf]: subtract two single-precision complex floating-point numbers. @@ -226,7 +281,7 @@ int main( void ) { -[@stdlib/complex/float32/base/add]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32/base/add +[@stdlib/complex/float64/base/add]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/add [@stdlib/complex/float64/base/mul]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float64/base/mul diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.assign.js new file mode 100644 index 000000000000..3fdf5ef317d2 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.assign.js @@ -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. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Float32Array = require( '@stdlib/array/float32' ); +var pkg = require( './../package.json' ).name; +var mul = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// MAIN // + +bench( pkg+':assign', function benchmark( b ) { + var out; + var re; + var im; + var N; + var i; + var j; + var k; + + N = 100; + re = uniform( N, -500.0, 500.0, options ); + im = uniform( N, -500.0, 500.0, options ); + + out = new Float32Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = i % N; + k = ( i+1 ) % N; + out = mul.assign( re[ j ], im[ j ], re[ k ], im[ k ], out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( isnanf( out[ 0 ] ) || isnanf( out[ 1 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.strided.js b/lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.strided.js new file mode 100644 index 000000000000..8e8546491257 --- /dev/null +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/benchmark/benchmark.strided.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Float32Array = require( '@stdlib/array/float32' ); +var pkg = require( './../package.json' ).name; +var mul = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// MAIN // + +bench( pkg+':strided', function benchmark( b ) { + var out; + var z1; + var z2; + var N; + var i; + var j; + + N = 50; + z1 = uniform( N*2, -500.0, 500.0, options ); + z2 = uniform( N*2, -500.0, 500.0, options ); + + out = new Float32Array( 2 ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + j = ( i % N ) * 2; + out = mul.strided( z1, 1, j, z2, 1, j, out, 1, 0 ); + if ( typeof out !== 'object' ) { + b.fail( 'should return an object' ); + } + } + b.toc(); + if ( isnanf( out[ 0 ] ) || isnanf( out[ 1 ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/docs/repl.txt b/lib/node_modules/@stdlib/complex/float32/base/mul/docs/repl.txt index a8ee0375eba1..3c5a9e2bdfbc 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/docs/repl.txt +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/docs/repl.txt @@ -28,6 +28,93 @@ > var im = {{alias:@stdlib/complex/float32/imag}}( out ) -1.0 + +{{alias}}.assign( re1, im1, re2, im2, out, strideOut, offsetOut ) + Multiplies two single-precision complex floating-point numbers and assigns + results to a provided output array. + + Parameters + ---------- + re1: number + Real component of the first complex number. + + im1: number + Imaginary component of the first complex number. + + re2: number + Real component of the second complex number. + + im2: number + Imaginary component of the second complex number. + + out: ArrayLikeObject + Output array. + + strideOut: integer + Stride length. + + offsetOut: integer + Starting index. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var out = new {{alias:@stdlib/array/float32}}( 2 ); + > {{alias}}.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ) + [ -13.0, -1.0 ] + + +{{alias}}.strided( z1, sz1, oz1, z2, sz2, oz2, out, so, oo ) + Multiplies two single-precision complex floating-point numbers stored in + real-valued strided array views and assigns results to a provided strided + output array. + + Parameters + ---------- + z1: ArrayLikeObject + First complex number view. + + sz1: integer + Stride length for `z1`. + + oz1: integer + Starting index for `z1`. + + z2: ArrayLikeObject + Second complex number view. + + sz2: integer + Stride length for `z2`. + + oz2: integer + Starting index for `z2`. + + out: ArrayLikeObject + Output array. + + so: integer + Stride length for `out`. + + oo: integer + Starting index for `out`. + + Returns + ------- + out: ArrayLikeObject + Output array. + + Examples + -------- + > var z1 = new {{alias:@stdlib/array/float32}}( [ 5.0, 3.0 ] ); + > var z2 = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0 ] ); + > var out = new {{alias:@stdlib/array/float32}}( 2 ); + > {{alias}}.strided( z1, 1, 0, z2, 1, 0, out, 1, 0 ) + [ -13.0, -1.0 ] + See Also -------- diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/index.d.ts b/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/index.d.ts index 52984a05f86d..9168e4040fd2 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/index.d.ts @@ -21,6 +21,90 @@ /// import { Complex64 } from '@stdlib/types/complex'; +import { Collection, NumericArray } from '@stdlib/types/array'; + +/** +* Interface for multiplying two single-precision complex floating-point numbers. +*/ +interface Mul { + /** + * Multiplies two single-precision complex floating-point numbers. + * + * @param z1 - complex number + * @param z2 - complex number + * @returns result + * + * @example + * var Complex64 = require( '@stdlib/complex/float32/ctor' ); + * var realf = require( '@stdlib/complex/float32/real' ); + * var imagf = require( '@stdlib/complex/float32/imag' ); + * + * var z1 = new Complex64( 5.0, 3.0 ); + * // returns + * + * var z2 = new Complex64( -2.0, 1.0 ); + * // returns + * + * var out = mul( z1, z2 ); + * // returns + * + * var re = realf( out ); + * // returns -13.0 + * + * var im = imagf( out ); + * // returns -1.0 + */ + ( z1: Complex64, z2: Complex64 ): Complex64; + + /** + * Multiplies two single-precision complex floating-point numbers and assigns results to a provided output array. + * + * @param re1 - real component of the first complex number + * @param im1 - imaginary component of the first complex number + * @param re2 - real component of the second complex number + * @param im2 - imaginary component of the second complex number + * @param out - output array + * @param strideOut - stride length + * @param offsetOut - starting index + * @returns output array + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var out = new Float32Array( 2 ); + * var v = mul.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); + * // returns [ -13.0, -1.0 ] + * + * var bool = ( out === v ); + * // returns true + */ + assign>( re1: number, im1: number, re2: number, im2: number, out: T, strideOut: number, offsetOut: number ): T; + + /** + * Multiplies two single-precision complex floating-point numbers stored in real-valued strided array views and assigns results to a provided strided output array. + * + * @param z1 - first complex number view + * @param strideZ1 - stride length for `z1` + * @param offsetZ1 - starting index for `z1` + * @param z2 - second complex number view + * @param strideZ2 - stride length for `z2` + * @param offsetZ2 - starting index for `z2` + * @param out - output array + * @param strideOut - stride length for `out` + * @param offsetOut - starting index for `out` + * @returns output array + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var z1 = new Float32Array( [ 5.0, 3.0 ] ); + * var z2 = new Float32Array( [ -2.0, 1.0 ] ); + * + * var out = mul.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); + * // returns [ -13.0, -1.0 ] + */ + strided, U extends NumericArray | Collection, V extends NumericArray | Collection>( z1: T, strideZ1: number, offsetZ1: number, z2: U, strideZ2: number, offsetZ2: number, out: V, strideOut: number, offsetOut: number ): V; +} /** * Multiplies two single-precision complex floating-point numbers. @@ -48,8 +132,27 @@ import { Complex64 } from '@stdlib/types/complex'; * * var im = imagf( out ); * // returns -1.0 +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var out = new Float32Array( 2 ); +* var v = mul.assign( 5.0, 3.0, -2.0, 1.0, out, 1, 0 ); +* // returns [ -13.0, -1.0 ] +* +* var bool = ( out === v ); +* // returns true +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var z1 = new Float32Array( [ 5.0, 3.0 ] ); +* var z2 = new Float32Array( [ -2.0, 1.0 ] ); +* +* var out = mul.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); +* // returns [ -13.0, -1.0 ] */ -declare function mul( z1: Complex64, z2: Complex64 ): Complex64; +declare var mul: Mul; // EXPORTS // diff --git a/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/test.ts b/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/test.ts index d34fb1ca3702..ce93cfc6dd32 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/test.ts +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/docs/types/test.ts @@ -1,3 +1,4 @@ + /* * @license Apache-2.0 * @@ -65,3 +66,291 @@ import mul = require( './index' ); mul( z ); // $ExpectError mul( z, z, z ); // $ExpectError } + +// Attached to the main export is an `assign` method which returns a collection... +{ + mul.assign( 1.0, 1.0, 1.0, 1.0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + mul.assign( 1.0, 1.0, 1.0, 1.0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `assign` method is provided a first argument which is not a number... +{ + const out = new Float32Array( 2 ); + + mul.assign( true, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( false, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( null, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( undefined, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( '5', 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( [], 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( {}, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( ( x: number ): number => x, 2.0, 3.0, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a second argument which is not a number... +{ + const out = new Float32Array( 2 ); + + mul.assign( 1.0, true, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, false, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, null, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, undefined, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, '5', 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, [], 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, {}, 3.0, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, ( x: number ): number => x, 3.0, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a third argument which is not a number... +{ + const out = new Float32Array( 2 ); + + mul.assign( 1.0, 2.0, true, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, false, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, null, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, undefined, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, '5', 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, [], 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, {}, 4.0, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, ( x: number ): number => x, 4.0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number... +{ + const out = new Float32Array( 2 ); + + mul.assign( 1.0, 2.0, 3.0, true, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, false, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, null, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, undefined, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, '5', out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, [], out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, {}, out, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a fifth argument which is not a collection... +{ + mul.assign( 1.0, 2.0, 3.0, 4.0, 1, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, true, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, false, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, null, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, undefined, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, '5', 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, [ '5' ], 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, {}, 1, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number... +{ + const out = new Float32Array( 2 ); + + mul.assign( 1.0, 2.0, 3.0, 4.0, out, true, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, false, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, null, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, undefined, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, '5', 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, [], 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, {}, 0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a seventh argument which is not a number... +{ + const out = new Float32Array( 2 ); + + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, true ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, false ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, null ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, undefined ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, '5' ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, [] ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, {} ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided an unsupported number of arguments... +{ + const out = new Float32Array( 2 ); + + mul.assign(); // $ExpectError + mul.assign( 1.0 ); // $ExpectError + mul.assign( 1.0, 2.0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1 ); // $ExpectError + mul.assign( 1.0, 2.0, 3.0, 4.0, out, 1, 0, {} ); // $ExpectError +} + +// Attached to the main export is a `strided` method which returns a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + + mul.strided( z1, 1, 0, z2, 1, 0, new Float32Array( 2 ), 1, 0 ); // $ExpectType Float32Array + mul.strided( z1, 1, 0, z2, 1, 0, [ 0.0, 0.0 ], 1, 0 ); // $ExpectType number[] +} + +// The compiler throws an error if the `strided` method is provided a first argument which is not a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( true, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( false, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( null, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( undefined, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( '5', 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( [ '5' ], 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( {}, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( ( x: number ): number => x, 1, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a second argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( z1, true, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, false, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, null, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, undefined, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, '5', 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, [], 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, {}, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, ( x: number ): number => x, 0, z2, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a third argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( 2 ); + + mul.strided( z1, 1, true, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, false, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, null, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, undefined, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, '5', z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, [], z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, {}, z2, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, ( x: number ): number => x, z2, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a fourth argument which is not a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( z1, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, undefined, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, [ '5' ], 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a fifth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( z1, 1, 0, z2, true, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, false, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, null, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, undefined, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, '5', 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, [], 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, {}, 0, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a sixth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( z1, 1, 0, z2, 1, true, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, false, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, null, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, undefined, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, '5', out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, [], out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, {}, out, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a seventh argument which is not a collection... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + + mul.strided( z1, 1, 0, z2, 1, 0, 1, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, true, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, false, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, null, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, undefined, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, '5', 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, [ '5' ], 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, {}, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided an eighth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( z1, 1, 0, z2, 1, 0, out, true, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, false, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, null, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, undefined, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, '5', 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, [], 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, {}, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided a ninth argument which is not a number... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, true ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, false ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, null ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, undefined ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, '5' ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, [] ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, {} ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `strided` method is provided an unsupported number of arguments... +{ + const z1 = new Float32Array( 2 ); + const z2 = new Float32Array( z1.length ); + const out = new Float32Array( z2.length ); + + mul.strided(); // $ExpectError + mul.strided( z1 ); // $ExpectError + mul.strided( z1, 1 ); // $ExpectError + mul.strided( z1, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1 ); // $ExpectError + mul.strided( z1, 1, 0, z2, 1, 0, out, 1, 0, {} ); // $ExpectError +} From 169e9a4334eb2037ce40a223f4c5ae7ac57f6b3a Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:56:09 +0000 Subject: [PATCH 3/3] chore: update copyright years --- .../@stdlib/complex/float32/base/add/test/test.main.js | 2 +- .../@stdlib/complex/float32/base/mul/test/test.main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js index fb1f0e6b62d7..56d30ef98aee 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js +++ b/lib/node_modules/@stdlib/complex/float32/base/add/test/test.main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 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/complex/float32/base/mul/test/test.main.js b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js index 242d666bee6b..b6f35c84a4d4 100644 --- a/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js +++ b/lib/node_modules/@stdlib/complex/float32/base/mul/test/test.main.js @@ -2,7 +2,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 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.