From 73cec23275bfa063d792adb400989a5133253f88 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Thu, 23 Jan 2025 13:19:00 +0530 Subject: [PATCH 1/9] feat: add C ndarray implementation for zscal --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/base/zscal/README.md | 39 +++- .../base/zscal/benchmark/c/benchmark.length.c | 47 ++++- .../blas/base/zscal/examples/c/example.c | 10 +- .../zscal/include/stdlib/blas/base/zscal.h | 7 +- .../@stdlib/blas/base/zscal/lib/ndarray.js | 37 +--- .../blas/base/zscal/lib/ndarray.native.js | 15 +- .../@stdlib/blas/base/zscal/lib/zscal.js | 9 +- .../blas/base/zscal/lib/zscal.native.js | 8 +- .../@stdlib/blas/base/zscal/manifest.json | 46 ++++- .../@stdlib/blas/base/zscal/src/addon.c | 25 ++- .../@stdlib/blas/base/zscal/src/zscal.c | 20 +- .../@stdlib/blas/base/zscal/src/zscal_cblas.c | 28 ++- .../@stdlib/blas/base/zscal/src/zscal_f.c | 30 ++- .../blas/base/zscal/src/zscal_ndarray.c | 50 +++++ .../blas/base/zscal/test/test.ndarray.js | 145 ++++++++------ .../base/zscal/test/test.ndarray.native.js | 184 ++++++++++-------- .../blas/base/zscal/test/test.zscal.js | 87 ++++----- .../blas/base/zscal/test/test.zscal.native.js | 160 ++++++++------- 18 files changed, 596 insertions(+), 351 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c diff --git a/lib/node_modules/@stdlib/blas/base/zscal/README.md b/lib/node_modules/@stdlib/blas/base/zscal/README.md index 79e88ad10d34..b0349b1f1a14 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/README.md +++ b/lib/node_modules/@stdlib/blas/base/zscal/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2024 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. @@ -58,7 +58,7 @@ var im = imag( z ); The function has the following parameters: - **N**: number of indexed elements. -- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. +- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. - **zx**: input [`Complex128Array`][@stdlib/array/complex128]. - **strideX**: index increment for `zx`. @@ -265,6 +265,31 @@ The function accepts the following arguments: void c_zscal( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ); ``` +#### c_zscal_ndarray( N, za, \*ZX, strideX, offsetX ) + +Scales values from `ZX` by `za` using alternative indexing semantics. + +```c +#include "stdlib/complex/float64/ctor.h" + +double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; +const stdlib_complex128_t za = stdlib_complex128( 2.0, 2.0 ); + +c_zscal_ndarray( 4, za, (void *)zx, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **za**: `[in] stdlib_complex128_t` scalar constant. +- **ZX**: `[inout] void*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `ZX`. +- **offsetX**: `[in] CBLAS_INT` starting index for `ZX`. + +```c +void c_zscal_ndarray( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +``` + @@ -306,7 +331,15 @@ int main( void ) { // Print the result: for ( int i = 0; i < N; i++ ) { - printf( "zx[ %i ] = %f + %fj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + } + + // Scale the elements of the array using alternative indexing semantics: + c_zscal_ndarray( N, za, (void *)zx, -strideX, N-1 ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); } } ``` diff --git a/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c index 531a2df4e87b..6055f7f10712 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/benchmark/c/benchmark.length.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -95,7 +95,7 @@ static double rand_double( void ) { * @param len array length * @return elapsed time in seconds */ -static double benchmark( int iterations, int len ) { +static double benchmark1( int iterations, int len ) { stdlib_complex128_t za; double zx[ len*2 ]; double elapsed; @@ -122,6 +122,40 @@ static double benchmark( int iterations, int len ) { return elapsed; } +/** +* Runs a benchmark. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark2( int iterations, int len ) { + stdlib_complex128_t za; + double zx[ len*2 ]; + double elapsed; + double t; + int i; + + za = stdlib_complex128( 1.0, 0.0 ); + for ( i = 0; i < len*2; i+=2 ) { + zx[ i ] = ( rand_double()*2.0 ) - 1.0; + zx[ i+1 ] = ( rand_double()*2.0 ) - 1.0; + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + c_zscal_ndarray( len, za, (void *)zx, 1, 0 ); + if ( zx[ 0 ] != zx[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( zx[ 0 ] != zx[ 0 ] ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + /** * Main execution sequence. */ @@ -144,7 +178,14 @@ int main( void ) { for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); - elapsed = benchmark( iter, len ); + elapsed = benchmark1( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:ndarray:len=%d\n", NAME, len ); + elapsed = benchmark2( iter, len ); print_results( iter, elapsed ); printf( "ok %d benchmark finished\n", count ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c index 3ff3c69a730c..1d7b64195305 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -40,4 +40,12 @@ int main( void ) { for ( int i = 0; i < N; i++ ) { printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); } + + // Scale the elements of the array using alternative indexing semantics: + c_zscal_ndarray( N, za, (void *)zx, -strideX, N-1 ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + } } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h b/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h index 98bc1f5a1dce..0613cfee6f4e 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h +++ b/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -37,6 +37,11 @@ extern "C" { */ void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ); +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. +*/ +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ); + #ifdef __cplusplus } #endif diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js index e5c140e5fa7d..0bbc15ce594b 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -20,10 +20,7 @@ // MODULES // -var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); -var cmul = require( '@stdlib/complex/float64/base/mul' ).assign; -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); +var cmul = require( '@stdlib/complex/float64/base/mul' ); // MAIN // @@ -34,8 +31,8 @@ var imag = require( '@stdlib/complex/float64/imag' ); * @param {PositiveInteger} N - number of indexed elements * @param {Complex128} za - constant * @param {Complex128Array} zx - input array -* @param {integer} strideZX - `zx` stride length -* @param {NonNegativeInteger} offsetZX - starting `zx` index +* @param {integer} strideX - `zx` stride length +* @param {NonNegativeInteger} offsetX - starting index for `zx` * @returns {Complex128Array} input array * * @example @@ -48,35 +45,17 @@ var imag = require( '@stdlib/complex/float64/imag' ); * zscal( 3, za, zx, 1, 0 ); * // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideZX, offsetZX ) { - var view; - var re1; - var im1; - var re2; - var im2; - var sx; +function zscal( N, za, zx, strideX, offsetX ) { var ix; var i; if ( N <= 0 ) { return zx; } - // Reinterpret the input array as a real-valued array of interleaved real and imaginary components: - view = reinterpret( zx, 0 ); - - // Adjust the stride and offset: - sx = strideZX * 2; - ix = offsetZX * 2; - - // Decompose the input scalar to real and imaginary components: - re1 = real( za ); - im1 = imag( za ); - + ix = offsetX; for ( i = 0; i < N; i++ ) { - re2 = view[ ix ]; - im2 = view[ ix+1 ]; - cmul( re1, im1, re2, im2, view, 1, ix ); - ix += sx; + zx.set( cmul( za, zx.get( ix ) ), ix ); + ix += strideX; } return zx; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js index 811a84f96deb..4f4d012dec46 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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,7 +21,6 @@ // MODULES // var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); -var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' ); var addon = require( './../src/addon.node' ); @@ -33,8 +32,8 @@ var addon = require( './../src/addon.node' ); * @param {PositiveInteger} N - number of indexed elements * @param {Complex128} za - scalar constant * @param {Complex128Array} zx - input array -* @param {integer} strideZX - `zx` stride length -* @param {NonNegativeInteger} offsetZX - starting `zx` index +* @param {integer} strideX - `zx` stride length +* @param {NonNegativeInteger} offsetX - starting index for `zx` * @returns {Complex128Array} input array * * @example @@ -47,11 +46,9 @@ var addon = require( './../src/addon.node' ); * zscal( 3, za, zx, 1, 0 ); * // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideZX, offsetZX ) { - var viewZX; - offsetZX = minViewBufferIndex( N, strideZX, offsetZX ); - viewZX = reinterpret( zx, offsetZX ); - addon( N, za, viewZX, strideZX ); +function zscal( N, za, zx, strideX, offsetX ) { + var viewZX = reinterpret( zx, 0 ); + addon.ndarray( N, za, viewZX, strideX, offsetX ); return zx; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js index 0d6e54585b70..01179b209fd8 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -32,7 +32,7 @@ var ndarray = require( './ndarray.js' ); * @param {PositiveInteger} N - number of indexed elements * @param {Complex128} za - constant * @param {Complex128Array} zx - input array -* @param {integer} strideZX - `zx` stride length +* @param {integer} strideX - `zx` stride length * @returns {Complex128Array} input array * * @example @@ -45,8 +45,9 @@ var ndarray = require( './ndarray.js' ); * zscal( 3, za, zx, 1 ); * // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideZX ) { - return ndarray( N, za, zx, strideZX, stride2offset( N, strideZX ) ); +function zscal( N, za, zx, strideX ) { + var ox = stride2offset( N, strideX ); + return ndarray( N, za, zx, strideX, ox ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js index bce55a6e0eef..a6e7e8551254 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -32,7 +32,7 @@ var addon = require( './../src/addon.node' ); * @param {PositiveInteger} N - number of indexed elements * @param {Complex128} za - scalar constant * @param {Complex128Array} zx - input array -* @param {integer} strideZX - `zx` stride length +* @param {integer} strideX - `zx` stride length * @returns {Complex128Array} input array * * @example @@ -45,9 +45,9 @@ var addon = require( './../src/addon.node' ); * zscal( 3, za, zx, 1 ); * // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideZX ) { +function zscal( N, za, zx, strideX ) { var viewZX = reinterpret( zx, 0 ); - addon( N, za, viewZX, strideZX ); + addon( N, za, viewZX, strideX ); return zx; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/manifest.json b/lib/node_modules/@stdlib/blas/base/zscal/manifest.json index 506fbaac331d..c70e11170c14 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/zscal/manifest.json @@ -45,11 +45,13 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/napi/export", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-strided-complex128array", "@stdlib/napi/argv-complex128", - "@stdlib/complex/float64/ctor" + "@stdlib/complex/float64/ctor", + "@stdlib/complex/float64/base/mul" ] }, { @@ -58,7 +60,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -67,6 +70,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] @@ -77,7 +81,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -86,6 +91,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] @@ -110,6 +116,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/napi/export", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-strided-complex128array", @@ -135,6 +142,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/complex/float32/ctor" ] }, @@ -156,6 +164,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/complex/float32/ctor" ] }, @@ -177,6 +186,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/napi/export", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-strided-complex128array", @@ -190,7 +200,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -199,6 +210,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] @@ -209,7 +221,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -218,6 +231,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] @@ -241,6 +255,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/napi/export", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-strided-complex128array", @@ -265,6 +280,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/complex/float64/ctor" ] }, @@ -285,6 +301,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/complex/float64/ctor" ] }, @@ -308,6 +325,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/napi/export", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-strided-complex128array", @@ -333,6 +351,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/complex/float64/ctor" ] }, @@ -354,6 +373,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", "@stdlib/complex/float64/ctor" ] }, @@ -364,7 +384,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -374,6 +395,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/napi/export", + "@stdlib/strided/base/stride2offset", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-strided-complex128array", @@ -388,7 +410,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -397,6 +420,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] @@ -407,7 +431,8 @@ "blas": "", "wasm": false, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -416,6 +441,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] @@ -427,7 +453,8 @@ "blas": "", "wasm": true, "src": [ - "./src/zscal.c" + "./src/zscal.c", + "./src/zscal_ndarray.c" ], "include": [ "./include" @@ -436,6 +463,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/complex/float64/base/mul", "@stdlib/complex/float64/ctor" ] diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c b/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c index be50a5375b39..f6961a4803ce 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -17,6 +17,7 @@ */ #include "stdlib/blas/base/zscal.h" +#include "stdlib/blas/base/shared.h" #include "stdlib/napi/export.h" #include "stdlib/napi/argv.h" #include "stdlib/napi/argv_int64.h" @@ -37,8 +38,26 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); STDLIB_NAPI_ARGV_COMPLEX128( env, za, argv, 1 ); STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, ZX, N, strideX, argv, 2 ); - c_zscal( N, za, (void *)ZX, strideX ); + API_SUFFIX(c_zscal)( N, za, (void *)ZX, strideX ); return NULL; } -STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon_method( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 5 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 ); + STDLIB_NAPI_ARGV_COMPLEX128( env, za, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, ZX, N, strideX, argv, 2 ); + API_SUFFIX(c_zscal_ndarray)( N, za, (void *)ZX, strideX, offsetX ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c index 1e76ed849b12..4ce5d33dc771 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -20,7 +20,7 @@ #include "stdlib/blas/base/shared.h" #include "stdlib/complex/float64/ctor.h" #include "stdlib/complex/float64/base/mul.h" -#include +#include "stdlib/strided/base/stride2offset.h" /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. @@ -31,18 +31,6 @@ * @param strideX ZX stride length */ void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ) { - stdlib_complex128_t z; - CBLAS_INT i; - - uint8_t *ip1 = (uint8_t *)ZX; - int64_t is1 = 16 * strideX; - - if ( N <= 0 || strideX <= 0 ) { - return; - } - for ( i = 0; i < N; i++, ip1 += is1 ) { - z = *(stdlib_complex128_t *)ip1; - *(stdlib_complex128_t *)ip1 = stdlib_base_complex128_mul( za, z ); - } - return; + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + API_SUFFIX(c_zscal_ndarray)( N, za, ZX, strideX, ox ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c index 69d78adaa641..dd3e6f508b1d 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -30,5 +30,29 @@ * @param strideX ZX stride length */ void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ) { - cblas_zscal( N, za, ZX, strideX ); + CBLAS_INT sx = strideX; + if ( sx < 0 ) { + sx = -sx; + } + API_SUFFIX(cblas_zscal)( N, za, ZX, sx ); +} + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. +* +* @param N number of indexed elements +* @param za scalar constant +* @param ZX input array +* @param strideX ZX stride length +* @param offsetX starting index for ZX +*/ +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { + stdlib_complex128_t *zx = (stdlib_complex128_t *)ZX; + CBLAS_INT sx = strideX; + + zx += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); + if ( sx < 0 ) { + sx = -sx; + } + API_SUFFIX(cblas_zscal)( N, za, (void *)zx, sx ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c index 03ce288927b9..cac6a0fe9234 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -20,6 +20,7 @@ #include "stdlib/blas/base/zscal_fortran.h" #include "stdlib/blas/base/shared.h" #include "stdlib/complex/float64/ctor.h" +#include "stdlib/strided/base/min_view_buffer_index.h" /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. @@ -30,5 +31,30 @@ * @param strideX ZX stride length */ void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ) { - zscal( &N, &za, ZX, &strideX ); + CBLAS_INT sx = strideX; + if ( sx < 0 ) { + sx = -sx; + } + zscal( &N, &za, ZX, &sx ); } + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. +* +* @param N number of indexed elements +* @param za scalar constant +* @param ZX input array +* @param strideX ZX stride length +* @param offsetX starting index for ZX +*/ +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { + stdlib_complex128_t *zx = (stdlib_complex128_t *)ZX; + CBLAS_INT sx = strideX; + + zx += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); + if ( sx < 0 ) { + sx = -sx; + } + zscal( &N, &za, (void *)zx, &sx ); +} + diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c new file mode 100644 index 000000000000..1981a824fcfc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c @@ -0,0 +1,50 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/zscal.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/complex/float64/ctor.h" +#include "stdlib/complex/float64/base/mul.h" +#include + +/** +* Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. +* +* @param N number of indexed elements +* @param za scalar constant +* @param ZX input array +* @param strideX ZX stride length +* @param offsetX starting index for ZX +*/ +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { + stdlib_complex128_t z; + int64_t is1; + int64_t i; + + if ( N <= 0 ) { + return; + } + stdlib_complex128_t *ip1 = (stdlib_complex128_t *)ZX; + is1 = (int64_t)strideX; + ip1 += offsetX; + for ( i = 0; i < N; i++, ip1 += is1 ) { + z = *ip1; + *ip1 = stdlib_base_complex128_mul( za, z ); + } + return; +} diff --git a/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js index 4e79e1e9c50a..eb517c774330 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -29,6 +29,35 @@ var abs = require( '@stdlib/math/base/special/abs' ); var zscal = require( './../lib/ndarray.js' ); +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -44,12 +73,9 @@ tape( 'the function has an arity of 5', function test( t ) { tape( 'the function scales elements from `zx` by `za`', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.3, // 1 @@ -84,26 +110,16 @@ tape( 'the function scales elements from `zx` by `za`', function test( t ) { 2.0, 3.0 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 1.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 1.0 ); t.end(); }); tape( 'the function supports a `zx` stride', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.1, // 1 @@ -138,26 +154,60 @@ tape( 'the function supports a `zx` stride', function test( t ) { 7.0, 2.0 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 5.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 5.0 ); + t.end(); +}); + +tape( 'the function supports a negative `zx` stride', function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal( 3, za, zx, -2, 4 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); tape( 'the function supports a `zx` offset', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.1, @@ -192,26 +242,16 @@ tape( 'the function supports a `zx` offset', function test( t ) { 4.2, // 3 -4.1 // 3 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 8.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 8.0 ); t.end(); }); tape( 'the function supports a negative `zx` stride', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.1, // 3 @@ -246,15 +286,8 @@ tape( 'the function supports a negative `zx` stride', function test( t ) { 7.0, 2.0 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 5.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); @@ -295,12 +328,9 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu tape( 'the function supports complex access patterns', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.1, @@ -339,14 +369,7 @@ tape( 'the function supports complex access patterns', function test( t ) { 2.9, // 2 -0.2 // 2 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 10.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 10.0 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.native.js index 7a59816804f0..e1a375cfd691 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -38,6 +38,35 @@ var opts = { }; +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + // TESTS // tape( 'main export is a function', opts, function test( t ) { @@ -53,14 +82,11 @@ tape( 'the function has an arity of 5', opts, function test( t ) { tape( 'the function scales elements from `zx` by `za`', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; - zx = new Complex128Array( [ + zx = new Complex128Array([ 0.3, // 1 0.1, // 1 0.5, // 2 @@ -73,13 +99,13 @@ tape( 'the function scales elements from `zx` by `za`', opts, function test( t ) 3.0, 2.0, 3.0 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); zscal( 4, za, zx, 1, 0 ); viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.19, // 1 -0.17, // 1 0.2, // 2 @@ -92,29 +118,19 @@ tape( 'the function scales elements from `zx` by `za`', opts, function test( t ) 3.0, 2.0, 3.0 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 1.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 1.0 ); t.end(); }); tape( 'the function supports a `zx` stride', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; - zx = new Complex128Array( [ + zx = new Complex128Array([ 0.1, // 1 0.1, // 1 3.0, @@ -127,13 +143,13 @@ tape( 'the function supports a `zx` stride', opts, function test( t ) { -0.3, // 3 7.0, 2.0 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); zscal( 3, za, zx, 2, 0 ); viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.11, // 1 -0.03, // 1 3.0, @@ -146,29 +162,63 @@ tape( 'the function supports a `zx` stride', opts, function test( t ) { -0.19, // 3 7.0, 2.0 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 5.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 5.0 ); + t.end(); +}); + +tape( 'the function supports a negative `zx` stride', opts, function test( t ) { + var expected; + var viewX; + var za; + var zx; + + zx = new Complex128Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); + + zscal( 3, za, zx, -2, 4 ); + + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); tape( 'the function supports a `zx` offset', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; - zx = new Complex128Array( [ + zx = new Complex128Array([ 0.1, 0.1, 3.0, @@ -181,13 +231,13 @@ tape( 'the function supports a `zx` offset', opts, function test( t ) { -0.3, // 2 7.0, // 3 2.0 // 3 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); zscal( 3, za, zx, 1, 3 ); viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.1, 0.1, 3.0, @@ -200,16 +250,9 @@ tape( 'the function supports a `zx` offset', opts, function test( t ) { -0.19, // 2 4.2, // 3 -4.1 // 3 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 8.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 8.0 ); t.end(); }); @@ -248,37 +291,13 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu t.end(); }); -tape( 'if provided an `strideX` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) { - var expected; - var viewX; - var za; - var zx; - - zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - za = new Complex128( 2.0, 2.0 ); - - viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - zscal( 4, za, zx, -1, 3 ); - t.deepEqual( viewX, expected, 'returns expected value' ); - - zscal( 4, za, zx, 0, 3 ); - t.deepEqual( viewX, expected, 'returns expected value' ); - - t.end(); -}); - tape( 'the function supports complex access patterns', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; - zx = new Complex128Array( [ + zx = new Complex128Array([ 0.1, 0.1, 3.0, @@ -293,13 +312,13 @@ tape( 'the function supports complex access patterns', opts, function test( t ) 2.0, 2.0, // 2 3.0 // 2 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); zscal( 2, za, zx, 3, 3 ); viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.1, 0.1, 3.0, @@ -314,15 +333,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) 2.0, 2.9, // 2 -0.2 // 2 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 10.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 10.0 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.js b/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.js index f8feaa12b2c9..9bc8a2001a86 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -29,6 +29,35 @@ var abs = require( '@stdlib/math/base/special/abs' ); var zscal = require( './../lib/zscal.js' ); +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -44,12 +73,9 @@ tape( 'the function has an arity of 4', function test( t ) { tape( 'the function scales elements from `zx` by `za`', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.3, // 1 @@ -76,26 +102,16 @@ tape( 'the function scales elements from `zx` by `za`', function test( t ) { 0.14, // 4 0.08 // 4 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 1.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 1.0 ); t.end(); }); tape( 'the function supports a `zx` stride', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.1, // 1 @@ -130,26 +146,16 @@ tape( 'the function supports a `zx` stride', function test( t ) { 7.0, 2.0 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 5.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); tape( 'the function supports a negative `zx` stride', function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; zx = new Complex128Array([ 0.1, // 3 @@ -184,15 +190,8 @@ tape( 'the function supports a negative `zx` stride', function test( t ) { 7.0, 2.0 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 5.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); @@ -233,13 +232,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu tape( 'the function supports view offsets', function test( t ) { var expected; - var delta; var viewX; - var tol; var zx0; var zx1; var za; - var k; // Initial arrays... zx0 = new Complex128Array([ @@ -274,14 +270,7 @@ tape( 'the function supports view offsets', function test( t ) { 2.0, 3.0 ]); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 1.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + + isApprox( t, viewX, expected, 1.0 ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.native.js b/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.native.js index 0dc596643604..02510078a31e 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.native.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/test/test.zscal.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -38,6 +38,35 @@ var opts = { }; +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } +} + + // TESTS // tape( 'main export is a function', opts, function test( t ) { @@ -53,14 +82,11 @@ tape( 'the function has an arity of 4', opts, function test( t ) { tape( 'the function scales elements from `zx` by `za`', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; - zx = new Complex128Array( [ + zx = new Complex128Array([ 0.3, // 1 0.1, // 1 0.5, // 2 @@ -69,13 +95,13 @@ tape( 'the function scales elements from `zx` by `za`', opts, function test( t ) 0.5, // 3 0.0, // 4 0.2 // 4 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); zscal( 4, za, zx, 1 ); viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.19, // 1 -0.17, // 1 0.2, // 2 @@ -84,29 +110,19 @@ tape( 'the function scales elements from `zx` by `za`', opts, function test( t ) 0.2, // 3 0.14, // 4 0.08 // 4 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 1.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 1.0 ); t.end(); }); tape( 'the function supports a `zx` stride', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var za; var zx; - var k; - zx = new Complex128Array( [ + zx = new Complex128Array([ 0.1, // 1 0.1, // 1 3.0, @@ -119,13 +135,13 @@ tape( 'the function supports a `zx` stride', opts, function test( t ) { -0.3, // 3 7.0, 2.0 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); zscal( 3, za, zx, 2 ); viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.11, // 1 -0.03, // 1 3.0, @@ -138,55 +154,71 @@ tape( 'the function supports a `zx` stride', opts, function test( t ) { -0.19, // 3 7.0, 2.0 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 5.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); -tape( 'the function returns a reference to the input array', opts, function test( t ) { - var out; +tape( 'the function supports a negative `zx` stride', opts, function test( t ) { + var expected; + var viewX; var za; var zx; - zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - za = new Complex128( 2.0, 2.0 ); + zx = new Complex128Array([ + 0.1, // 3 + 0.1, // 3 + 3.0, + 6.0, + -0.6, // 2 + 0.1, // 2 + 4.0, + 7.0, + 0.1, // 1 + -0.3, // 1 + 7.0, + 2.0 + ]); + za = new Complex128( 0.4, -0.7 ); - out = zscal( 4, za, zx, 1 ); + zscal( 3, za, zx, -2 ); - t.strictEqual( out, zx, 'same reference' ); + viewX = new Float64Array( zx.buffer ); + expected = new Float64Array([ + 0.11, // 3 + -0.03, // 3 + 3.0, + 6.0, + -0.17, // 2 + 0.46, // 2 + 4.0, + 7.0, + -0.17, // 1 + -0.19, // 1 + 7.0, + 2.0 + ]); + + isApprox( t, viewX, expected, 5.0 ); t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) { - var expected; - var viewX; +tape( 'the function returns a reference to the input array', opts, function test( t ) { + var out; var za; var zx; zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); za = new Complex128( 2.0, 2.0 ); - viewX = new Float64Array( zx.buffer ); - expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - - zscal( -1, za, zx, 1 ); - t.deepEqual( viewX, expected, 'returns expected value' ); - - zscal( 0, za, zx, 1 ); - t.deepEqual( viewX, expected, 'returns expected value' ); + out = zscal( 4, za, zx, 1 ); + t.strictEqual( out, zx, 'same reference' ); t.end(); }); -tape( 'if provided an `strideX` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the input array unchanged', opts, function test( t ) { var expected; var viewX; var za; @@ -198,10 +230,10 @@ tape( 'if provided an `strideX` parameter less than or equal to `0`, the functio viewX = new Float64Array( zx.buffer ); expected = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - zscal( 4, za, zx, -1 ); + zscal( -1, za, zx, 1 ); t.deepEqual( viewX, expected, 'returns expected value' ); - zscal( 4, za, zx, 0 ); + zscal( 0, za, zx, 1 ); t.deepEqual( viewX, expected, 'returns expected value' ); t.end(); @@ -209,16 +241,13 @@ tape( 'if provided an `strideX` parameter less than or equal to `0`, the functio tape( 'the function supports view offsets', opts, function test( t ) { var expected; - var delta; var viewX; - var tol; var zx0; var zx1; var za; - var k; // Initial arrays... - zx0 = new Complex128Array( [ + zx0 = new Complex128Array([ 0.1, -0.3, 8.0, // 1 @@ -229,7 +258,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { 5.0, // 3 2.0, 3.0 - ] ); + ]); za = new Complex128( 0.4, -0.7 ); // Create offset views... @@ -238,7 +267,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { zscal( 3, za, zx1, 1 ); viewX = new Float64Array( zx0.buffer ); - expected = new Float64Array( [ + expected = new Float64Array([ 0.1, -0.3, 9.5, // 1 @@ -249,15 +278,8 @@ tape( 'the function supports view offsets', opts, function test( t ) { 0.6, // 3 2.0, 3.0 - ] ); - for ( k = 0; k < expected.length; k++ ) { - if ( viewX[ k ] === expected[ k ] ) { - t.strictEqual( viewX[ k ], expected[ k ], 'returns expected value' ); - } else { - delta = abs( viewX[ k ] - expected[ k ] ); - tol = 1.0 * EPS * abs( expected[ k ] ); - t.ok( delta <= tol, 'within tolerance. x: '+viewX[ k ]+'. expected: '+expected[ k ]+'. delta: '+delta+'. tol: '+tol+'.' ); - } - } + ]); + + isApprox( t, viewX, expected, 1.0 ); t.end(); }); From fab60bbfa350d55d69d7f5195c102bea6b44dc47 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 28 Jan 2025 08:25:49 +0530 Subject: [PATCH 2/9] refactor: revert implementation for ndarray --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/zscal/lib/ndarray.js | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js index 0bbc15ce594b..e5c140e5fa7d 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2024 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,10 @@ // MODULES // -var cmul = require( '@stdlib/complex/float64/base/mul' ); +var reinterpret = require( '@stdlib/strided/base/reinterpret-complex128' ); +var cmul = require( '@stdlib/complex/float64/base/mul' ).assign; +var real = require( '@stdlib/complex/float64/real' ); +var imag = require( '@stdlib/complex/float64/imag' ); // MAIN // @@ -31,8 +34,8 @@ var cmul = require( '@stdlib/complex/float64/base/mul' ); * @param {PositiveInteger} N - number of indexed elements * @param {Complex128} za - constant * @param {Complex128Array} zx - input array -* @param {integer} strideX - `zx` stride length -* @param {NonNegativeInteger} offsetX - starting index for `zx` +* @param {integer} strideZX - `zx` stride length +* @param {NonNegativeInteger} offsetZX - starting `zx` index * @returns {Complex128Array} input array * * @example @@ -45,17 +48,35 @@ var cmul = require( '@stdlib/complex/float64/base/mul' ); * zscal( 3, za, zx, 1, 0 ); * // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideX, offsetX ) { +function zscal( N, za, zx, strideZX, offsetZX ) { + var view; + var re1; + var im1; + var re2; + var im2; + var sx; var ix; var i; if ( N <= 0 ) { return zx; } - ix = offsetX; + // Reinterpret the input array as a real-valued array of interleaved real and imaginary components: + view = reinterpret( zx, 0 ); + + // Adjust the stride and offset: + sx = strideZX * 2; + ix = offsetZX * 2; + + // Decompose the input scalar to real and imaginary components: + re1 = real( za ); + im1 = imag( za ); + for ( i = 0; i < N; i++ ) { - zx.set( cmul( za, zx.get( ix ) ), ix ); - ix += strideX; + re2 = view[ ix ]; + im2 = view[ ix+1 ]; + cmul( re1, im1, re2, im2, view, 1, ix ); + ix += sx; } return zx; } From 517a2be2f291ebcfc6512a843aada7e4df2832ce Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 28 Jan 2025 08:28:40 +0530 Subject: [PATCH 3/9] test: remove duplicate tests --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed --- --- .../blas/base/zscal/test/test.ndarray.js | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js index eb517c774330..9eae3749bda4 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/test/test.ndarray.js @@ -247,50 +247,6 @@ tape( 'the function supports a `zx` offset', function test( t ) { t.end(); }); -tape( 'the function supports a negative `zx` stride', function test( t ) { - var expected; - var viewX; - var za; - var zx; - - zx = new Complex128Array([ - 0.1, // 3 - 0.1, // 3 - 3.0, - 6.0, - -0.6, // 2 - 0.1, // 2 - 4.0, - 7.0, - 0.1, // 1 - -0.3, // 1 - 7.0, - 2.0 - ]); - za = new Complex128( 0.4, -0.7 ); - - zscal( 3, za, zx, -2, 4 ); - - viewX = new Float64Array( zx.buffer ); - expected = new Float64Array([ - 0.11, // 3 - -0.03, // 3 - 3.0, - 6.0, - -0.17, // 2 - 0.46, // 2 - 4.0, - 7.0, - -0.17, // 1 - -0.19, // 1 - 7.0, - 2.0 - ]); - - isApprox( t, viewX, expected, 5.0 ); - t.end(); -}); - tape( 'the function returns a reference to the input array', function test( t ) { var out; var za; From 91f9d28100b4e266b63d0cf4e33fc491a5326567 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 11 Feb 2025 23:17:53 +0530 Subject: [PATCH 4/9] chore: update description --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: passed - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/base/zscal/README.md | 128 +++++----- .../@stdlib/blas/base/zscal/docs/repl.txt | 70 ++--- .../blas/base/zscal/docs/types/index.d.ts | 56 ++-- .../blas/base/zscal/docs/types/test.ts | 240 +++++++++--------- .../blas/base/zscal/examples/c/example.c | 12 +- .../@stdlib/blas/base/zscal/examples/index.js | 14 +- .../@stdlib/blas/base/zscal/lib/index.js | 16 +- .../@stdlib/blas/base/zscal/lib/ndarray.js | 32 +-- .../blas/base/zscal/lib/ndarray.native.js | 24 +- .../@stdlib/blas/base/zscal/lib/zscal.js | 18 +- .../blas/base/zscal/lib/zscal.native.js | 22 +- .../@stdlib/blas/base/zscal/src/zscal.c | 10 +- .../@stdlib/blas/base/zscal/src/zscal_cblas.c | 26 +- .../@stdlib/blas/base/zscal/src/zscal_f.c | 26 +- .../blas/base/zscal/src/zscal_ndarray.c | 14 +- 15 files changed, 354 insertions(+), 354 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/README.md b/lib/node_modules/@stdlib/blas/base/zscal/README.md index b0349b1f1a14..ce81e363e752 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/README.md +++ b/lib/node_modules/@stdlib/blas/base/zscal/README.md @@ -30,9 +30,9 @@ limitations under the License. var zscal = require( '@stdlib/blas/base/zscal' ); ``` -#### zscal( N, za, zx, strideX ) +#### zscal( N, alpha, x, strideX ) -Scales values from `zx` by `za`. +Scales values from `x` by `alpha`. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -40,12 +40,12 @@ var Complex128 = require( '@stdlib/complex/float64/ctor' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); -var zx = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); -var za = new Complex128( 2.0, 0.0 ); +var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ); +var alpha = new Complex128( 2.0, 0.0 ); -zscal( 3, za, zx, 1 ); +zscal( 3, alpha, x, 1 ); -var z = zx.get( 0 ); +var z = x.get( 0 ); // returns var re = real( z ); @@ -58,11 +58,11 @@ var im = imag( z ); The function has the following parameters: - **N**: number of indexed elements. -- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. -- **zx**: input [`Complex128Array`][@stdlib/array/complex128]. -- **strideX**: index increment for `zx`. +- **alpha**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant. +- **x**: input [`Complex128Array`][@stdlib/array/complex128]. +- **strideX**: index increment for `x`. -The `N` and stride parameters determine how values from `zx` are scaled by `za`. For example, to scale every other value in `zx` by `za`, +The `N` and stride parameters determine how values from `x` are scaled by `alpha`. For example, to scale every other value in `x` by `alpha`, ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -70,12 +70,12 @@ var Complex128 = require( '@stdlib/complex/float64/ctor' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -var za = new Complex128( 2.0, 0.0 ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var alpha = new Complex128( 2.0, 0.0 ); -zscal( 2, za, zx, 2 ); +zscal( 2, alpha, x, 2 ); -var z = zx.get( 2 ); +var z = x.get( 2 ); // returns var re = real( z ); @@ -96,18 +96,18 @@ var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); // Initial array: -var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); // Define a scalar constant: -var za = new Complex128( 2.0, 2.0 ); +var alpha = new Complex128( 2.0, 2.0 ); // Create an offset view: -var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -// Scales every other value from `zx1` by `za`... -zscal( 3, za, zx1, 1 ); +// Scales every other value from `x1` by `alpha`... +zscal( 3, alpha, x1, 1 ); -var z = zx0.get( 1 ); +var z = x0.get( 1 ); // returns var re = real( z ); @@ -117,9 +117,9 @@ var im = imag( z ); // returns 14.0 ``` -#### zscal.ndarray( N, za, zx, strideX, offsetX ) +#### zscal.ndarray( N, alpha, x, strideX, offsetX ) -Scales values from `zx` by `za` using alternative indexing semantics. +Scales values from `x` by `alpha` using alternative indexing semantics. ```javascript var Complex128Array = require( '@stdlib/array/complex128' ); @@ -127,12 +127,12 @@ var Complex128 = require( '@stdlib/complex/float64/ctor' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -var za = new Complex128( 2.0, 2.0 ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var alpha = new Complex128( 2.0, 2.0 ); -zscal.ndarray( 3, za, zx, 1, 0 ); +zscal.ndarray( 3, alpha, x, 1, 0 ); -var z = zx.get( 0 ); +var z = x.get( 0 ); // returns var re = real( z ); @@ -144,7 +144,7 @@ var im = imag( z ); The function has the following additional parameters: -- **offsetX**: starting index for `zx`. +- **offsetX**: starting index for `x`. While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to scale every other value in the input strided array starting from the second element, @@ -154,12 +154,12 @@ var Complex128 = require( '@stdlib/complex/float64/ctor' ); var real = require( '@stdlib/complex/float64/real' ); var imag = require( '@stdlib/complex/float64/imag' ); -var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -var za = new Complex128( 2.0, 2.0 ); +var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); +var alpha = new Complex128( 2.0, 2.0 ); -zscal.ndarray( 2, za, zx, 2, 1 ); +zscal.ndarray( 2, alpha, x, 2, 1 ); -var z = zx.get( 3 ); +var z = x.get( 3 ); // returns var re = real( z ); @@ -177,7 +177,7 @@ var im = imag( z ); ## Notes -- If `N <= 0` or `strideX <= 0` , both functions return `zx` unchanged. +- If `N <= 0` or `strideX <= 0` , both functions return `x` unchanged. - `zscal()` corresponds to the [BLAS][blas] level 1 function [`zscal`][zscal]. @@ -200,15 +200,15 @@ function rand() { return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -var zx = filledarrayBy( 10, 'complex128', rand ); -console.log( zx.toString() ); +var x = filledarrayBy( 10, 'complex128', rand ); +console.log( x.toString() ); -var za = new Complex128( 2.0, 2.0 ); -console.log( za.toString() ); +var alpha = new Complex128( 2.0, 2.0 ); +console.log( alpha.toString() ); -// Scales elements from `zx` by `za`: -zscal( zx.length, za, zx, 1 ); -console.log( zx.get( zx.length-1 ).toString() ); +// Scales elements from `x` by `alpha`: +zscal( x.length, alpha, x, 1 ); +console.log( x.get( x.length-1 ).toString() ); ``` @@ -241,53 +241,53 @@ console.log( zx.get( zx.length-1 ).toString() ); #include "stdlib/blas/base/zscal.h" ``` -#### c_zscal( N, za, \*ZX, strideX ) +#### c_zscal( N, alpha, \*X, strideX ) -Scales values from `ZX` by `za`. +Scales values from `X` by `alpha`. ```c #include "stdlib/complex/float64/ctor.h" -double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; -const stdlib_complex128_t za = stdlib_complex128( 2.0, 2.0 ); +double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; +const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); -c_zscal( 4, za, (void *)zx, 1 ); +c_zscal( 4, alpha, (void *)x, 1 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. -- **za**: `[in] stdlib_complex128_t` scalar constant. -- **ZX**: `[inout] void*` input array. -- **strideX**: `[in] CBLAS_INT` index increment for `ZX`. +- **alpha**: `[in] stdlib_complex128_t` scalar constant. +- **X**: `[inout] void*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. ```c -void c_zscal( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ); +void c_zscal( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX ); ``` -#### c_zscal_ndarray( N, za, \*ZX, strideX, offsetX ) +#### c_zscal_ndarray( N, alpha, \*X, strideX, offsetX ) -Scales values from `ZX` by `za` using alternative indexing semantics. +Scales values from `X` by `alpha` using alternative indexing semantics. ```c #include "stdlib/complex/float64/ctor.h" -double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; -const stdlib_complex128_t za = stdlib_complex128( 2.0, 2.0 ); +double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; +const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); -c_zscal_ndarray( 4, za, (void *)zx, 1, 0 ); +c_zscal_ndarray( 4, alpha, (void *)x, 1, 0 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. -- **za**: `[in] stdlib_complex128_t` scalar constant. -- **ZX**: `[inout] void*` input array. -- **strideX**: `[in] CBLAS_INT` index increment for `ZX`. -- **offsetX**: `[in] CBLAS_INT` starting index for `ZX`. +- **alpha**: `[in] stdlib_complex128_t` scalar constant. +- **X**: `[inout] void*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. ```c -void c_zscal_ndarray( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void c_zscal_ndarray( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); ``` @@ -315,10 +315,10 @@ void c_zscal_ndarray( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, int main( void ) { // Create a strided array of interleaved real and imaginary components: - double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; // Create a complex scalar: - const stdlib_complex128_t ca = stdlib_complex128( 2.0, 2.0 ); + const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); // Specify the number of elements: const int N = 4; @@ -327,19 +327,19 @@ int main( void ) { const int strideX = 1; // Scale the elements of the array: - c_zscal( N, za, (void *)zx, strideX ); + c_zscal( N, alpha, (void *)x, strideX ); // Print the result: for ( int i = 0; i < N; i++ ) { - printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + printf( "x[ %i ] = %lf + %lfj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); } // Scale the elements of the array using alternative indexing semantics: - c_zscal_ndarray( N, za, (void *)zx, -strideX, N-1 ); + c_zscal_ndarray( N, alpha, (void *)x, -strideX, N-1 ); // Print the result: for ( int i = 0; i < N; i++ ) { - printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + printf( "x[ %i ] = %lf + %lfj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); } } ``` diff --git a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt index b8d985781ef5..18fa1b469c38 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt @@ -1,15 +1,15 @@ -{{alias}}( N, za, zx, strideX ) +{{alias}}( N, alpha, x, strideX ) Scales a double-precision complex floating-point vector by a double- precision complex floating-point constant. - The `N` and stride parameters determine how values from `zx` are scaled by - `za`. + The `N` and stride parameters determine how values from `x` are scaled by + `alpha`. Indexing is relative to the first index. To introduce an offset, use typed array views. - If `N` or `strideX` is less than or equal to `0`, the function returns `zx` + If `N` or `strideX` is less than or equal to `0`, the function returns `x` unchanged. @@ -18,55 +18,55 @@ N: integer Number of indexed elements. - za: Complex128 + alpha: Complex128 Complex constant. - zx: Complex128Array + x: Complex128Array Input array. strideX: integer - Index increment for `zx`. + Index increment for `x`. Returns ------- - zx: Complex128Array + x: Complex128Array Input array. Examples -------- // Standard usage: - > var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); - > {{alias}}( 2, za, zx, 1 ); - > var z = zx.get( 0 ); + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > {{alias}}( 2, alpha, x, 1 ); + > var z = x.get( 0 ); > var re = {{alias:@stdlib/complex/float64/real}}( z ) -3.0 > var im = {{alias:@stdlib/complex/float64/imag}}( z ) 4.0 // Advanced indexing: - > zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 1.0 ); - > {{alias}}( 2, za, zx, 2 ); - > z = zx.get( 0 ); + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 1.0 ); + > {{alias}}( 2, alpha, x, 2 ); + > z = x.get( 0 ); > re = {{alias:@stdlib/complex/float64/real}}( z ) -1.0 > im = {{alias:@stdlib/complex/float64/imag}}( z ) 3.0 // Using typed array views: - > var zx0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > var zx1 = new {{alias:@stdlib/array/complex128}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); - > {{alias}}( 2, za, zx1, 1 ); - > z = zx0.get( 1 ); + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); + > {{alias}}( 2, alpha, x1, 1 ); + > z = x0.get( 1 ); > re = {{alias:@stdlib/complex/float64/real}}( z ) -2.0 > im = {{alias:@stdlib/complex/float64/imag}}( z ) 14.0 -{{alias}}.ndarray( N, za, zx, strideX, offsetX ) +{{alias}}.ndarray( N, alpha, x, strideX, offsetX ) Scales a double-precision complex floating-point vector by a double- precision complex floating-point constant using alternative indexing semantics. @@ -80,40 +80,40 @@ N: integer Number of indexed elements. - za: Complex128 + alpha: Complex128 Complex constant. - zx: Complex128Array + x: Complex128Array Input array. strideX: integer - Index increment for `zx`. + Index increment for `x`. offsetX: integer - Starting index for `zx`. + Starting index for `x`. Returns ------- - zx: Complex128Array + x: Complex128Array Input array. Examples -------- // Standard usage: - > var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); - > var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); - > {{alias}}.ndarray( 2, za, zx, 1, 0 ); - > var z = zx.get( 0 ); + > var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); + > {{alias}}.ndarray( 2, alpha, x, 1, 0 ); + > var z = x.get( 0 ); > var re = {{alias:@stdlib/complex/float64/real}}( z ) -2.0 > var im = {{alias:@stdlib/complex/float64/imag}}( z ) 6.0 // Advanced indexing: - > zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); - > za = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); - > {{alias}}.ndarray( 2, za, zx, 1, 2 ); - > z = zx.get( 2 ); + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); + > alpha = new {{alias:@stdlib/complex/float64/ctor}}( 1.0, 2.0 ); + > {{alias}}.ndarray( 2, alpha, x, 1, 2 ); + > z = x.get( 2 ); > re = {{alias:@stdlib/complex/float64/real}}( z ) -7.0 > im = {{alias:@stdlib/complex/float64/imag}}( z ) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/zscal/docs/types/index.d.ts index 4f6619bcb0ef..932a2a97d9f8 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/zscal/docs/types/index.d.ts @@ -31,9 +31,9 @@ interface Routine { * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N - number of indexed elements - * @param za - scalar constant - * @param zx - input array - * @param strideX - `zx` stride length + * @param alpha - scalar constant + * @param x - input array + * @param strideX - `x` stride length * @returns input array * * @example @@ -42,12 +42,12 @@ interface Routine { * var real = require( '@stdlib/complex/float64/real' ); * var imag = require( '@stdlib/complex/float64/imag' ); * - * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - * var za = new Complex128( 2.0, 2.0 ); + * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var alpha = new Complex128( 2.0, 2.0 ); * - * zscal( 3, za, zx, 1 ); + * zscal( 3, alpha, x, 1 ); * - * var z = zx.get( 0 ); + * var z = x.get( 0 ); * // returns * * var re = real( z ); @@ -56,16 +56,16 @@ interface Routine { * var im = imag( z ); * // returns 6.0 */ - ( N: number, za: Complex128, zx: Complex128Array, strideX: number ): Complex128Array; + ( N: number, alpha: Complex128, x: Complex128Array, strideX: number ): Complex128Array; /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N - number of indexed elements - * @param za - scalar constant - * @param zx - input array - * @param strideX - `zx` stride length - * @param offsetX - starting index for `zx` + * @param alpha - scalar constant + * @param x - input array + * @param strideX - `x` stride length + * @param offsetX - starting index for `x` * @returns input array * * @example @@ -74,12 +74,12 @@ interface Routine { * var real = require( '@stdlib/complex/float64/real' ); * var imag = require( '@stdlib/complex/float64/imag' ); * - * var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - * var za = new Complex128( 2.0, 2.0 ); + * var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var alpha = new Complex128( 2.0, 2.0 ); * - * zscal.ndarray( 3, za, zx, 1, 0 ); + * zscal.ndarray( 3, alpha, x, 1, 0 ); * - * var z = zx.get( 0 ); + * var z = x.get( 0 ); * // returns * * var re = real( z ); @@ -88,16 +88,16 @@ interface Routine { * var im = imag( z ); * // returns 6.0 */ - ndarray( N: number, za: Complex128, zx: Complex128Array, strideX: number, offsetX: number ): Complex128Array; + ndarray( N: number, alpha: Complex128, x: Complex128Array, strideX: number, offsetX: number ): Complex128Array; } /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N - number of indexed elements -* @param za - scalar constant -* @param zx - input array -* @param strideX - `zx` stride length +* @param alpha - scalar constant +* @param x - input array +* @param strideX - `x` stride length * @returns input array * * @example @@ -106,12 +106,12 @@ interface Routine { * var real = require( '@stdlib/complex/float64/real' ); * var imag = require( '@stdlib/complex/float64/imag' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal( 3, za, zx, 1 ); +* zscal( 3, alpha, x, 1 ); * -* var z = zx.get( 1 ); +* var z = x.get( 1 ); * // returns * * var re = real( z ); @@ -126,12 +126,12 @@ interface Routine { * var real = require( '@stdlib/complex/float64/real' ); * var imag = require( '@stdlib/complex/float64/imag' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal.ndarray( 2, za, zx, 1, 1 ); +* zscal.ndarray( 2, alpha, x, 1, 1 ); * -* var z = zx.get( 1 ); +* var z = x.get( 1 ); * // returns * * var re = real( z ); diff --git a/lib/node_modules/@stdlib/blas/base/zscal/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/zscal/docs/types/test.ts index 3a8aced11a20..f86107ce5547 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/zscal/docs/types/test.ts @@ -25,178 +25,178 @@ import zscal = require( './index' ); // The function returns a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); - zscal( zx.length, za, zx, 1 ); // $ExpectType Complex128Array + zscal( x.length, alpha, x, 1 ); // $ExpectType Complex128Array } // The compiler throws an error if the function is provided a first argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal( '10', za, zx, 1 ); // $EzxpectError - zscal( true, za, zx, 1 ); // $ExpectError - zscal( false, za, zx, 1 ); // $ExpectError - zscal( null, za, zx, 1 ); // $ExpectError - zscal( undefined, za, zx, 1 ); // $ExpectError - zscal( [], za, zx, 1 ); // $ExpectError - zscal( {}, za, zx, 1 ); // $ExpectError - zscal( ( zx: number ): number => zx, za, zx, 1 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal( '10', alpha, x, 1 ); // $ExpectError + zscal( true, alpha, x, 1 ); // $ExpectError + zscal( false, alpha, x, 1 ); // $ExpectError + zscal( null, alpha, x, 1 ); // $ExpectError + zscal( undefined, alpha, x, 1 ); // $ExpectError + zscal( [], alpha, x, 1 ); // $ExpectError + zscal( {}, alpha, x, 1 ); // $ExpectError + zscal( ( x: number ): number => x, alpha, x, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a second argument which is not a complex number... { - const zx = new Complex128Array( 10 ); - - zscal( zx.length, 10, zx, 1 ); // $ExpectError - zscal( zx.length, '10', zx, 1 ); // $ExpectError - zscal( zx.length, true, zx, 1 ); // $ExpectError - zscal( zx.length, false, zx, 1 ); // $ExpectError - zscal( zx.length, null, zx, 1 ); // $ExpectError - zscal( zx.length, undefined, zx, 1 ); // $ExpectError - zscal( zx.length, [ '1' ], zx, 1 ); // $ExpectError - zscal( zx.length, {}, zx, 1 ); // $ExpectError - zscal( zx.length, ( zx: number ): number => zx, zx, 1 ); // $ExpectError + const x = new Complex128Array( 10 ); + + zscal( x.length, 10, x, 1 ); // $ExpectError + zscal( x.length, '10', x, 1 ); // $ExpectError + zscal( x.length, true, x, 1 ); // $ExpectError + zscal( x.length, false, x, 1 ); // $ExpectError + zscal( x.length, null, x, 1 ); // $ExpectError + zscal( x.length, undefined, x, 1 ); // $ExpectError + zscal( x.length, [ '1' ], x, 1 ); // $ExpectError + zscal( x.length, {}, x, 1 ); // $ExpectError + zscal( x.length, ( x: number ): number => x, x, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a third argument which is not a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal( zx.length, za, 10, 1 ); // $ExpectError - zscal( zx.length, za, '10', 1 ); // $ExpectError - zscal( zx.length, za, true, 1 ); // $ExpectError - zscal( zx.length, za, false, 1 ); // $ExpectError - zscal( zx.length, za, null, 1 ); // $ExpectError - zscal( zx.length, za, undefined, 1 ); // $ExpectError - zscal( zx.length, za, [ '1' ], 1 ); // $ExpectError - zscal( zx.length, za, {}, 1 ); // $ExpectError - zscal( zx.length, za, ( zx: number ): number => zx, 1 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal( x.length, alpha, 10, 1 ); // $ExpectError + zscal( x.length, alpha, '10', 1 ); // $ExpectError + zscal( x.length, alpha, true, 1 ); // $ExpectError + zscal( x.length, alpha, false, 1 ); // $ExpectError + zscal( x.length, alpha, null, 1 ); // $ExpectError + zscal( x.length, alpha, undefined, 1 ); // $ExpectError + zscal( x.length, alpha, [ '1' ], 1 ); // $ExpectError + zscal( x.length, alpha, {}, 1 ); // $ExpectError + zscal( x.length, alpha, ( x: number ): number => x, 1 ); // $ExpectError } // The compiler throws an error if the function is provided a fourth argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal( zx.length, za, zx, '10' ); // $ExpectError - zscal( zx.length, za, zx, true ); // $ExpectError - zscal( zx.length, za, zx, false ); // $ExpectError - zscal( zx.length, za, zx, null ); // $ExpectError - zscal( zx.length, za, zx, undefined ); // $ExpectError - zscal( zx.length, za, zx, [] ); // $ExpectError - zscal( zx.length, za, zx, {} ); // $ExpectError - zscal( zx.length, za, zx, ( zx: number ): number => zx ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal( x.length, alpha, x, '10' ); // $ExpectError + zscal( x.length, alpha, x, true ); // $ExpectError + zscal( x.length, alpha, x, false ); // $ExpectError + zscal( x.length, alpha, x, null ); // $ExpectError + zscal( x.length, alpha, x, undefined ); // $ExpectError + zscal( x.length, alpha, x, [] ); // $ExpectError + zscal( x.length, alpha, x, {} ); // $ExpectError + zscal( x.length, alpha, x, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the function is provided an unsupported number of arguments... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); zscal(); // $ExpectError - zscal( zx.length ); // $ExpectError - zscal( zx.length, za ); // $ExpectError - zscal( zx.length, za, zx ); // $ExpectError - zscal( zx.length, za, zx, 1, 10 ); // $ExpectError + zscal( x.length ); // $ExpectError + zscal( x.length, alpha ); // $ExpectError + zscal( x.length, alpha, x ); // $ExpectError + zscal( x.length, alpha, x, 1, 10 ); // $ExpectError } // Attached to main export is an `ndarray` method which returns a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); - zscal.ndarray( zx.length, za, zx, 1, 0 ); // $ExpectType Complex128Array + zscal.ndarray( x.length, alpha, x, 1, 0 ); // $ExpectType Complex128Array } // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( '10', za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( true, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( false, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( null, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( undefined, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( [], za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( {}, za, zx, 1, 0 ); // $ExpectError - zscal.ndarray( ( zx: number ): number => zx, za, zx, 1, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( '10', alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( true, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( false, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( null, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( undefined, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( [], alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( {}, alpha, x, 1, 0 ); // $ExpectError + zscal.ndarray( ( x: number ): number => x, alpha, x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a second argument which is not a complex number... { - const zx = new Complex128Array( 10 ); - - zscal.ndarray( zx.length, 10, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, '10', zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, true, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, false, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, null, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, undefined, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, [ '1' ], zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, {}, zx, 1, 0 ); // $ExpectError - zscal.ndarray( zx.length, ( zx: number ): number => zx, zx, 1, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + + zscal.ndarray( x.length, 10, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, '10', x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, true, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, false, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, null, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, undefined, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, [ '1' ], x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, {}, x, 1, 0 ); // $ExpectError + zscal.ndarray( x.length, ( x: number ): number => x, x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a third argument which is not a Complex128Array... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal( zx.length, za, 10, 1, 0 ); // $ExpectError - zscal( zx.length, za, '10', 1, 0 ); // $ExpectError - zscal( zx.length, za, true, 1, 0 ); // $ExpectError - zscal( zx.length, za, false, 1, 0 ); // $ExpectError - zscal( zx.length, za, null, 1, 0 ); // $ExpectError - zscal( zx.length, za, undefined, 1, 0 ); // $ExpectError - zscal( zx.length, za, [ '1' ], 1, 0 ); // $ExpectError - zscal( zx.length, za, {}, 1, 0 ); // $ExpectError - zscal( zx.length, za, ( zx: number ): number => zx, 1, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal( x.length, alpha, 10, 1, 0 ); // $ExpectError + zscal( x.length, alpha, '10', 1, 0 ); // $ExpectError + zscal( x.length, alpha, true, 1, 0 ); // $ExpectError + zscal( x.length, alpha, false, 1, 0 ); // $ExpectError + zscal( x.length, alpha, null, 1, 0 ); // $ExpectError + zscal( x.length, alpha, undefined, 1, 0 ); // $ExpectError + zscal( x.length, alpha, [ '1' ], 1, 0 ); // $ExpectError + zscal( x.length, alpha, {}, 1, 0 ); // $ExpectError + zscal( x.length, alpha, ( x: number ): number => x, 1, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( zx.length, za, zx, '10', 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, true, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, false, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, null, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, undefined, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, [], 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, {}, 0 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, ( zx: number ): number => zx, 0 ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( x.length, alpha, x, '10', 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, true, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, false, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, null, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, undefined, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, [], 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, {}, 0 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, ( x: number ): number => x, 0 ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); - - zscal.ndarray( zx.length, za, zx, 1, '10' ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, true ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, false ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, null ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, undefined ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, [] ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, {} ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, ( zx: number ): number => zx ); // $ExpectError + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); + + zscal.ndarray( x.length, alpha, x, 1, '10' ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, true ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, false ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, null ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, undefined ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, [] ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, {} ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, ( x: number ): number => x ); // $ExpectError } // The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... { - const zx = new Complex128Array( 10 ); - const za = new Complex128( 2.0, 2.0 ); + const x = new Complex128Array( 10 ); + const alpha = new Complex128( 2.0, 2.0 ); zscal.ndarray(); // $ExpectError - zscal.ndarray( zx.length ); // $ExpectError - zscal.ndarray( zx.length, za ); // $ExpectError - zscal.ndarray( zx.length, za, zx ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1 ); // $ExpectError - zscal.ndarray( zx.length, za, zx, 1, 0, 10 ); // $ExpectError + zscal.ndarray( x.length ); // $ExpectError + zscal.ndarray( x.length, alpha ); // $ExpectError + zscal.ndarray( x.length, alpha, x ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1 ); // $ExpectError + zscal.ndarray( x.length, alpha, x, 1, 0, 10 ); // $ExpectError } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c index 1d7b64195305..bd25d9b15ec1 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/examples/c/example.c @@ -22,10 +22,10 @@ int main( void ) { // Create a strided array of interleaved real and imaginary components: - double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; // Create a complex scalar: - const stdlib_complex128_t za = stdlib_complex128( 2.0, 2.0 ); + const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); // Specify the number of elements: const int N = 4; @@ -34,18 +34,18 @@ int main( void ) { const int strideX = 1; // Scale the elements of the array: - c_zscal( N, za, (void *)zx, strideX ); + c_zscal( N, alpha, (void *)x, strideX ); // Print the result: for ( int i = 0; i < N; i++ ) { - printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + printf( "x[ %i ] = %lf + %lfj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); } // Scale the elements of the array using alternative indexing semantics: - c_zscal_ndarray( N, za, (void *)zx, -strideX, N-1 ); + c_zscal_ndarray( N, alpha, (void *)x, -strideX, N-1 ); // Print the result: for ( int i = 0; i < N; i++ ) { - printf( "zx[ %i ] = %lf + %lfj\n", i, zx[ i*2 ], zx[ (i*2)+1 ] ); + printf( "x[ %i ] = %lf + %lfj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); } } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/examples/index.js b/lib/node_modules/@stdlib/blas/base/zscal/examples/index.js index 9c138caf4327..36f1debbba83 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/examples/index.js @@ -27,12 +27,12 @@ function rand() { return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); } -var zx = filledarrayBy( 10, 'complex128', rand ); -console.log( zx.toString() ); +var x = filledarrayBy( 10, 'complex128', rand ); +console.log( x.toString() ); -var za = new Complex128( 2.0, 2.0 ); -console.log( za.toString() ); +var alpha = new Complex128( 2.0, 2.0 ); +console.log( alpha.toString() ); -// Scale elements from `zx` by `za`: -zscal( zx.length, za, zx, 1 ); -console.log( zx.get( zx.length-1 ).toString() ); +// Scale elements from `x` by `alpha`: +zscal( x.length, alpha, x, 1 ); +console.log( x.get( x.length-1 ).toString() ); diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/index.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/index.js index f7ec1520f674..a7d589d1f776 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/index.js @@ -28,22 +28,22 @@ * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * var zscal = require( '@stdlib/blas/base/zscal' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal( 3, za, zx, 1 ); -* // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* zscal( 3, alpha, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * var zscal = require( '@stdlib/blas/base/zscal' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal.ndarray( 3, za, zx, 1 ); -* // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* zscal.ndarray( 3, alpha, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js index e5c140e5fa7d..a9e0a2db57b9 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.js @@ -32,23 +32,23 @@ var imag = require( '@stdlib/complex/float64/imag' ); * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex128} za - constant -* @param {Complex128Array} zx - input array -* @param {integer} strideZX - `zx` stride length -* @param {NonNegativeInteger} offsetZX - starting `zx` index +* @param {Complex128} alpha - constant +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting `x` index * @returns {Complex128Array} input array * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal( 3, za, zx, 1, 0 ); -* // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* zscal( 3, alpha, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideZX, offsetZX ) { +function zscal( N, alpha, x, strideX, offsetX ) { var view; var re1; var im1; @@ -59,18 +59,18 @@ function zscal( N, za, zx, strideZX, offsetZX ) { var i; if ( N <= 0 ) { - return zx; + return x; } // Reinterpret the input array as a real-valued array of interleaved real and imaginary components: - view = reinterpret( zx, 0 ); + view = reinterpret( x, 0 ); // Adjust the stride and offset: - sx = strideZX * 2; - ix = offsetZX * 2; + sx = strideX * 2; + ix = offsetX * 2; // Decompose the input scalar to real and imaginary components: - re1 = real( za ); - im1 = imag( za ); + re1 = real( alpha ); + im1 = imag( alpha ); for ( i = 0; i < N; i++ ) { re2 = view[ ix ]; @@ -78,7 +78,7 @@ function zscal( N, za, zx, strideZX, offsetZX ) { cmul( re1, im1, re2, im2, view, 1, ix ); ix += sx; } - return zx; + return x; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js index 4f4d012dec46..f3c26a77d2d4 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/ndarray.native.js @@ -30,26 +30,26 @@ var addon = require( './../src/addon.node' ); * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex128} za - scalar constant -* @param {Complex128Array} zx - input array -* @param {integer} strideX - `zx` stride length -* @param {NonNegativeInteger} offsetX - starting index for `zx` +* @param {Complex128} alpha - scalar constant +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` * @returns {Complex128Array} input array * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal( 3, za, zx, 1, 0 ); -* // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* zscal( 3, alpha, x, 1, 0 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideX, offsetX ) { - var viewZX = reinterpret( zx, 0 ); - addon.ndarray( N, za, viewZX, strideX, offsetX ); - return zx; +function zscal( N, alpha, x, strideX, offsetX ) { + var viewZX = reinterpret( x, 0 ); + addon.ndarray( N, alpha, viewZX, strideX, offsetX ); + return x; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js index 01179b209fd8..4dc501610438 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.js @@ -30,24 +30,24 @@ var ndarray = require( './ndarray.js' ); * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex128} za - constant -* @param {Complex128Array} zx - input array -* @param {integer} strideX - `zx` stride length +* @param {Complex128} alpha - constant +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length * @returns {Complex128Array} input array * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal( 3, za, zx, 1 ); -* // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* zscal( 3, alpha, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideX ) { +function zscal( N, alpha, x, strideX ) { var ox = stride2offset( N, strideX ); - return ndarray( N, za, zx, strideX, ox ); + return ndarray( N, alpha, x, strideX, ox ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js index a6e7e8551254..67bd2abec939 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js +++ b/lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js @@ -30,25 +30,25 @@ var addon = require( './../src/addon.node' ); * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param {PositiveInteger} N - number of indexed elements -* @param {Complex128} za - scalar constant -* @param {Complex128Array} zx - input array -* @param {integer} strideX - `zx` stride length +* @param {Complex128} alpha - scalar constant +* @param {Complex128Array} x - input array +* @param {integer} strideX - `x` stride length * @returns {Complex128Array} input array * * @example * var Complex128Array = require( '@stdlib/array/complex128' ); * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * -* var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); -* var za = new Complex128( 2.0, 2.0 ); +* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var alpha = new Complex128( 2.0, 2.0 ); * -* zscal( 3, za, zx, 1 ); -* // zx => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] +* zscal( 3, alpha, x, 1 ); +* // x => [ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ] */ -function zscal( N, za, zx, strideX ) { - var viewZX = reinterpret( zx, 0 ); - addon( N, za, viewZX, strideX ); - return zx; +function zscal( N, alpha, x, strideX ) { + var viewZX = reinterpret( x, 0 ); + addon( N, alpha, viewZX, strideX ); + return x; } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c index 4ce5d33dc771..81ee73be4a0e 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal.c @@ -26,11 +26,11 @@ * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N number of indexed elements -* @param za scalar constant -* @param ZX input array -* @param strideX ZX stride length +* @param alpha scalar constant +* @param X input array +* @param strideX X stride length */ -void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ) { +void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX ) { CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); - API_SUFFIX(c_zscal_ndarray)( N, za, ZX, strideX, ox ); + API_SUFFIX(c_zscal_ndarray)( N, alpha, X, strideX, ox ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c index dd3e6f508b1d..a21b368d7085 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_cblas.c @@ -25,34 +25,34 @@ * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N number of indexed elements -* @param za scalar constant -* @param ZX input array -* @param strideX ZX stride length +* @param alpha scalar constant +* @param X input array +* @param strideX X stride length */ -void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ) { +void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX ) { CBLAS_INT sx = strideX; if ( sx < 0 ) { sx = -sx; } - API_SUFFIX(cblas_zscal)( N, za, ZX, sx ); + API_SUFFIX(cblas_zscal)( N, alpha, X, sx ); } /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. * * @param N number of indexed elements -* @param za scalar constant -* @param ZX input array -* @param strideX ZX stride length -* @param offsetX starting index for ZX +* @param alpha scalar constant +* @param X input array +* @param strideX X stride length +* @param offsetX starting index for X */ -void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { - stdlib_complex128_t *zx = (stdlib_complex128_t *)ZX; +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { + stdlib_complex128_t *x = (stdlib_complex128_t *)X; CBLAS_INT sx = strideX; - zx += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); + x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); if ( sx < 0 ) { sx = -sx; } - API_SUFFIX(cblas_zscal)( N, za, (void *)zx, sx ); + API_SUFFIX(cblas_zscal)( N, alpha, (void *)x, sx ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c index cac6a0fe9234..79f28476c51d 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_f.c @@ -26,35 +26,35 @@ * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N number of indexed elements -* @param za scalar constant -* @param ZX input array -* @param strideX ZX stride length +* @param alpha scalar constant +* @param X input array +* @param strideX X stride length */ -void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ) { +void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX ) { CBLAS_INT sx = strideX; if ( sx < 0 ) { sx = -sx; } - zscal( &N, &za, ZX, &sx ); + zscal( &N, &alpha, X, &sx ); } /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. * * @param N number of indexed elements -* @param za scalar constant -* @param ZX input array -* @param strideX ZX stride length -* @param offsetX starting index for ZX +* @param alpha scalar constant +* @param X input array +* @param strideX X stride length +* @param offsetX starting index for X */ -void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { - stdlib_complex128_t *zx = (stdlib_complex128_t *)ZX; +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { + stdlib_complex128_t *x = (stdlib_complex128_t *)X; CBLAS_INT sx = strideX; - zx += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); + x += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); if ( sx < 0 ) { sx = -sx; } - zscal( &N, &za, (void *)zx, &sx ); + zscal( &N, &alpha, (void *)x, &sx ); } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c index 1981a824fcfc..03cff9b2e9aa 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/zscal_ndarray.c @@ -26,12 +26,12 @@ * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. * * @param N number of indexed elements -* @param za scalar constant -* @param ZX input array -* @param strideX ZX stride length -* @param offsetX starting index for ZX +* @param alpha scalar constant +* @param X input array +* @param strideX X stride length +* @param offsetX starting index for X */ -void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { stdlib_complex128_t z; int64_t is1; int64_t i; @@ -39,12 +39,12 @@ void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t z if ( N <= 0 ) { return; } - stdlib_complex128_t *ip1 = (stdlib_complex128_t *)ZX; + stdlib_complex128_t *ip1 = (stdlib_complex128_t *)X; is1 = (int64_t)strideX; ip1 += offsetX; for ( i = 0; i < N; i++, ip1 += is1 ) { z = *ip1; - *ip1 = stdlib_base_complex128_mul( za, z ); + *ip1 = stdlib_base_complex128_mul( alpha, z ); } return; } From c06accfc1e15f2284b5c22cfc8e926164ccc20fd Mon Sep 17 00:00:00 2001 From: aman-095 Date: Fri, 14 Feb 2025 20:26:47 +0530 Subject: [PATCH 5/9] chore: resolve lint error --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../blas/base/zscal/include/stdlib/blas/base/zscal.h | 4 ++-- .../zscal/include/stdlib/blas/base/zscal_cblas.h | 4 ++-- lib/node_modules/@stdlib/blas/base/zscal/src/addon.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h b/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h index 0613cfee6f4e..c698445dfcaf 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h +++ b/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal.h @@ -35,12 +35,12 @@ extern "C" { /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. */ -void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ); +void API_SUFFIX(c_zscal)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX ); /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant using alternative indexing semantics. */ -void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void API_SUFFIX(c_zscal_ndarray)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal_cblas.h b/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal_cblas.h index c80d88d58980..baf490d2b00a 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal_cblas.h +++ b/lib/node_modules/@stdlib/blas/base/zscal/include/stdlib/blas/base/zscal_cblas.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. @@ -35,7 +35,7 @@ extern "C" { /** * Scales a double-precision complex floating-point vector by a double-precision complex floating-point constant. */ -void API_SUFFIX(cblas_zscal)( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX ); +void API_SUFFIX(cblas_zscal)( const CBLAS_INT N, const stdlib_complex128_t alpha, void *X, const CBLAS_INT strideX ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c b/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c index f6961a4803ce..2fe06654fee0 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/zscal/src/addon.c @@ -36,9 +36,9 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV( env, info, argv, argc, 4 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); - STDLIB_NAPI_ARGV_COMPLEX128( env, za, argv, 1 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, ZX, N, strideX, argv, 2 ); - API_SUFFIX(c_zscal)( N, za, (void *)ZX, strideX ); + STDLIB_NAPI_ARGV_COMPLEX128( env, alpha, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 2 ); + API_SUFFIX(c_zscal)( N, alpha, (void *)X, strideX ); return NULL; } @@ -54,9 +54,9 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 ); - STDLIB_NAPI_ARGV_COMPLEX128( env, za, argv, 1 ); - STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, ZX, N, strideX, argv, 2 ); - API_SUFFIX(c_zscal_ndarray)( N, za, (void *)ZX, strideX, offsetX ); + STDLIB_NAPI_ARGV_COMPLEX128( env, alpha, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_COMPLEX128ARRAY( env, X, N, strideX, argv, 2 ); + API_SUFFIX(c_zscal_ndarray)( N, alpha, (void *)X, strideX, offsetX ); return NULL; } From 0191794a7439544367b6ab4b6cbd92346410bc14 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 15 Feb 2025 20:58:27 -0800 Subject: [PATCH 6/9] docs: fix note Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/zscal/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/README.md b/lib/node_modules/@stdlib/blas/base/zscal/README.md index 183d88f3b404..eea0460061fe 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/README.md +++ b/lib/node_modules/@stdlib/blas/base/zscal/README.md @@ -127,7 +127,7 @@ zscal.ndarray( 2, alpha, x, 2, 1 ); ## Notes -- If `N <= 0` or `strideX <= 0` , both functions return `x` unchanged. +- If `N <= 0` , both functions return `x` unchanged. - `zscal()` corresponds to the [BLAS][blas] level 1 function [`zscal`][zscal]. From 96ce8ee900aeeb27f059ebf5efb2e48bf3b2ac33 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 15 Feb 2025 21:00:21 -0800 Subject: [PATCH 7/9] docs: update copy Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt index ef04aedfa434..9d08c995bf8d 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt @@ -3,7 +3,7 @@ Scales a double-precision complex floating-point vector by a double- precision complex floating-point constant. - The `N` and stride parameters determine how values from `x` are scaled by + The `N` and stride parameters determine which values from `x` are scaled by `alpha`. Indexing is relative to the first index. To introduce an offset, use typed From 3222785724af400640378a189ece4ad2ba8adc92 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 15 Feb 2025 21:01:00 -0800 Subject: [PATCH 8/9] docs: update note Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt index 9d08c995bf8d..9c12f046a89d 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt @@ -9,8 +9,7 @@ Indexing is relative to the first index. To introduce an offset, use typed array views. - If `N` or `strideX` is less than or equal to `0`, the function returns `x` - unchanged. + If `N` is less than or equal to `0`, the function returns `x` unchanged. Parameters From 6013447b5a90d5f7b0cd9fb8ce17d5ec417574d1 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 15 Feb 2025 21:08:30 -0800 Subject: [PATCH 9/9] docs: fix example Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt index 9c12f046a89d..d57f9910443e 100644 --- a/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/zscal/docs/repl.txt @@ -47,7 +47,7 @@ // Using typed array views: > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); - > var x1 = new {{alias:@stdlib/array/complex128}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 ); > {{alias}}( 2, alpha, x1, 1 ) [ -2.0, 14.0, -2.0, 22.0 ]