From 2e1edb976ee32eefbf0432a9b9ec1f146093b798 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sat, 27 Apr 2024 16:40:04 +0530 Subject: [PATCH 01/26] feat: add BLAS routine for scabs1 --- .../@stdlib/blas/base/scabs1/README.md | 91 ++++ .../blas/base/scabs1/benchmark/benchmark.js | 63 +++ .../base/scabs1/benchmark/benchmark.native.js | 68 +++ .../blas/base/scabs1/benchmark/c/Makefile | 146 +++++++ .../scabs1/benchmark/c/benchmark.length.c | 150 +++++++ .../base/scabs1/benchmark/fortran/Makefile | 141 ++++++ .../benchmark/fortran/benchmark.length.f | 205 +++++++++ .../@stdlib/blas/base/scabs1/binding.gyp | 265 ++++++++++++ .../@stdlib/blas/base/scabs1/docs/repl.txt | 22 + .../blas/base/scabs1/docs/types/index.d.ts | 44 ++ .../blas/base/scabs1/docs/types/test.ts | 45 ++ .../blas/base/scabs1/examples/c/Makefile | 146 +++++++ .../blas/base/scabs1/examples/c/example.c | 43 ++ .../blas/base/scabs1/examples/index.js | 34 ++ .../@stdlib/blas/base/scabs1/include.gypi | 70 +++ .../scabs1/include/stdlib/blas/base/scabs1.h | 44 ++ .../include/stdlib/blas/base/scabs1_fortran.h | 43 ++ .../include/stdlib/blas/base/scabs_cblas.h | 43 ++ .../@stdlib/blas/base/scabs1/lib/index.js | 41 ++ .../@stdlib/blas/base/scabs1/lib/main.js | 49 +++ .../@stdlib/blas/base/scabs1/lib/native.js | 47 ++ .../@stdlib/blas/base/scabs1/manifest.json | 409 ++++++++++++++++++ .../@stdlib/blas/base/scabs1/package.json | 72 +++ .../@stdlib/blas/base/scabs1/src/Makefile | 70 +++ .../@stdlib/blas/base/scabs1/src/addon.c | 22 + .../@stdlib/blas/base/scabs1/src/scabs1.c | 43 ++ .../@stdlib/blas/base/scabs1/src/scabs1.f | 65 +++ .../blas/base/scabs1/src/scabs1_cblas.c | 31 ++ .../@stdlib/blas/base/scabs1/src/scabs1_f.c | 33 ++ .../@stdlib/blas/base/scabs1/src/scabs1sub.f | 41 ++ .../@stdlib/blas/base/scabs1/test/test.js | 79 ++++ .../blas/base/scabs1/test/test.native.js | 88 ++++ 32 files changed, 2753 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/benchmark.length.f create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs_cblas.h create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/README.md b/lib/node_modules/@stdlib/blas/base/scabs1/README.md new file mode 100644 index 000000000000..0c04459bf786 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/README.md @@ -0,0 +1,91 @@ + + +# scabs1 + +> Compute the sum of the [absolute value][absolute-value] of the real part and imaginary part of a single-precision [complex][@stdlib/complex/float32] floating-point number. + +
+ +## Usage + +```javascript +var scabs1 = require( '@stdlib/blas/base/scabs1' ); +``` + +#### scabs1( z ) + +Computes the sum of the [absolute value][absolute-value] of the real part and imaginary part of a single-precision [complex][@stdlib/complex/float32] floating-point number. + +```javascript +var Complex64 = require( '@stdlib/complex/float32' ); + +var y = scabs1( new Complex64( 5.0, 3.0 ) ); +// returns 8.0 +``` + +
+ + + +
+ +## Examples + + + + + +```javascript +var Complex64 = require( '@stdlib/complex/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var scabs1 = require( '@stdlib/blas/base/scabs1' ); + +var z; +var i; +for ( i = 0; i < 100; i++ ) { + z = new Complex64( discreteUniform( -50, 50 ), discreteUniform( -50, 50 ) ); + console.log( 'scabs1(%s) = %d', z.toString(), scabs1( z ) ); +} +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js new file mode 100644 index 000000000000..4dffd96ae951 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex64 = require( '@stdlib/complex/float32' ); +var pkg = require( './../package.json' ).name; +var scabs1 = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var y; + var i; + + values = [ + new Complex64( uniform( -500.0, 500.0, options ), uniform( -500.0, 500.0, options ) ), // eslint-disable-line max-len + new Complex64( uniform( -500.0, 500.0, options ), uniform( -500.0, 500.0, options ) ) // eslint-disable-line max-len + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = scabs1( values[ i%values.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js new file mode 100644 index 000000000000..9a8cd463b7c9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js @@ -0,0 +1,68 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex64 = require( '@stdlib/complex/float32' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var scabs1 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( scabs1 instanceof Error ) +}; +var options = { + 'dtype': 'float32' +}; + + +// MAIN // + +bench( pkg+'::native', opts, function benchmark( b ) { + var values; + var y; + var i; + + values = [ + new Complex64( uniform( -500.0, 500.0, options ), uniform( -500.0, 500.0, options ) ), // eslint-disable-line max-len + new Complex64( uniform( -500.0, 500.0, options ), uniform( -500.0, 500.0, options ) ) // eslint-disable-line max-len + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + y = scabs1( values[ i%values.length ] ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/Makefile new file mode 100644 index 000000000000..9f97140e7cb0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.length.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..dd0dc2e01cbc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c @@ -0,0 +1,150 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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. +*/ + +/** +* Benchmark `scabs1`. +*/ +#include "stdlib/blas/base/scabs1.h" +#include "stdlib/complex/float32.h" +#include +#include +#include +#include +#include + +#define NAME "scabs1" +#define ITERATIONS 10000000 +#define REPEATS 3 +#define MIN 1 +#define MAX 6 + +/** +* Prints the TAP version. +*/ +void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param iterations number of iterations +* @param elapsed elapsed time in seconds +*/ +void print_results( int iterations, double elapsed ) { + double rate = (double)iterations / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", iterations ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [0,1]. +* +* @return random number +*/ +float rand_float( void ) { + int r = rand(); + return (float)r / ( (float)RAND_MAX + 1.0f ); +} + +/** +* Runs a benchmark. +* +* @param iterations number of iterations +* @return elapsed time in seconds +*/ +double benchmark( int iterations ) { + stdlib_complex64_t c; + double elapsed; + double t; + float y; + int i; + + c = stdlib_complex64( rand_float()*50.0f, rand_float()*50.0f ); + y = 0.0f; + t = tic(); + for ( i = 0; i < iterations; i++ ) { + y = c_scabs1( c ); + if ( y != y ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y != y ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int count; + int iter; + int i; + int j; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + count = 0; + for ( i = MIN; i <= MAX; i++ ) { + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s", NAME ); + elapsed = benchmark( iter ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + print_summary( count, count ); +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/Makefile b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/Makefile new file mode 100644 index 000000000000..a80ad84327ab --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/Makefile @@ -0,0 +1,141 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling Fortran source files: +ifdef FORTRAN_COMPILER + FC := $(FORTRAN_COMPILER) +else + FC := gfortran +endif + +# Define the command-line options when compiling Fortran files: +FFLAGS ?= \ + -std=f95 \ + -ffree-form \ + -O3 \ + -Wall \ + -Wextra \ + -Wno-compare-reals \ + -Wimplicit-interface \ + -fno-underscoring \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop`): +INCLUDE ?= + +# List of Fortran source files: +SOURCE_FILES ?= ../../src/scabs1.f + +# List of Fortran targets: +f_targets := benchmark.length.out + + +# RULES # + +#/ +# Compiles Fortran source files. +# +# @param {string} SOURCE_FILES - list of Fortran source files +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop`) +# @param {string} [FORTRAN_COMPILER] - Fortran compiler +# @param {string} [FFLAGS] - Fortran compiler flags +# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code +# +# @example +# make +# +# @example +# make all +#/ +all: $(f_targets) + +.PHONY: all + +#/ +# Compiles Fortran source files. +# +# @private +# @param {string} SOURCE_FILES - list of Fortran source files +# @param {(string|void)} INCLUDE - list of includes (e.g., `-I /foo/bar -I /beep/boop`) +# @param {string} FC - Fortran compiler +# @param {string} FFLAGS - Fortran compiler flags +# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code +#/ +$(f_targets): %.out: %.f + $(QUIET) $(FC) $(FFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(f_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/benchmark.length.f b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/benchmark.length.f new file mode 100644 index 000000000000..3bd311ab6a21 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/benchmark.length.f @@ -0,0 +1,205 @@ +!> +! @license Apache-2.0 +! +! 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. +! 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. +!< + +!> Benchmark `scabs1`. +! +! ## Notes +! +! - Written in "free form" Fortran 95. +! +!< +program bench + implicit none + ! .. + ! Local constants: + character(6), parameter :: name = 'scabs1' ! if changed, be sure to adjust length + integer, parameter :: iterations = 1000000 + integer, parameter :: repeats = 3 + integer, parameter :: min = 1 + integer, parameter :: max = 6 + ! .. + ! Run the benchmarks: + call main() + ! .. + ! Functions: +contains + ! .. + ! Prints the TAP version. + ! .. + subroutine print_version() + print '(A)', 'TAP version 13' + end subroutine print_version + ! .. + ! Prints the TAP summary. + ! + ! @param {integer} total - total number of tests + ! @param {integer} passing - total number of passing tests + ! .. + subroutine print_summary( total, passing ) + ! .. + ! Scalar arguments: + integer, intent(in) :: total, passing + ! .. + ! Local variables: + character(len=999) :: str, tmp + ! .. + ! Intrinsic functions: + intrinsic adjustl, trim + ! .. + print '(A)', '#' + ! .. + write (str, '(I15)') total ! TAP plan + tmp = adjustl( str ) + print '(A,A)', '1..', trim( tmp ) + ! .. + print '(A,A)', '# total ', trim( tmp ) + ! .. + write (str, '(I15)') passing + tmp = adjustl( str ) + print '(A,A)', '# pass ', trim( tmp ) + ! .. + print '(A)', '#' + print '(A)', '# ok' + end subroutine print_summary + ! .. + ! Prints benchmarks results. + ! + ! @param {integer} iterations - number of iterations + ! @param {double} elapsed - elapsed time in seconds + ! .. + subroutine print_results( iterations, elapsed ) + ! .. + ! Scalar arguments: + double precision, intent(in) :: elapsed + integer, intent(in) :: iterations + ! .. + ! Local variables: + double precision :: rate + character(len=999) :: str, tmp + ! .. + ! Intrinsic functions: + intrinsic dble, adjustl, trim + ! .. + rate = dble( iterations ) / elapsed + ! .. + print '(A)', ' ---' + ! .. + write (str, '(I15)') iterations + tmp = adjustl( str ) + print '(A,A)', ' iterations: ', trim( tmp ) + ! .. + write (str, '(f0.9)') elapsed + tmp = adjustl( str ) + print '(A,A)', ' elapsed: ', trim( tmp ) + ! .. + write( str, '(f0.9)') rate + tmp = adjustl( str ) + print '(A,A)', ' rate: ', trim( tmp ) + ! .. + print '(A)', ' ...' + end subroutine print_results + ! .. + ! Runs a benchmark. + ! + ! @param {integer} iterations - number of iterations + ! @return {double} elapsed time in seconds + ! .. + double precision function benchmark( iterations ) + ! .. + ! External functions: + interface + real function scabs1( c ) + complex :: c + end function scabs1 + end interface + ! .. + ! Scalar arguments: + integer, intent(in) :: iterations + ! .. + ! Local scalars: + double precision :: elapsed, r1, r2 + real :: t1, t2 + real :: y + integer :: i + ! .. + ! Local scalar: + complex :: c + ! .. + ! Intrinsic functions: + intrinsic random_number, cpu_time + ! .. + call random_number( r1 ) + call random_number( r2 ) + c = cmplx( (r1*100.0)-50.0, (r2*100.0)-50.0, kind=kind(0.0) ) + ! .. + call cpu_time( t1 ) + ! .. + y = 0.0 + do i = 1, iterations + y = scabs1( c ) + if ( y /= y ) then + print '(A)', 'unexpected result' + exit + end if + end do + ! .. + call cpu_time( t2 ) + ! .. + elapsed = t2 - t1 + ! .. + if ( y /= y ) then + print '(A)', 'unexpected result' + end if + ! .. + benchmark = elapsed + return + end function benchmark + ! .. + ! Main execution sequence. + ! .. + subroutine main() + ! .. + ! Local variables: + character(len=999) :: str, tmp + double precision :: elapsed + integer :: i, j, count, iter + ! .. + ! Intrinsic functions: + intrinsic adjustl, trim + ! .. + call print_version() + count = 0 + do i = min, max + iter = iterations / 10**(i-1) + do j = 1, repeats + count = count + 1 + ! .. + print '(A,A,A,A)', '# fortran::', name + ! .. + elapsed = benchmark( iter ) + ! .. + call print_results( iter, elapsed ) + ! .. + write (str, '(I15)') count + tmp = adjustl( str ) + print '(A,A,A)', 'ok ', trim( tmp ), ' benchmark finished' + end do + end do + call print_summary( count, count ) + end subroutine main +end program bench \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/binding.gyp b/lib/node_modules/@stdlib/blas/base/scabs1/binding.gyp new file mode 100644 index 000000000000..02a2799da097 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/binding.gyp @@ -0,0 +1,265 @@ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Fortran compiler (to override -Dfortran_compiler=): + 'fortran_compiler%': 'gfortran', + + # Fortran compiler flags: + 'fflags': [ + # Specify the Fortran standard to which a program is expected to conform: + '-std=f95', + + # Indicate that the layout is free-form source code: + '-ffree-form', + + # Aggressive optimization: + '-O3', + + # Enable commonly used warning options: + '-Wall', + + # Warn if source code contains problematic language features: + '-Wextra', + + # Warn if a procedure is called without an explicit interface: + '-Wimplicit-interface', + + # Do not transform names of entities specified in Fortran source files by appending underscores (i.e., don't mangle names, thus allowing easier usage in C wrappers): + '-fno-underscoring', + + # Warn if source code contains Fortran 95 extensions and C-language constructs: + '-pedantic', + + # Compile but do not link (output is an object file): + '-c', + ], + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + + # Define custom build actions for particular inputs: + 'rules': [ + { + # Define a rule for processing Fortran files: + 'extension': 'f', + + # Define the pathnames to be used as inputs when performing processing: + 'inputs': [ + # Full path of the current input: + '<(RULE_INPUT_PATH)' + ], + + # Define the outputs produced during processing: + 'outputs': [ + # Store an output object file in a directory for placing intermediate results (only accessible within a single target): + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).<(obj)' + ], + + # Define the rule for compiling Fortran based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + + # Rule to compile Fortran on Windows: + { + 'rule_name': 'compile_fortran_windows', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Windows...', + + 'process_outputs_as_sources': 0, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + }, + + # Rule to compile Fortran on non-Windows: + { + 'rule_name': 'compile_fortran_linux', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Linux...', + + 'process_outputs_as_sources': 1, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '-fPIC', # generate platform-independent code + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + } + ], # end condition (OS=="win") + ], # end conditions + }, # end rule (extension=="f") + ], # end rules + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt new file mode 100644 index 000000000000..1da3198abf4a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt @@ -0,0 +1,22 @@ + +{{alias}}( z ) + Computes the sum of the absolute value of real and imaginary part of a + single-precision complex floating-point number. + + Parameters + ---------- + z: Complex64 + Complex number. + + Returns + ------- + y: number + Result. + + Examples + -------- + > var y = {{alias}}( new {{alias:@stdlib/complex/float32}}( 5.0, 3.0 ) ) + 8.0 + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts new file mode 100644 index 000000000000..33bbdd9698db --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts @@ -0,0 +1,44 @@ +/* +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Complex64 } from '@stdlib/types/complex'; + +/** +* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* +* ## Notes +* +* @param c - complex number +* @returns result +* +* @example +* var Complex64 = require( '@stdlib/complex/float32' ); +* +* var v = scabs1( new Complex64( 5.0, 3.0 ) ); +* // returns 8.0 +*/ +declare function scabs1( z: Complex64 ): number; + + +// EXPORTS // + +export = scabs1; diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts new file mode 100644 index 000000000000..7d106fad6e87 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts @@ -0,0 +1,45 @@ +/* +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Complex64 = require( '@stdlib/complex/float32' ); +import scabs1 = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + scabs1( new Complex64( 5, 3 ) ); // $ExpectType number +} + +// The compiler throws an error if the function is not provided a complex number... +{ + scabs1( true ); // $ExpectError + scabs1( false ); // $ExpectError + scabs1( null ); // $ExpectError + scabs1( undefined ); // $ExpectError + scabs1( '5' ); // $ExpectError + scabs1( [] ); // $ExpectError + scabs1( {} ); // $ExpectError + scabs1( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + scabs1(); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/Makefile new file mode 100644 index 000000000000..6aed70daf167 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c new file mode 100644 index 000000000000..f591a6c2a8e4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/scabs1.h" +#include "stdlib/complex/float32.h" +#include "stdlib/complex/reimf.h" +#include + +int main( void ) { + const stdlib_complex64_t x[] = { + stdlib_complex64( 3.14f, 1.0f ), + stdlib_complex64( -3.14f, -1.0f ), + stdlib_complex64( 0.0f, 0.0f ), + stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f ) + }; + + stdlib_complex64_t c; + float re; + float im; + float y; + int i; + for ( i = 0; i < 4; i++ ) { + c = x[ i ]; + y = c_scabs1( c ); + stdlib_reimf( c, &re, &im ); + printf( "f(%f + %f) = %f\n", re, im, y ); + } +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js b/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js new file mode 100644 index 000000000000..6836c47a18ad --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js @@ -0,0 +1,34 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Complex128 = require( '@stdlib/complex/float64' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var dcabs1 = require( './../lib' ); + +// Create a PRNG to generate uniformly distributed pseudorandom integers: +var rand = discreteUniform( -50, 50 ); + +// Compute the sum of the absolute value of real and imaginary part for a set of complex numbers... +var z; +var i; +for ( i = 0; i < 100; i++ ) { + z = new Complex128( rand(), rand() ); + console.log( 'dcabs1(%s) = %d', z.toString(), dcabs1( z ) ); +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include.gypi b/lib/node_modules/@stdlib/blas/base/scabs1/include.gypi new file mode 100644 index 000000000000..497aeca15320 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include.gypi @@ -0,0 +1,70 @@ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +# +# Variable nesting hacks: +# +# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi +# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004 +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + 'variables': { + # Host BLAS library (to override -Dblas=): + 'blas%': '', + + # Path to BLAS library (to override -Dblas_dir=): + 'blas_dir%': '', + }, # end variables + + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '<@(blas_dir)', + '=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "math.abs", + "blas", + "scalar", + "scabs1", + "abs", + "absolute", + "magnitude", + "modulus", + "float32", + "complex", + "cmplx", + "number" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/Makefile b/lib/node_modules/@stdlib/blas/base/scabs1/src/Makefile new file mode 100644 index 000000000000..bcf18aa46655 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c new file mode 100644 index 000000000000..5bda07dcb741 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c @@ -0,0 +1,22 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/scabs1.h" +#include "stdlib/math/base/napi/unary.h" + +STDLIB_MATH_BASE_NAPI_MODULE_C_F( c_scabs1 ) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c new file mode 100644 index 000000000000..e36ba2d7948a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/scabs1.h" +#include "stdlib/math/base/special/absf.h" +#include "stdlib/complex/float32.h" +#include "stdlib/complex/reimf.h" + +/** +* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* +* @param c complex number +* @return result +* +* @example +* #include "stdlib/complex/float32.h" +* +* stdlib_complex64_t c = stdlib_complex64( 5.0f, 3.0f ); +* +* float y = c_scabs1( c ); +* // returns 8.0 +*/ +float c_scabs1( const stdlib_complex64_t c ) { + float re; + float im; + stdlib_reimf( c, &re, &im ); + return stdlib_base_absf( re ) + stdlib_base_absf( im ); +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f new file mode 100644 index 000000000000..838389572fa7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f @@ -0,0 +1,65 @@ +!> +! @license Apache-2.0 +! +! 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. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +!< + +!> Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +! +! ## Notes +! +! * Modified version of reference BLAS level1 routine (version 3.7.0). Updated to "free form" Fortran 95. +! +! ## Authors +! +! * Univ. of Tennessee +! * Univ. of California Berkeley +! * Univ. of Colorado Denver +! * NAG Ltd. +! +! ## History +! +! * Jack Dongarra, linpack, 3/11/78. +! +! - modified 3/93 to return if incx .le. 0. +! - modified 12/3/93, array(1) declarations changed to array(*) +! +! ## License +! +! From : +! +! > The reference BLAS is a freely-available software package. It is available from netlib via anonymous ftp and the World Wide Web. Thus, it can be included in commercial software packages (and has been). We only ask that proper credit be given to the authors. +! > +! > Like all software, it is copyrighted. It is not trademarked, but we do ask the following: +! > +! > * If you modify the source for these routines we ask that you change the name of the routine and comment the changes made to the original. +! > +! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support. +! +! @param {complex} c - complex number +! @returns {real} result +!< +real function scabs1( c ) + implicit none + ! .. + ! Scalar arguments: + complex(4) c + ! .. + ! Intrinsic functions: + intrinsic ABS, AIMAG, REAL + ! .. + scabs1 = ABS( REAL( c ) ) + ABS( AIMAG( c ) ) + return +end function scabs1 \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c new file mode 100644 index 000000000000..58562ba55c40 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/scabs1.h" +#include "stdlib/blas/base/scabs1_cblas.h" +#include "stdlib/complex/float32.h" + +/** +* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* +* @param c complex number +* @return result +*/ +float c_scabs1( const stdlib_complex64_t c ) { + return cblas_scabs1( c ); +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c new file mode 100644 index 000000000000..50b8ffad6d14 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c @@ -0,0 +1,33 @@ +/** +* @license Apache-2.0 +* +* 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. +* 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/scabs1.h" +#include "stdlib/blas/base/scabs1_fortran.h" +#include "stdlib/complex/float32.h" + +/** +* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* +* @param c complex number +* @return result +*/ +float c_scabs1( const stdlib_complex64_t c ) { + float y; + scabs1sub( &c, &y ); + return y; +} diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f new file mode 100644 index 000000000000..71710d2291f1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f @@ -0,0 +1,41 @@ +!> +! @license Apache-2.0 +! +! 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. +! You may obtain a copy of the License at +! +! http://www.apache.org/licenses/LICENSE-2.0 +! +! Unless required by applicable law or agreed to in writing, software +! distributed under the License is distributed on an "AS IS" BASIS, +! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +! See the License for the specific language governing permissions and +! limitations under the License. +!< + +!> Wraps `scabs1` as a subroutine. +! +! @param {complex} c - complex number +! @param {real} y - result +!< +subroutine scabs1sub( c, y ) + implicit none + ! .. + ! External functions: + interface + real function scabs1( c ) + complex :: c + end function scabs1 + end interface + ! .. + ! Scalar arguments: + complex :: c + real :: y + ! .. + ! Compute the sum of the absolute values of the real and imaginary part of a single-precision complex number: + y = scabs1( c ) + return +end subroutine scabs1sub \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js new file mode 100644 index 000000000000..e734add7ac9e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Complex64 = require( '@stdlib/complex/float32' ); +var scabs1 = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scabs1, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function computes the sum of the absolute value of the real and imaginary part of a complex number', function test( t ) { + var expected; + var delta; + var tol; + var re; + var im; + var y; + var i; + + re = new Float32Array( [ 5.0, -3.0, 0.0, 0.0, 3.0 ] ); + im = new Float32Array( [ 3.0, 4.0, 0.0, -0.0, 0.0 ] ); + expected = new Float32Array( [ 8.0, 7.0, 0.0, 0.0, 3.0 ] ); + + for ( i = 0; i < re.length; i++ ) { + y = scabs1( new Complex64( re[ i ], im[ i ] ) ); + if ( y === expected[ i ] ) { + t.equal( y, expected[ i ], 're: '+re[i]+'. im: '+im[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[i] ); + tol = EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. re: '+re[i]+'. im: '+im[i]+' y: '+y+'. Expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'if either the real or imaginary component is `NaN`, the function returns `NaN`', function test( t ) { + var v; + + v = scabs1( new Complex64( NaN, 3.0 ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = scabs1( new Complex64( 5.0, NaN ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = scabs1( new Complex64( NaN, NaN ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js new file mode 100644 index 000000000000..851b72862dd4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var Float32Array = require( '@stdlib/array/float32' ); +var Complex64 = require( '@stdlib/complex/float32' ); +var tryRequire = require( '@stdlib/utils/try-require' ); + + +// VARIABLES // + +var scabs1 = tryRequire( resolve( __dirname, './../lib/native.js' ) ); +var opts = { + 'skip': ( scabs1 instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof scabs1, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function computes the sum of the absolute value of the real and imaginary part of a complex number', opts, function test( t ) { + var expected; + var delta; + var tol; + var re; + var im; + var y; + var i; + + re = new Float32Array( [ 5.0, -3.0, 0.0, 0.0, 3.0 ] ); + im = new Float32Array( [ 3.0, 4.0, 0.0, -0.0, 0.0 ] ); + expected = new Float32Array( [ 8.0, 7.0, 0.0, 0.0, 3.0 ] ); + + for ( i = 0; i < re.length; i++ ) { + y = scabs1( new Complex64( re[ i ], im[ i ] ) ); + if ( y === expected[ i ] ) { + t.equal( y, expected[ i ], 're: '+re[i]+'. im: '+im[i]+'. Expected: '+expected[i] ); + } else { + delta = abs( y - expected[i] ); + tol = EPS * abs( expected[i] ); + t.ok( delta <= tol, 'within tolerance. re: '+re[i]+'. im: '+im[i]+' y: '+y+'. Expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); + +tape( 'if either the real or imaginary component is `NaN`, the function returns `NaN`', opts, function test( t ) { + var v; + + v = scabs1( new Complex64( NaN, 3.0 ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = scabs1( new Complex64( 5.0, NaN ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + v = scabs1( new Complex64( NaN, NaN ) ); + t.strictEqual( isnan( v ), true, 'returns NaN' ); + + t.end(); +}); From b1136697c4ad351424273f36d162282a4687e8be Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sun, 28 Apr 2024 19:19:51 +0530 Subject: [PATCH 02/26] chore: apply review changes --- .../@stdlib/blas/base/scabs1/manifest.json | 30 ++++++-- .../@stdlib/blas/base/scabs1/src/addon.c | 71 ++++++++++++++++++- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json index 27ce920bfa95..a64c277e65b8 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json @@ -44,7 +44,10 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/unary", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-float", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -106,7 +109,10 @@ ], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/unary", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-float", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -165,7 +171,10 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/unary", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-float", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -226,7 +235,10 @@ ], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/unary", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-float", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -284,7 +296,10 @@ ], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/unary", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-float", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -341,7 +356,10 @@ "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/napi/unary", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-complex64", + "@stdlib/napi/argv-float", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c index 5bda07dcb741..43d7e479ecf3 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c @@ -17,6 +17,73 @@ */ #include "stdlib/blas/base/scabs1.h" -#include "stdlib/math/base/napi/unary.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_float.h" +#include "stdlib/napi/argv_complex64.h" +#include +#include -STDLIB_MATH_BASE_NAPI_MODULE_C_F( c_scabs1 ) +// /** +// * Receives JavaScript callback invocation data. +// * +// * @private +// * @param env environment under which the function is invoked +// * @param info callback data +// * @return Node-API value +// */ +#define STDLIB_NAPI_CREATE_FLOAT( env, expression, name ) \ + napi_value name; \ + stdlib_napi_create_float( env, expression, &name ); + +napi_status stdlib_napi_create_float( const napi_env env, const float value, napi_value *out ); +/** +* Receives JavaScript callback invocation data. +* +* @private +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 1 ) + STDLIB_NAPI_ARGV_COMPLEX64( env, c, argv, 0 ) + float y = c_scabs1( c ); + if ( y == 3.14567890123 ) { + assert( napi_throw_error( env, NULL, "unexpected error" ) == napi_ok ); + return NULL; + } + STDLIB_NAPI_CREATE_FLOAT( env, y, v ) + return v; +} + +/** +* Initializes a Node-API module. +* +* @private +* @param env environment under which the function is invoked +* @param exports exports object +* @return main export +*/ +static napi_value init( napi_env env, napi_value exports ) { + napi_value fcn; + napi_status status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, addon, NULL, &fcn ); + assert( status == napi_ok ); + return fcn; +} + +NAPI_MODULE( NODE_GYP_MODULE_NAME, init ) + +// napi_status stdlib_napi_create_float( const napi_env env, const float value, napi_value *out ) { +// STDLIB_ASSERT_NAPI_STATUS_OK_RET_VALUE( env, napi_create_float( env, value, out ), "", napi_ok ) +// return napi_ok; +// } +// static napi_value addon( napi_env env, napi_callback_info info ) { +// STDLIB_NAPI_ARGV( env, info, argv, argc, 1 ); +// STDLIB_NAPI_ARGV_COMPLEX64( env, c, argv, 0 ); +// STDLIB_NAPI_CREATE_FLOAT( env, c_scabs1( c ), y ); + +// return y; +// } + +// STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) From 0420e6d564ee33f35fb1a2d6bd0cf1e7bb82cbee Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 30 Apr 2024 17:04:45 +0530 Subject: [PATCH 03/26] chore: apply changes to addon.c --- .../base/{scabs_cblas.h => scabs1_cblas.h} | 0 .../@stdlib/blas/base/scabs1/manifest.json | 12 ++-- .../@stdlib/blas/base/scabs1/src/addon.c | 62 +++---------------- 3 files changed, 13 insertions(+), 61 deletions(-) rename lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/{scabs_cblas.h => scabs1_cblas.h} (100%) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs_cblas.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h similarity index 100% rename from lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs_cblas.h rename to lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json index a64c277e65b8..4c060a01913a 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json @@ -47,7 +47,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", - "@stdlib/napi/argv-float", + "@stdlib/napi/create-double", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -112,7 +112,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", - "@stdlib/napi/argv-float", + "@stdlib/napi/create-double", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -174,7 +174,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", - "@stdlib/napi/argv-float", + "@stdlib/napi/create-double", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -238,7 +238,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", - "@stdlib/napi/argv-float", + "@stdlib/napi/create-double", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -299,7 +299,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", - "@stdlib/napi/argv-float", + "@stdlib/napi/create-double", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" @@ -359,7 +359,7 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", - "@stdlib/napi/argv-float", + "@stdlib/napi/create-double", "@stdlib/complex/float32", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c index 43d7e479ecf3..de35d5c6675d 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/addon.c @@ -18,25 +18,11 @@ #include "stdlib/blas/base/scabs1.h" #include "stdlib/napi/export.h" -#include "stdlib/napi/argv.h" -#include "stdlib/napi/argv_float.h" #include "stdlib/napi/argv_complex64.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/create_double.h" #include -#include - -// /** -// * Receives JavaScript callback invocation data. -// * -// * @private -// * @param env environment under which the function is invoked -// * @param info callback data -// * @return Node-API value -// */ -#define STDLIB_NAPI_CREATE_FLOAT( env, expression, name ) \ - napi_value name; \ - stdlib_napi_create_float( env, expression, &name ); -napi_status stdlib_napi_create_float( const napi_env env, const float value, napi_value *out ); /** * Receives JavaScript callback invocation data. * @@ -46,44 +32,10 @@ napi_status stdlib_napi_create_float( const napi_env env, const float value, nap * @return Node-API value */ static napi_value addon( napi_env env, napi_callback_info info ) { - STDLIB_NAPI_ARGV( env, info, argv, argc, 1 ) - STDLIB_NAPI_ARGV_COMPLEX64( env, c, argv, 0 ) - float y = c_scabs1( c ); - if ( y == 3.14567890123 ) { - assert( napi_throw_error( env, NULL, "unexpected error" ) == napi_ok ); - return NULL; - } - STDLIB_NAPI_CREATE_FLOAT( env, y, v ) - return v; -} - -/** -* Initializes a Node-API module. -* -* @private -* @param env environment under which the function is invoked -* @param exports exports object -* @return main export -*/ -static napi_value init( napi_env env, napi_value exports ) { - napi_value fcn; - napi_status status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, addon, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; + STDLIB_NAPI_ARGV( env, info, argv, argc, 1 ); + STDLIB_NAPI_ARGV_COMPLEX64( env, c, argv, 0 ); + STDLIB_NAPI_CREATE_DOUBLE( env, (double)c_scabs1( c ), y ); + return y; } -NAPI_MODULE( NODE_GYP_MODULE_NAME, init ) - -// napi_status stdlib_napi_create_float( const napi_env env, const float value, napi_value *out ) { -// STDLIB_ASSERT_NAPI_STATUS_OK_RET_VALUE( env, napi_create_float( env, value, out ), "", napi_ok ) -// return napi_ok; -// } -// static napi_value addon( napi_env env, napi_callback_info info ) { -// STDLIB_NAPI_ARGV( env, info, argv, argc, 1 ); -// STDLIB_NAPI_ARGV_COMPLEX64( env, c, argv, 0 ); -// STDLIB_NAPI_CREATE_FLOAT( env, c_scabs1( c ), y ); - -// return y; -// } - -// STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) From dd5fe0ff8d29187d8e3094643177a31c12ad2730 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 02:43:16 -0700 Subject: [PATCH 04/26] docs: update example and fix param name --- .../@stdlib/blas/base/scabs1/docs/types/index.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts index 33bbdd9698db..1c54c1a93ac6 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts @@ -23,9 +23,7 @@ import { Complex64 } from '@stdlib/types/complex'; /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. -* -* ## Notes +* Computes the sum of the absolute value of the real and imaginary parts of a single-precision complex floating-point number. * * @param c - complex number * @returns result @@ -33,10 +31,10 @@ import { Complex64 } from '@stdlib/types/complex'; * @example * var Complex64 = require( '@stdlib/complex/float32' ); * -* var v = scabs1( new Complex64( 5.0, 3.0 ) ); +* var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 */ -declare function scabs1( z: Complex64 ): number; +declare function scabs1( c: Complex64 ): number; // EXPORTS // From ad599517a1efccc8463f098156df5dd56ff8b095 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 02:45:36 -0700 Subject: [PATCH 05/26] docs: update examples and descriptions --- lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js | 4 ++-- lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js | 6 +++--- lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js index 8abb11df373a..e0cce95456c9 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Compute the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Compute the sum of the absolute values of the real and imaginary parts of a single-precision complex floating-point number. * * @module @stdlib/blas/base/scabs1 * @@ -27,7 +27,7 @@ * var Complex64 = require( '@stdlib/complex/float32' ); * var scabs1 = require( '@stdlib/blas/base/scabs1' ); * -* var v = scabs1( new Complex64( 5.0, 3.0 ) ); +* var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 */ diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js index ef9c49c73466..7c155ead2a0c 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js @@ -28,15 +28,15 @@ var imagf = require( '@stdlib/complex/imagf' ); // MAIN // /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary parts of a single-precision complex floating-point number. * * @param {Complex64} c - complex number -* @returns {number} absolute value +* @returns {number} result * * @example * var Complex64 = require( '@stdlib/complex/float32' ); * -* var v = scabs1( new Complex64( 5.0, 3.0 ) ); +* var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 */ function scabs1( c ) { diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js index 00f9227964da..8721abc75573 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js @@ -26,15 +26,16 @@ var addon = require( './../src/addon.node' ); // MAIN // /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary parts of a single-precision complex floating-point number. * +* @private * @param {Complex64} c - complex number -* @returns {number} absolute value +* @returns {number} result * * @example * var Complex64 = require( '@stdlib/complex/float32' ); * -* var v = scabs1( new Complex64( 5.0, 3.0 ) ); +* var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 */ function scabs1( c) { From 321ecf02d4346316b6c48740c5e05df965c394c0 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 02:46:34 -0700 Subject: [PATCH 06/26] docs: fix variable name --- lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js b/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js index 6836c47a18ad..f05d6f97c177 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js @@ -20,15 +20,15 @@ var Complex128 = require( '@stdlib/complex/float64' ); var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var dcabs1 = require( './../lib' ); +var scabs1 = require( './../lib' ); // Create a PRNG to generate uniformly distributed pseudorandom integers: var rand = discreteUniform( -50, 50 ); -// Compute the sum of the absolute value of real and imaginary part for a set of complex numbers... +// Compute the sum of the absolute values of real and imaginary parts for a set of complex numbers... var z; var i; for ( i = 0; i < 100; i++ ) { z = new Complex128( rand(), rand() ); - console.log( 'dcabs1(%s) = %d', z.toString(), dcabs1( z ) ); + console.log( 'scabs1(%s) = %d', z.toString(), scabs1( z ) ); } From dd0110a90227954343e6dbbbdaa6a6da0e41410b Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 02:47:22 -0700 Subject: [PATCH 07/26] style: add spaces --- lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js index 7c155ead2a0c..58f4d64026c9 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js @@ -40,7 +40,7 @@ var imagf = require( '@stdlib/complex/imagf' ); * // returns 8.0 */ function scabs1( c ) { - return absf( realf(c) ) + absf( imagf(c) ); + return absf( realf( c ) ) + absf( imagf( c ) ); } From 54213a0d9618ebed2de094c30743b2124ada8021 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 02:48:03 -0700 Subject: [PATCH 08/26] style: fix missing space --- lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js index 8721abc75573..0a6498b12e34 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js @@ -38,7 +38,7 @@ var addon = require( './../src/addon.node' ); * var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 */ -function scabs1( c) { +function scabs1( c ) { return addon( c ); } From 2caedf016d8209c17e5ed531d7d4463056d39cea Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 14:22:44 -0700 Subject: [PATCH 09/26] docs: update C example --- .../@stdlib/blas/base/scabs1/examples/c/example.c | 12 ++++-------- .../@stdlib/blas/base/scabs1/manifest.json | 12 +++++++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c index f591a6c2a8e4..e6423ae676ae 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c @@ -18,7 +18,8 @@ #include "stdlib/blas/base/scabs1.h" #include "stdlib/complex/float32.h" -#include "stdlib/complex/reimf.h" +#include "stdlib/complex/realf.h" +#include "stdlib/complex/imagf.h" #include int main( void ) { @@ -29,15 +30,10 @@ int main( void ) { stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f ) }; - stdlib_complex64_t c; - float re; - float im; float y; int i; for ( i = 0; i < 4; i++ ) { - c = x[ i ]; - y = c_scabs1( c ); - stdlib_reimf( c, &re, &im ); - printf( "f(%f + %f) = %f\n", re, im, y ); + y = c_scabs1( x[ i ] ); + printf( "f(%f + %f) = %f\n", realf( x[ i ] ), imagf( x[ i ] ), y ); } } diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json index 4c060a01913a..6c47a126df30 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json @@ -88,7 +88,9 @@ "dependencies": [ "@stdlib/math/base/special/absf", "@stdlib/complex/float32", - "@stdlib/complex/reimf" + "@stdlib/complex/reimf", + "@stdlib/complex/realf", + "@stdlib/complex/imagf" ] }, @@ -215,7 +217,9 @@ "dependencies": [ "@stdlib/math/base/special/absf", "@stdlib/complex/float32", - "@stdlib/complex/reimf" + "@stdlib/complex/reimf", + "@stdlib/complex/realf", + "@stdlib/complex/imagf" ] }, @@ -400,7 +404,9 @@ "dependencies": [ "@stdlib/math/base/special/absf", "@stdlib/complex/float32", - "@stdlib/complex/reimf" + "@stdlib/complex/reimf", + "@stdlib/complex/realf", + "@stdlib/complex/imagf" ] }, From 7a7cccdd619ebe0b19aff29d445d6a36c6ec9bfd Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 14:23:38 -0700 Subject: [PATCH 10/26] docs: update description and example --- lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt index 1da3198abf4a..989ea56a0e89 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}( z ) - Computes the sum of the absolute value of real and imaginary part of a + Computes the sum of the absolute values of real and imaginary parts of a single-precision complex floating-point number. Parameters @@ -15,7 +15,7 @@ Examples -------- - > var y = {{alias}}( new {{alias:@stdlib/complex/float32}}( 5.0, 3.0 ) ) + > var y = {{alias}}( new {{alias:@stdlib/complex/float32}}( 5.0, -3.0 ) ) 8.0 See Also From be0c01e49a5f5bb1db001154902e24e143907e59 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 14:31:04 -0700 Subject: [PATCH 11/26] docs: update descriptions --- lib/node_modules/@stdlib/blas/base/scabs1/README.md | 6 +++--- lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt | 4 ++-- .../@stdlib/blas/base/scabs1/docs/types/index.d.ts | 2 +- lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js | 2 +- lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js | 2 +- lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js | 2 +- lib/node_modules/@stdlib/blas/base/scabs1/package.json | 2 +- lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c | 4 ++-- lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f | 9 +-------- .../@stdlib/blas/base/scabs1/src/scabs1_cblas.c | 2 +- lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c | 2 +- 11 files changed, 15 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/README.md b/lib/node_modules/@stdlib/blas/base/scabs1/README.md index 0c04459bf786..12bce3dcc1a3 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/README.md +++ b/lib/node_modules/@stdlib/blas/base/scabs1/README.md @@ -20,7 +20,7 @@ limitations under the License. # scabs1 -> Compute the sum of the [absolute value][absolute-value] of the real part and imaginary part of a single-precision [complex][@stdlib/complex/float32] floating-point number. +> Compute the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32] floating-point number.
@@ -32,12 +32,12 @@ var scabs1 = require( '@stdlib/blas/base/scabs1' ); #### scabs1( z ) -Computes the sum of the [absolute value][absolute-value] of the real part and imaginary part of a single-precision [complex][@stdlib/complex/float32] floating-point number. +Computes the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32] floating-point number. ```javascript var Complex64 = require( '@stdlib/complex/float32' ); -var y = scabs1( new Complex64( 5.0, 3.0 ) ); +var y = scabs1( new Complex64( 5.0, -3.0 ) ); // returns 8.0 ``` diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt index 989ea56a0e89..d223e945dbce 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( z ) - Computes the sum of the absolute values of real and imaginary parts of a - single-precision complex floating-point number. + Computes the sum of the absolute values of real and imaginary components of + a single-precision complex floating-point number. Parameters ---------- diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts index 1c54c1a93ac6..e8e854aa8f81 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts @@ -23,7 +23,7 @@ import { Complex64 } from '@stdlib/types/complex'; /** -* Computes the sum of the absolute value of the real and imaginary parts of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @param c - complex number * @returns result diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js index e0cce95456c9..ecd69a1b52ac 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Compute the sum of the absolute values of the real and imaginary parts of a single-precision complex floating-point number. +* Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @module @stdlib/blas/base/scabs1 * diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js index 58f4d64026c9..926c7c110d2a 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js @@ -28,7 +28,7 @@ var imagf = require( '@stdlib/complex/imagf' ); // MAIN // /** -* Computes the sum of the absolute values of the real and imaginary parts of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @param {Complex64} c - complex number * @returns {number} result diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js index 0a6498b12e34..57a1a0b71bea 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js @@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' ); // MAIN // /** -* Computes the sum of the absolute values of the real and imaginary parts of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @private * @param {Complex64} c - complex number diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/package.json b/lib/node_modules/@stdlib/blas/base/scabs1/package.json index 2666e46156e4..9ded5def63e7 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/package.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/scabs1", "version": "0.0.0", - "description": "Compute the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number.", + "description": "Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c index e36ba2d7948a..696068972514 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c @@ -22,7 +22,7 @@ #include "stdlib/complex/reimf.h" /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @param c complex number * @return result @@ -30,7 +30,7 @@ * @example * #include "stdlib/complex/float32.h" * -* stdlib_complex64_t c = stdlib_complex64( 5.0f, 3.0f ); +* stdlib_complex64_t c = stdlib_complex64( 5.0f, -3.0f ); * * float y = c_scabs1( c ); * // returns 8.0 diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f index 838389572fa7..aba5599a1542 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.f @@ -16,7 +16,7 @@ ! limitations under the License. !< -!> Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +!> Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. ! ! ## Notes ! @@ -29,13 +29,6 @@ ! * Univ. of Colorado Denver ! * NAG Ltd. ! -! ## History -! -! * Jack Dongarra, linpack, 3/11/78. -! -! - modified 3/93 to return if incx .le. 0. -! - modified 12/3/93, array(1) declarations changed to array(*) -! ! ## License ! ! From : diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c index 58562ba55c40..c8a31c4bed44 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c @@ -21,7 +21,7 @@ #include "stdlib/complex/float32.h" /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @param c complex number * @return result diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c index 50b8ffad6d14..0f16d9b0e004 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c @@ -21,7 +21,7 @@ #include "stdlib/complex/float32.h" /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. * * @param c complex number * @return result From e45a6a77d9af7ea223c5a05639326700684a0a83 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:00:10 -0700 Subject: [PATCH 12/26] chore: update keywords --- lib/node_modules/@stdlib/blas/base/scabs1/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/package.json b/lib/node_modules/@stdlib/blas/base/scabs1/package.json index 9ded5def63e7..57457b15c842 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/package.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/package.json @@ -56,14 +56,11 @@ "stdmath", "mathematics", "math", - "math.abs", "blas", "scalar", "scabs1", "abs", "absolute", - "magnitude", - "modulus", "float32", "complex", "cmplx", From f8132181331fa68af6b61e4302db77567ae51454 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:03:35 -0700 Subject: [PATCH 13/26] build: fix missing dependencies --- .../@stdlib/blas/base/scabs1/manifest.json | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json index 6c47a126df30..574871289c77 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json @@ -136,7 +136,9 @@ "-lpthread" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/complex/float32" + ] }, { "task": "examples", @@ -154,7 +156,10 @@ "-lpthread" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/complex/realf", + "@stdlib/complex/imagf" + ] }, { @@ -263,7 +268,9 @@ "-lblas" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/complex/float32" + ] }, { "task": "examples", @@ -280,7 +287,10 @@ "-lblas" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/complex/realf", + "@stdlib/complex/imagf" + ] }, { @@ -325,7 +335,9 @@ "-lpthread" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/complex/float32" + ] }, { "task": "examples", @@ -343,7 +355,10 @@ "-lpthread" ], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/complex/realf", + "@stdlib/complex/imagf" + ] }, { From 2d92608915947fb45422c47565fcf0179bc156d5 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:05:58 -0700 Subject: [PATCH 14/26] style: re-enable lint rule --- lib/node_modules/@stdlib/blas/base/scabs1/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/README.md b/lib/node_modules/@stdlib/blas/base/scabs1/README.md index 12bce3dcc1a3..424f964a6e38 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/README.md +++ b/lib/node_modules/@stdlib/blas/base/scabs1/README.md @@ -49,8 +49,6 @@ var y = scabs1( new Complex64( 5.0, -3.0 ) ); ## Examples - - ```javascript From ffc5963080e1df0a1ce53dd6b52496c31c534672 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:08:34 -0700 Subject: [PATCH 15/26] docs: update descriptions and fix copy-paste errors --- .../blas/base/scabs1/include/stdlib/blas/base/scabs1.h | 4 ++-- .../blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h | 4 ++-- .../base/scabs1/include/stdlib/blas/base/scabs1_fortran.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h index 7fa8e358568b..122c2a08d12b 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h @@ -17,7 +17,7 @@ */ /** -* Header file containing function declarations for the C interface to the Level 1 routine `idamax`. +* Header file containing function declarations for the C interface to the Level 1 routine `scabs1`. */ #ifndef SCABS1_H #define SCABS1_H @@ -32,7 +32,7 @@ extern "C" { #endif /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. */ float c_scabs1( const stdlib_complex64_t c ); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h index fc2ddc79e4b4..97013e00623d 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h @@ -17,7 +17,7 @@ */ /** -* Header file containing function declarations for the C interface to the CBLAS Level 1 routine `cblas_ccopy`. +* Header file containing function declarations for the C interface to the CBLAS Level 1 routine `cblas_scabs1`. */ #ifndef SCABS1_CBLAS_H #define SCABS1_CBLAS_H @@ -32,7 +32,7 @@ extern "C" { #endif /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. */ float cblas_scabs1( const stdlib_complex64_t c ); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h index 78768f2c0734..9f9dc15e4b7d 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h @@ -17,7 +17,7 @@ */ /** -* Header file containing function declarations for the Fortran interface to the BLAS Level 1 routine `idamax`. +* Header file containing function declarations for the Fortran interface to the BLAS Level 1 routine `scabs1`. */ #ifndef SCABS1_FORTRAN_H #define SCABS1_FORTRAN_H @@ -32,7 +32,7 @@ extern "C" { #endif /** -* Computes the sum of the absolute value of the real and imaginary part of a single-precision complex floating-point number. +* Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. */ void scabs1sub( const stdlib_complex64_t *, float * ); From 757f6ad85467853667ca4158ec06d26e59f1e636 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:09:48 -0700 Subject: [PATCH 16/26] docs: update description --- lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt index d223e945dbce..8c351b33f582 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( z ) - Computes the sum of the absolute values of real and imaginary components of - a single-precision complex floating-point number. + Computes the sum of the absolute values of the real and imaginary components + of a single-precision complex floating-point number. Parameters ---------- From c83f8a91a664fca944d9c6fa50f714774a40ec02 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:13:26 -0700 Subject: [PATCH 17/26] test: update tests to rely on exact equality --- .../@stdlib/blas/base/scabs1/test/test.js | 20 +++++-------------- .../blas/base/scabs1/test/test.native.js | 20 +++++-------------- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js index e734add7ac9e..b093f0b4c702 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js @@ -22,8 +22,6 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var Float32Array = require( '@stdlib/array/float32' ); var Complex64 = require( '@stdlib/complex/float32' ); var scabs1 = require( './../lib' ); @@ -37,10 +35,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function computes the sum of the absolute value of the real and imaginary part of a complex number', function test( t ) { +tape( 'the function computes the sum of the absolute values of the real and imaginary components of a complex number', function test( t ) { var expected; - var delta; - var tol; var re; var im; var y; @@ -52,13 +48,7 @@ tape( 'the function computes the sum of the absolute value of the real and imagi for ( i = 0; i < re.length; i++ ) { y = scabs1( new Complex64( re[ i ], im[ i ] ) ); - if ( y === expected[ i ] ) { - t.equal( y, expected[ i ], 're: '+re[i]+'. im: '+im[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. re: '+re[i]+'. im: '+im[i]+' y: '+y+'. Expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.equal( y, expected[ i ], 'returns expected value. re: '+re[i]+'. im: '+im[i]+'. expected: '+expected[i]+'.' ); } t.end(); }); @@ -67,13 +57,13 @@ tape( 'if either the real or imaginary component is `NaN`, the function returns var v; v = scabs1( new Complex64( NaN, 3.0 ) ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = scabs1( new Complex64( 5.0, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = scabs1( new Complex64( NaN, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js index 851b72862dd4..2ea5e37e34f6 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js @@ -23,8 +23,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var abs = require( '@stdlib/math/base/special/abs' ); var Float32Array = require( '@stdlib/array/float32' ); var Complex64 = require( '@stdlib/complex/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -46,10 +44,8 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'the function computes the sum of the absolute value of the real and imaginary part of a complex number', opts, function test( t ) { +tape( 'the function computes the sum of the absolute values of the real and imaginary components of a complex number', opts, function test( t ) { var expected; - var delta; - var tol; var re; var im; var y; @@ -61,13 +57,7 @@ tape( 'the function computes the sum of the absolute value of the real and imagi for ( i = 0; i < re.length; i++ ) { y = scabs1( new Complex64( re[ i ], im[ i ] ) ); - if ( y === expected[ i ] ) { - t.equal( y, expected[ i ], 're: '+re[i]+'. im: '+im[i]+'. Expected: '+expected[i] ); - } else { - delta = abs( y - expected[i] ); - tol = EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. re: '+re[i]+'. im: '+im[i]+' y: '+y+'. Expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' ); - } + t.equal( y, expected[ i ], 'returns expected value. re: '+re[i]+'. im: '+im[i]+'. expected: '+expected[i]+'.' ); } t.end(); }); @@ -76,13 +66,13 @@ tape( 'if either the real or imaginary component is `NaN`, the function returns var v; v = scabs1( new Complex64( NaN, 3.0 ) ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = scabs1( new Complex64( 5.0, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = scabs1( new Complex64( NaN, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); From d807bbc9df93cfbc19c052b0189bda1854b04543 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:15:50 -0700 Subject: [PATCH 18/26] docs: update comment --- lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f index 71710d2291f1..d35c97e88af0 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1sub.f @@ -35,7 +35,7 @@ end function scabs1 complex :: c real :: y ! .. - ! Compute the sum of the absolute values of the real and imaginary part of a single-precision complex number: + ! Compute the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number: y = scabs1( c ) return end subroutine scabs1sub \ No newline at end of file From 570ce031b5aa30cf3f31e9298099de67553c34d4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:22:32 -0700 Subject: [PATCH 19/26] refactor: update paths --- .../@stdlib/blas/base/scabs1/README.md | 10 +++--- .../blas/base/scabs1/benchmark/benchmark.js | 2 +- .../base/scabs1/benchmark/benchmark.native.js | 2 +- .../scabs1/benchmark/c/benchmark.length.c | 2 +- .../@stdlib/blas/base/scabs1/docs/repl.txt | 2 +- .../blas/base/scabs1/docs/types/index.d.ts | 2 +- .../blas/base/scabs1/docs/types/test.ts | 4 +-- .../blas/base/scabs1/examples/c/example.c | 2 +- .../blas/base/scabs1/examples/index.js | 2 +- .../scabs1/include/stdlib/blas/base/scabs1.h | 2 +- .../include/stdlib/blas/base/scabs1_cblas.h | 2 +- .../include/stdlib/blas/base/scabs1_fortran.h | 2 +- .../@stdlib/blas/base/scabs1/lib/index.js | 2 +- .../@stdlib/blas/base/scabs1/lib/main.js | 2 +- .../@stdlib/blas/base/scabs1/lib/native.js | 2 +- .../@stdlib/blas/base/scabs1/manifest.json | 32 +++++++++---------- .../@stdlib/blas/base/scabs1/src/scabs1.c | 2 +- .../blas/base/scabs1/src/scabs1_cblas.c | 2 +- .../@stdlib/blas/base/scabs1/src/scabs1_f.c | 2 +- .../@stdlib/blas/base/scabs1/test/test.js | 10 +++--- .../blas/base/scabs1/test/test.native.js | 10 +++--- 21 files changed, 49 insertions(+), 49 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/README.md b/lib/node_modules/@stdlib/blas/base/scabs1/README.md index 424f964a6e38..6e67fcd6adea 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/README.md +++ b/lib/node_modules/@stdlib/blas/base/scabs1/README.md @@ -20,7 +20,7 @@ limitations under the License. # scabs1 -> Compute the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32] floating-point number. +> Compute the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32/ctor] floating-point number.
@@ -32,10 +32,10 @@ var scabs1 = require( '@stdlib/blas/base/scabs1' ); #### scabs1( z ) -Computes the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32] floating-point number. +Computes the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32/ctor] floating-point number. ```javascript -var Complex64 = require( '@stdlib/complex/float32' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var y = scabs1( new Complex64( 5.0, -3.0 ) ); // returns 8.0 @@ -52,7 +52,7 @@ var y = scabs1( new Complex64( 5.0, -3.0 ) ); ```javascript -var Complex64 = require( '@stdlib/complex/float32' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var scabs1 = require( '@stdlib/blas/base/scabs1' ); @@ -82,7 +82,7 @@ for ( i = 0; i < 100; i++ ) { [absolute-value]: https://en.wikipedia.org/wiki/Absolute_value -[@stdlib/complex/float32]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32 +[@stdlib/complex/float32/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/complex/float32/ctor
diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js index 4dffd96ae951..a0d1b0b431d8 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.js @@ -23,7 +23,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var Complex64 = require( '@stdlib/complex/float32' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var pkg = require( './../package.json' ).name; var scabs1 = require( './../lib' ); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js index 9a8cd463b7c9..ace3218e5782 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/benchmark.native.js @@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var Complex64 = require( '@stdlib/complex/float32' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c index dd0dc2e01cbc..9eb7679b1b2f 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/benchmark.length.c @@ -20,7 +20,7 @@ * Benchmark `scabs1`. */ #include "stdlib/blas/base/scabs1.h" -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" #include #include #include diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt index 8c351b33f582..566a816bce87 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/repl.txt @@ -15,7 +15,7 @@ Examples -------- - > var y = {{alias}}( new {{alias:@stdlib/complex/float32}}( 5.0, -3.0 ) ) + > var y = {{alias}}( new {{alias:@stdlib/complex/float32/ctor}}( 5.0, -3.0 ) ) 8.0 See Also diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts index e8e854aa8f81..12d29a3590d6 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/index.d.ts @@ -29,7 +29,7 @@ import { Complex64 } from '@stdlib/types/complex'; * @returns result * * @example -* var Complex64 = require( '@stdlib/complex/float32' ); +* var Complex64 = require( '@stdlib/complex/float3/ctor' ); * * var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts index 7d106fad6e87..b23744353bb7 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/scabs1/docs/types/test.ts @@ -16,7 +16,7 @@ * limitations under the License. */ -import Complex64 = require( '@stdlib/complex/float32' ); +import Complex64 = require( '@stdlib/complex/float32/ctor' ); import scabs1 = require( './index' ); @@ -24,7 +24,7 @@ import scabs1 = require( './index' ); // The function returns a number... { - scabs1( new Complex64( 5, 3 ) ); // $ExpectType number + scabs1( new Complex64( 5.0, 3.0 ) ); // $ExpectType number } // The compiler throws an error if the function is not provided a complex number... diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c index e6423ae676ae..2d19c2ae1aa2 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c @@ -17,7 +17,7 @@ */ #include "stdlib/blas/base/scabs1.h" -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" #include "stdlib/complex/realf.h" #include "stdlib/complex/imagf.h" #include diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js b/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js index f05d6f97c177..1d682c7b2917 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/index.js @@ -18,7 +18,7 @@ 'use strict'; -var Complex128 = require( '@stdlib/complex/float64' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; var scabs1 = require( './../lib' ); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h index 122c2a08d12b..4fcae32b7dd6 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1.h @@ -22,7 +22,7 @@ #ifndef SCABS1_H #define SCABS1_H -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h index 97013e00623d..ae544e8dc5e5 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_cblas.h @@ -22,7 +22,7 @@ #ifndef SCABS1_CBLAS_H #define SCABS1_CBLAS_H -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h index 9f9dc15e4b7d..62c53b58fdd0 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h +++ b/lib/node_modules/@stdlib/blas/base/scabs1/include/stdlib/blas/base/scabs1_fortran.h @@ -22,7 +22,7 @@ #ifndef SCABS1_FORTRAN_H #define SCABS1_FORTRAN_H -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js index ecd69a1b52ac..13112918d196 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/index.js @@ -24,7 +24,7 @@ * @module @stdlib/blas/base/scabs1 * * @example -* var Complex64 = require( '@stdlib/complex/float32' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); * var scabs1 = require( '@stdlib/blas/base/scabs1' ); * * var v = scabs1( new Complex64( 5.0, -3.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js index 926c7c110d2a..16e05452e758 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/main.js @@ -34,7 +34,7 @@ var imagf = require( '@stdlib/complex/imagf' ); * @returns {number} result * * @example -* var Complex64 = require( '@stdlib/complex/float32' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); * * var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js index 57a1a0b71bea..0d6217027d94 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/lib/native.js @@ -33,7 +33,7 @@ var addon = require( './../src/addon.node' ); * @returns {number} result * * @example -* var Complex64 = require( '@stdlib/complex/float32' ); +* var Complex64 = require( '@stdlib/complex/float32/ctor' ); * * var v = scabs1( new Complex64( 5.0, -3.0 ) ); * // returns 8.0 diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json index 574871289c77..2bd83c9ad47c 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json @@ -48,7 +48,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" ] @@ -68,7 +68,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf" ] }, @@ -87,7 +87,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf", "@stdlib/complex/realf", "@stdlib/complex/imagf" @@ -115,7 +115,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" ] @@ -137,7 +137,7 @@ ], "libpath": [], "dependencies": [ - "@stdlib/complex/float32" + "@stdlib/complex/float32/ctor" ] }, { @@ -182,7 +182,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" ] @@ -202,7 +202,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf" ] }, @@ -221,7 +221,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf", "@stdlib/complex/realf", "@stdlib/complex/imagf" @@ -248,7 +248,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" ] @@ -269,7 +269,7 @@ ], "libpath": [], "dependencies": [ - "@stdlib/complex/float32" + "@stdlib/complex/float32/ctor" ] }, { @@ -314,7 +314,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" ] @@ -336,7 +336,7 @@ ], "libpath": [], "dependencies": [ - "@stdlib/complex/float32" + "@stdlib/complex/float32/ctor" ] }, { @@ -379,7 +379,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/math/base/special/absf", "@stdlib/complex/reimf" ] @@ -399,7 +399,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf" ] }, @@ -418,7 +418,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf", "@stdlib/complex/realf", "@stdlib/complex/imagf" @@ -440,7 +440,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/special/absf", - "@stdlib/complex/float32", + "@stdlib/complex/float32/ctor", "@stdlib/complex/reimf" ] } diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c index 696068972514..b6572ed1385c 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1.c @@ -18,7 +18,7 @@ #include "stdlib/blas/base/scabs1.h" #include "stdlib/math/base/special/absf.h" -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" #include "stdlib/complex/reimf.h" /** diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c index c8a31c4bed44..22212bfa1346 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_cblas.c @@ -18,7 +18,7 @@ #include "stdlib/blas/base/scabs1.h" #include "stdlib/blas/base/scabs1_cblas.h" -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" /** * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c index 0f16d9b0e004..a5c262349468 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/src/scabs1_f.c @@ -18,7 +18,7 @@ #include "stdlib/blas/base/scabs1.h" #include "stdlib/blas/base/scabs1_fortran.h" -#include "stdlib/complex/float32.h" +#include "stdlib/complex/float32/ctor.h" /** * Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point number. diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js index b093f0b4c702..d85f6f99c63f 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.js @@ -21,9 +21,9 @@ // MODULES // var tape = require( 'tape' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var Float32Array = require( '@stdlib/array/float32' ); -var Complex64 = require( '@stdlib/complex/float32' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var scabs1 = require( './../lib' ); @@ -57,13 +57,13 @@ tape( 'if either the real or imaginary component is `NaN`, the function returns var v; v = scabs1( new Complex64( NaN, 3.0 ) ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnanf( v ), true, 'returns expected value' ); v = scabs1( new Complex64( 5.0, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnanf( v ), true, 'returns expected value' ); v = scabs1( new Complex64( NaN, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnanf( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js index 2ea5e37e34f6..34a186c68740 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js +++ b/lib/node_modules/@stdlib/blas/base/scabs1/test/test.native.js @@ -22,9 +22,9 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var Float32Array = require( '@stdlib/array/float32' ); -var Complex64 = require( '@stdlib/complex/float32' ); +var Complex64 = require( '@stdlib/complex/float32/ctor' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -66,13 +66,13 @@ tape( 'if either the real or imaginary component is `NaN`, the function returns var v; v = scabs1( new Complex64( NaN, 3.0 ) ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnanf( v ), true, 'returns expected value' ); v = scabs1( new Complex64( 5.0, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnanf( v ), true, 'returns expected value' ); v = scabs1( new Complex64( NaN, NaN ) ); - t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.strictEqual( isnanf( v ), true, 'returns expected value' ); t.end(); }); From 8d8e966d9a734f186b09af3090c615769447725f Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 5 Jun 2024 18:26:08 -0700 Subject: [PATCH 20/26] fix: update function names --- lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c index 2d19c2ae1aa2..422b2a8d4e2e 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/base/scabs1/examples/c/example.c @@ -34,6 +34,6 @@ int main( void ) { int i; for ( i = 0; i < 4; i++ ) { y = c_scabs1( x[ i ] ); - printf( "f(%f + %f) = %f\n", realf( x[ i ] ), imagf( x[ i ] ), y ); + printf( "f(%f + %f) = %f\n", stdlib_realf( x[ i ] ), stdlib_imagf( x[ i ] ), y ); } } From a37d108ca33a936fd9bc992188a86dac7aed173a Mon Sep 17 00:00:00 2001 From: aman-095 Date: Thu, 6 Jun 2024 14:03:19 +0530 Subject: [PATCH 21/26] chore: apply review changes --- .../@stdlib/blas/base/scabs1/README.md | 102 +++++++++++++++++- .../blas/base/scabs1/benchmark/benchmark.js | 13 +-- .../base/scabs1/benchmark/benchmark.native.js | 9 +- .../blas/base/scabs1/benchmark/c/Makefile | 2 +- .../c/{benchmark.length.c => benchmark.c} | 0 .../base/scabs1/benchmark/fortran/Makefile | 2 +- .../{benchmark.length.f => benchmark.f} | 0 .../blas/base/scabs1/examples/index.js | 8 +- 8 files changed, 111 insertions(+), 25 deletions(-) rename lib/node_modules/@stdlib/blas/base/scabs1/benchmark/c/{benchmark.length.c => benchmark.c} (100%) rename lib/node_modules/@stdlib/blas/base/scabs1/benchmark/fortran/{benchmark.length.f => benchmark.f} (100%) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/README.md b/lib/node_modules/@stdlib/blas/base/scabs1/README.md index 6e67fcd6adea..ebd54d107c0d 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/README.md +++ b/lib/node_modules/@stdlib/blas/base/scabs1/README.md @@ -56,11 +56,11 @@ var Complex64 = require( '@stdlib/complex/float32/ctor' ); var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var scabs1 = require( '@stdlib/blas/base/scabs1' ); -var z; +var c; var i; for ( i = 0; i < 100; i++ ) { - z = new Complex64( discreteUniform( -50, 50 ), discreteUniform( -50, 50 ) ); - console.log( 'scabs1(%s) = %d', z.toString(), scabs1( z ) ); + c = new Complex64( discreteUniform( -50, 50 ), discreteUniform( -50, 50 ) ); + console.log( 'scabs1(%s) = %d', c.toString(), scabs1( c ) ); } ``` @@ -68,6 +68,102 @@ for ( i = 0; i < 100; i++ ) { + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/scabs1.h" +``` + +#### c_scabs1( c ) + +Computes the sum of the [absolute values][absolute-value] of the real and imaginary components of a single-precision [complex][@stdlib/complex/float32/ctor] floating-point number. + +```c +#include "stdlib/complex/float32/ctor.h" + +const stdlib_complex64_t c = stdlib_complex64( 3.14f, 1.0f ); + +c_scabs1( c ); +``` + +The function accepts the following arguments: + +- **c**: `[in] stdlib_complex64_t` complex number. + +```c +void c_scabs1( const stdlib_complex64_t c ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/scabs1.h" +#include "stdlib/complex/float32/ctor.h" +#include "stdlib/complex/realf.h" +#include "stdlib/complex/imagf.h" +#include + +int main( void ) { + const stdlib_complex64_t x[] = { + stdlib_complex64( 3.14f, 1.0f ), + stdlib_complex64( -3.14f, -1.0f ), + stdlib_complex64( 0.0f, 0.0f ), + stdlib_complex64( 0.0f/0.0f, 0.0f/0.0f ) + }; + + float y; + int i; + for ( i = 0; i < 4; i++ ) { + y = c_scabs1( x[ i ] ); + printf( "f(%f + %f) = %f\n", stdlib_realf( x[ i ] ), stdlib_imagf( x[ i ] ), y ); + } +} +``` + +
+ + + +
+ + + From 403e79de5ad1eeebf51dbdb8b1b2aa4c2343b4d3 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 6 Jun 2024 17:51:40 -0700 Subject: [PATCH 26/26] fix: update build configurations --- .../@stdlib/blas/base/scabs1/manifest.json | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json index 2bd83c9ad47c..2257b93366ec 100644 --- a/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/scabs1/manifest.json @@ -48,9 +48,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32/ctor", - "@stdlib/math/base/special/absf", - "@stdlib/complex/reimf" + "@stdlib/complex/float32/ctor" ] }, { @@ -115,9 +113,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32/ctor", - "@stdlib/math/base/special/absf", - "@stdlib/complex/reimf" + "@stdlib/complex/float32/ctor" ] }, { @@ -157,6 +153,7 @@ ], "libpath": [], "dependencies": [ + "@stdlib/complex/float32/ctor", "@stdlib/complex/realf", "@stdlib/complex/imagf" ] @@ -182,9 +179,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32/ctor", - "@stdlib/math/base/special/absf", - "@stdlib/complex/reimf" + "@stdlib/complex/float32/ctor" ] }, { @@ -248,9 +243,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32/ctor", - "@stdlib/math/base/special/absf", - "@stdlib/complex/reimf" + "@stdlib/complex/float32/ctor" ] }, { @@ -288,6 +281,7 @@ ], "libpath": [], "dependencies": [ + "@stdlib/complex/float32/ctor", "@stdlib/complex/realf", "@stdlib/complex/imagf" ] @@ -314,9 +308,7 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-complex64", "@stdlib/napi/create-double", - "@stdlib/complex/float32/ctor", - "@stdlib/math/base/special/absf", - "@stdlib/complex/reimf" + "@stdlib/complex/float32/ctor" ] }, { @@ -356,6 +348,7 @@ ], "libpath": [], "dependencies": [ + "@stdlib/complex/float32/ctor", "@stdlib/complex/realf", "@stdlib/complex/imagf" ]