diff --git a/lib/node_modules/@stdlib/blas/base/gdot/README.md b/lib/node_modules/@stdlib/blas/base/gdot/README.md
index 1c92a3246636..e55fd8521193 100644
--- a/lib/node_modules/@stdlib/blas/base/gdot/README.md
+++ b/lib/node_modules/@stdlib/blas/base/gdot/README.md
@@ -2,7 +2,7 @@
@license Apache-2.0
-Copyright (c) 2020 The Stdlib Authors.
+Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -169,17 +169,141 @@ console.log( out );
-
-
-
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/benchmark.native.js
new file mode 100644
index 000000000000..aaf37bfed330
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/benchmark.native.js
@@ -0,0 +1,108 @@
+/**
+* @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/array/uniform' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var tryRequire = require( '@stdlib/utils/try-require' );
+var pkg = require( './../package.json' ).name;
+
+
+// VARIABLES //
+
+var gdot = tryRequire( resolve( __dirname, './../lib/caxpy.native.js' ) );
+var opts = {
+ 'skip': ( gdot instanceof Error )
+};
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var x = uniform( len, -100.0, 100.0, options );
+ var y = uniform( len, -100.0, 100.0, options );
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var z;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ z = gdot( len, x, 1, y, 1 );
+ if ( isnan( z ) ) {
+ b.fail( 'something went wrong' );
+ }
+ }
+ b.toc();
+ if ( isnan( z ) ) {
+ b.fail( 'something went wrong' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+'::native:len='+len, opts, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/benchmark.ndarray.native.js
new file mode 100644
index 000000000000..16e3ec88b4dd
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/benchmark.ndarray.native.js
@@ -0,0 +1,108 @@
+/**
+* @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/array/uniform' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var tryRequire = require( '@stdlib/utils/try-require' );
+var pkg = require( './../package.json' ).name;
+
+
+// VARIABLES //
+
+var gdot = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
+var opts = {
+ 'skip': ( gdot instanceof Error )
+};
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var x = uniform( len, -100.0, 100.0, options );
+ var y = uniform( len, -100.0, 100.0, options );
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var z;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ z = gdot( len, x, 1, 0, y, 1, 0 );
+ if ( isnan( z ) ) {
+ b.fail( 'something went wrong' );
+ }
+ }
+ b.toc();
+ if ( isnan( z ) ) {
+ b.fail( 'something went wrong' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+'::native:ndarray:len='+len, opts, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/c/Makefile
new file mode 100644
index 000000000000..9f97140e7cb0
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/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/gdot/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/c/benchmark.length.c
new file mode 100644
index 000000000000..07c3fa332c68
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/benchmark/c/benchmark.length.c
@@ -0,0 +1,195 @@
+/**
+* @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/gdot.h"
+#include
+#include
+#include
+#include
+#include
+
+#define NAME "gdot"
+#define ITERATIONS 10000000
+#define REPEATS 3
+#define MIN 1
+#define MAX 6
+
+/**
+* Prints the TAP version.
+*/
+static 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
+*/
+static 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
+*/
+static 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
+*/
+static 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
+*/
+static double rand_double( void ) {
+ int r = rand();
+ return (double)r / ( (double)RAND_MAX + 1.0 );
+}
+
+/**
+* Runs a benchmark.
+*
+* @param iterations number of iterations
+* @param len array length
+* @return elapsed time in seconds
+*/
+static double benchmark1( int iterations, int len ) {
+ double elapsed;
+ double x[ len ];
+ double y[ len ];
+ double z;
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_double()*20000.0 ) - 10000.0;
+ y[ i ] = ( rand_double()*20000.0 ) - 10000.0;
+ }
+ z = 0.0;
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ z = c_gdot( len, x, 1, y, 1 );
+ if ( z != z ) {
+ printf( "should not return NaN\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( z != z ) {
+ printf( "should not return NaN\n" );
+ }
+ return elapsed;
+}
+
+/**
+* Runs a benchmark.
+*
+* @param iterations number of iterations
+* @param len array length
+* @return elapsed time in seconds
+*/
+static double benchmark2( int iterations, int len ) {
+ double elapsed;
+ double x[ len ];
+ double y[ len ];
+ double z;
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_double()*20000.0 ) - 10000.0;
+ y[ i ] = ( rand_double()*20000.0 ) - 10000.0;
+ }
+ z = 0.0;
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ z = c_gdot_ndarray( len, x, 1, 0, y, 1, 0 );
+ if ( z != z ) {
+ printf( "should not return NaN\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( z != z ) {
+ printf( "should not return NaN\n" );
+ }
+ return elapsed;
+}
+
+/**
+* Main execution sequence.
+*/
+int main( void ) {
+ double elapsed;
+ int count;
+ int iter;
+ int len;
+ 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++ ) {
+ len = pow( 10, i );
+ iter = ITERATIONS / pow( 10, i-1 );
+ for ( j = 0; j < REPEATS; j++ ) {
+ count += 1;
+ printf( "# c::%s:len=%d\n", NAME, len );
+ elapsed = benchmark1( iter, len );
+ print_results( iter, elapsed );
+ printf( "ok %d benchmark finished\n", count );
+ }
+ for ( j = 0; j < REPEATS; j++ ) {
+ count += 1;
+ printf( "# c::%s:ndarray:len=%d\n", NAME, len );
+ elapsed = benchmark2( iter, len );
+ print_results( iter, elapsed );
+ printf( "ok %d benchmark finished\n", count );
+ }
+ }
+ print_summary( count, count );
+}
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/binding.gyp b/lib/node_modules/@stdlib/blas/base/gdot/binding.gyp
new file mode 100644
index 000000000000..02a2799da097
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/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/gdot/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/gdot/examples/c/Makefile
new file mode 100644
index 000000000000..6aed70daf167
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/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/gdot/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/gdot/examples/c/example.c
new file mode 100644
index 000000000000..a2a6c4a9731a
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/examples/c/example.c
@@ -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.
+*/
+
+#include "stdlib/blas/base/gdot.h"
+#include
+
+int main( void ) {
+ // Create strided arrays:
+ const double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
+ const double y[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
+
+ // Specify the number of elements:
+ const int N = 8;
+
+ // Specify strides:
+ const int strideX = 1;
+ const int strideY = -1;
+
+ // Compute the dot product:
+ double d = c_gdot( N, x, strideX, y, strideY );
+
+ // Print the result:
+ printf( "dot product: %lf\n", d );
+
+ // Compute the dot product:
+ d = c_ddot_ndarray( N, x, strideX, 0, y, strideY, N-1 );
+
+ // Print the result:
+ printf( "dot product: %lf\n", d );
+}
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/include.gypi b/lib/node_modules/@stdlib/blas/base/gdot/include.gypi
new file mode 100644
index 000000000000..497aeca15320
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/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 ) {
- for ( i = 0; i < m; i++ ) {
- dot += x[ i ] * y[ i ];
- }
- }
- if ( N < M ) {
- return dot;
- }
- for ( i = m; i < N; i += M ) {
- dot += ( x[i]*y[i] ) + ( x[i+1]*y[i+1] ) + ( x[i+2]*y[i+2] ) + ( x[i+3]*y[i+3] ) + ( x[i+4]*y[i+4] ); // eslint-disable-line max-len
- }
- return dot;
- }
- if ( strideX < 0 ) {
- ix = ( 1-N ) * strideX;
- } else {
- ix = 0;
- }
- if ( strideY < 0 ) {
- iy = ( 1-N ) * strideY;
- } else {
- iy = 0;
- }
- for ( i = 0; i < N; i++ ) {
- dot += ( x[ ix ] * y[ iy ] );
- ix += strideX;
- iy += strideY;
- }
- return dot;
-}
+setReadOnly( gdot, 'ndarray', ndarray );
// EXPORTS //
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/lib/native.js b/lib/node_modules/@stdlib/blas/base/gdot/lib/native.js
new file mode 100644
index 000000000000..d61cc3c034a3
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/lib/native.js
@@ -0,0 +1,35 @@
+/**
+* @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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var gdot = require( './gdot.native.js' );
+var ndarray = require( './ndarray.native.js' );
+
+
+// MAIN //
+
+setReadOnly( gdot, 'ndarray', ndarray );
+
+
+// EXPORTS //
+
+module.exports = gdot;
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.js
index c8323ae20eaa..22173e145f8e 100644
--- a/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.js
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
-* Copyright (c) 2020 The Stdlib Authors.
+* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ var M = 5;
// MAIN //
/**
-* Computes the dot product of `x` and `y`.
+* Computes the dot product of vectors `x` and `y`.
*
* @param {integer} N - number of indexed elements
* @param {NumericArray} x - first input array
@@ -74,7 +74,7 @@ function gdot( N, x, strideX, offsetX, y, strideY, offsetY ) {
return dot;
}
for ( i = m; i < N; i += M ) {
- dot += ( x[ix]*y[iy] ) + ( x[ix+1]*y[iy+1] ) + ( x[ix+2]*y[iy+2] ) + ( x[ix+3]*y[iy+3] ) + ( x[ix+4]*y[iy+4] ); // eslint-disable-line max-len
+ dot += ( x[ ix ]*y[ iy ] ) + ( x[ ix+1 ]*y[ iy+1 ] ) + ( x[ ix+2 ]*y[ iy+2 ] ) + ( x[ ix+3 ]*y[ iy+3 ] ) + ( x[ ix+4 ]*y[ iy+4 ] ); // eslint-disable-line max-len
ix += M;
iy += M;
}
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.native.js
new file mode 100644
index 000000000000..fd82d7dbb81b
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/lib/ndarray.native.js
@@ -0,0 +1,54 @@
+/**
+* @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 addon = require( './../src/addon.node' );
+
+
+// MAIN //
+
+/**
+* Computes the dot product of vectors `x` and `y`.
+*
+* @param {integer} N - number of indexed elements
+* @param {NumericArray} x - first input array
+* @param {integer} strideX - `x` stride length
+* @param {NonNegativeInteger} offsetX - starting index for `x`
+* @param {NumericArray} y - second input array
+* @param {integer} strideY - `y` stride length
+* @param {NonNegativeInteger} offsetY - starting index for `y`
+* @returns {number} dot product
+*
+* @example
+* var x = [ 4.0, 2.0, -3.0, 5.0, -1.0 ];
+* var y = [ 2.0, 6.0, -1.0, -4.0, 8.0 ];
+
+* var z = gdot( x.length, x, 1, 0, y, 1, 0 );
+* // returns -5.0
+*/
+function gdot( N, x, strideX, offsetX, y, strideY, offsetY ) {
+ return addon.ndarray( N, x, strideX, offsetX, y, strideY, offsetY );
+}
+
+
+// EXPORTS //
+
+module.exports = gdot;
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/manifest.json b/lib/node_modules/@stdlib/blas/base/gdot/manifest.json
new file mode 100644
index 000000000000..847ce2914d71
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/manifest.json
@@ -0,0 +1,396 @@
+{
+ "options": {
+ "task": "build",
+ "os": "linux",
+ "blas": "",
+ "wasm": false
+ },
+ "fields": [
+ {
+ "field": "src",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "include",
+ "resolve": true,
+ "relative": true
+ },
+ {
+ "field": "libraries",
+ "resolve": false,
+ "relative": false
+ },
+ {
+ "field": "libpath",
+ "resolve": true,
+ "relative": false
+ }
+ ],
+ "confs": [
+ {
+ "task": "benchmark",
+ "os": "linux",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+ {
+ "task": "examples",
+ "os": "linux",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+
+ {
+ "task": "build",
+ "os": "linux",
+ "blas": "openblas",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lopenblas",
+ "-lpthread"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/napi/export",
+ "@stdlib/napi/argv",
+ "@stdlib/napi/argv-int64",
+ "@stdlib/napi/argv-strided-float64array",
+ "@stdlib/napi/create-double"
+ ]
+ },
+ {
+ "task": "benchmark",
+ "os": "linux",
+ "blas": "openblas",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lopenblas",
+ "-lpthread"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index"
+ ]
+ },
+ {
+ "task": "examples",
+ "os": "linux",
+ "blas": "openblas",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lopenblas",
+ "-lpthread"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index"
+ ]
+ },
+
+ {
+ "task": "benchmark",
+ "os": "mac",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+ {
+ "task": "examples",
+ "os": "mac",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+
+ {
+ "task": "build",
+ "os": "mac",
+ "blas": "apple_accelerate_framework",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lblas"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/napi/export",
+ "@stdlib/napi/argv",
+ "@stdlib/napi/argv-int64",
+ "@stdlib/napi/argv-strided-float64array",
+ "@stdlib/napi/create-double"
+ ]
+ },
+ {
+ "task": "benchmark",
+ "os": "mac",
+ "blas": "apple_accelerate_framework",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lblas"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index"
+ ]
+ },
+ {
+ "task": "examples",
+ "os": "mac",
+ "blas": "apple_accelerate_framework",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lblas"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index"
+ ]
+ },
+
+ {
+ "task": "build",
+ "os": "mac",
+ "blas": "openblas",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lopenblas",
+ "-lpthread"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index",
+ "@stdlib/napi/export",
+ "@stdlib/napi/argv",
+ "@stdlib/napi/argv-int64",
+ "@stdlib/napi/argv-strided-float64array",
+ "@stdlib/napi/create-double"
+ ]
+ },
+ {
+ "task": "benchmark",
+ "os": "mac",
+ "blas": "openblas",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lopenblas",
+ "-lpthread"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index"
+ ]
+ },
+ {
+ "task": "examples",
+ "os": "mac",
+ "blas": "openblas",
+ "wasm": false,
+ "src": [
+ "./src/gdot_cblas.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [
+ "-lopenblas",
+ "-lpthread"
+ ],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/min-view-buffer-index"
+ ]
+ },
+
+ {
+ "task": "build",
+ "os": "win",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/napi/export",
+ "@stdlib/napi/argv",
+ "@stdlib/napi/argv-int64",
+ "@stdlib/napi/argv-strided-float64array",
+ "@stdlib/napi/create-double"
+ ]
+ },
+ {
+ "task": "benchmark",
+ "os": "win",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+ {
+ "task": "examples",
+ "os": "win",
+ "blas": "",
+ "wasm": false,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+
+ {
+ "task": "build",
+ "os": "",
+ "blas": "",
+ "wasm": true,
+ "src": [
+ "./src/gdot.c",
+ "./src/gdot_ndarray.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ }
+ ]
+}
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/package.json b/lib/node_modules/@stdlib/blas/base/gdot/package.json
index c1c61334c44e..30402ccc1e60 100644
--- a/lib/node_modules/@stdlib/blas/base/gdot/package.json
+++ b/lib/node_modules/@stdlib/blas/base/gdot/package.json
@@ -14,11 +14,15 @@
}
],
"main": "./lib",
+ "browser": "./lib/main.js",
+ "gypfile": true,
"directories": {
"benchmark": "./benchmark",
"doc": "./docs",
"example": "./examples",
+ "include": "./include",
"lib": "./lib",
+ "src": "./src",
"test": "./test"
},
"types": "./docs/types",
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/src/Makefile b/lib/node_modules/@stdlib/blas/base/gdot/src/Makefile
new file mode 100644
index 000000000000..bcf18aa46655
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/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/gdot/src/addon.c b/lib/node_modules/@stdlib/blas/base/gdot/src/addon.c
new file mode 100644
index 000000000000..d0521c0ee0d5
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/src/addon.c
@@ -0,0 +1,66 @@
+/**
+* @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/gdot.h"
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/napi/export.h"
+#include "stdlib/napi/argv.h"
+#include "stdlib/napi/argv_int64.h"
+#include "stdlib/napi/argv_strided_float64array.h"
+#include "stdlib/napi/create_double.h"
+#include
+
+/**
+* Receives JavaScript callback invocation data.
+*
+* @param env environment under which the function is invoked
+* @param info callback data
+* @return Node-API value
+*/
+static napi_value addon( napi_env env, napi_callback_info info ) {
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 5 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 3 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(c_gdot)( N, X, strideX, Y, strideY ), v );
+ return v;
+}
+
+/**
+* Receives JavaScript callback invocation data.
+*
+* @param env environment under which the function is invoked
+* @param info callback data
+* @return Node-API value
+*/
+static napi_value addon_method( napi_env env, napi_callback_info info ) {
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 7 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
+ STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Y, N, strideY, argv, 4 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(c_gdot_ndarray)( N, X, strideX, offsetX, Y, strideY, offsetY ), v );
+ return v;
+}
+
+STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method )
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/src/gdot.c b/lib/node_modules/@stdlib/blas/base/gdot/src/gdot.c
new file mode 100644
index 000000000000..e0579303d055
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/src/gdot.c
@@ -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.
+*/
+
+#include "stdlib/blas/base/gdot.h"
+
+static const CBLAS_INT M = 5;
+
+/**
+* Computes the dot product of vectors `x` and `y`.
+*
+* @param N number of indexed elements
+* @param X first input array
+* @param strideX X stride length
+* @param Y second input array
+* @param strideY Y stride length
+* @return dot product
+*/
+double API_SUFFIX(c_gdot)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY ) {
+ double dot;
+ CBLAS_INT ix;
+ CBLAS_INT iy;
+ CBLAS_INT m;
+ CBLAS_INT i;
+
+ dot = 0.0;
+ if ( N <= 0 ) {
+ return dot;
+ }
+ // Use unrolled loops if both strides are equal to `1`...
+ if ( strideX == 1 && strideY == 1) {
+ m = N % M;
+
+ // If we have a remainder, run a clean-up loop...
+ if ( m > 0 ) {
+ for ( i = 0; i < m; i++ ) {
+ dot += X[ i ] * Y[ i ];
+ }
+ }
+ if ( N < M ) {
+ return dot;
+ }
+ for ( i = m; i < N; i += M ) {
+ dot += ( X[ i ]*Y[ i ] ) + ( X[ i+1 ]*Y[ i+1 ] ) + ( X[ i+2 ]*Y[ i+2 ] ) + ( X[ i+3 ]*Y[ i+3 ] ) + ( X[ i+4 ]*Y[ i+4 ] ); // eslint-disable-line max-len
+ }
+ return dot;
+ }
+ if ( strideX < 0 ) {
+ ix = ( 1-N ) * strideX;
+ } else {
+ ix = 0;
+ }
+ if ( strideY < 0 ) {
+ iy = ( 1-N ) * strideY;
+ } else {
+ iy = 0;
+ }
+ for ( i = 0; i < N; i++ ) {
+ dot += ( X[ ix ] * Y[ iy ] );
+ ix += strideX;
+ iy += strideY;
+ }
+ return dot;
+}
+
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/src/gdot_cblas.c b/lib/node_modules/@stdlib/blas/base/gdot/src/gdot_cblas.c
new file mode 100644
index 000000000000..00fd15faabfe
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/src/gdot_cblas.c
@@ -0,0 +1,54 @@
+/**
+* @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/gdot.h"
+#include "stdlib/blas/base/gdot_cblas.h"
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/strided/base/min_view_buffer_index.h"
+
+/**
+* Computes the dot product of vectors `x` and `y`.
+*
+* @param N number of indexed elements
+* @param X first input array
+* @param strideX X stride length
+* @param Y second input array
+* @param strideY Y stride length
+* @return dot product
+*/
+double API_SUFFIX(c_gdot)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY ) {
+ return API_SUFFIX(cblas_gdot)( N, X, strideX, Y, strideY );
+}
+
+/**
+* Computes the dot product of `x` and `y` using alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param X first input array
+* @param strideX X stride length
+* @param offsetX starting index for X
+* @param Y second input array
+* @param strideY Y stride length
+* @param offsetY starting index for Y
+* @return dot product
+*/
+double API_SUFFIX(c_gdot_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
+ X += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer
+ Y += stdlib_strided_min_view_buffer_index( N, strideY, offsetY ); // adjust array pointer
+ return API_SUFFIX(cblas_gdot_ndarray)( N, X, strideX, Y, strideY );
+}
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/src/gdot_ndarray.c b/lib/node_modules/@stdlib/blas/base/gdot/src/gdot_ndarray.c
new file mode 100644
index 000000000000..3d37ad7e8f2a
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/src/gdot_ndarray.c
@@ -0,0 +1,78 @@
+/**
+* @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/gdot.h"
+#include "stdlib/blas/base/shared.h"
+
+static const CBLAS_INT M = 5;
+
+/**
+* Computes the dot product of `x` and `y` using alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param X first array
+* @param strideX X stride length
+* @param offsetX starting index for X
+* @param Y second array
+* @param strideY Y stride length
+* @param offsetY starting index for Y
+* @return dot product
+*/
+double API_SUFFIX(c_gdot_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, const double *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
+ double dot;
+ CBLAS_INT ix;
+ CBLAS_INT iy;
+ CBLAS_INT m;
+ CBLAS_INT i;
+
+ dot = 0.0;
+ if ( N <= 0 ) {
+ return dot;
+ }
+ ix = offsetX;
+ iy = offsetY;
+
+ // If both strides are equal to `1`, use unrolled loops...
+ if ( strideX == 1 && strideY == 1 ) {
+ m = N % M;
+
+ // If we have a remainder, do a clean-up loop...
+ if ( m > 0 ) {
+ for ( i = 0; i < m; i++ ) {
+ dot += ( X[ ix ] * Y[ iy ] );
+ ix += 1;
+ iy += 1;
+ }
+ }
+ if ( N < M ) {
+ return dot;
+ }
+ for ( i = m; i < N; i += M ) {
+ dot += ( X[ ix ]*Y[ iy ] ) + ( X[ ix+1 ]*Y[ iy+1 ] ) + ( X[ ix+2 ]*Y[ iy+2 ] ) + ( X[ ix+3 ]*Y[ iy+3 ] ) + ( X[ ix+4 ]*Y[ iy+4 ] ); // eslint-disable-line max-len
+ ix += M;
+ iy += M;
+ }
+ return dot;
+ }
+ for ( i = 0; i < N; i++ ) {
+ dot += X[ ix ] * Y[ iy ];
+ ix += strideX;
+ iy += strideY;
+ }
+ return dot;
+}
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/test/test.main.js b/lib/node_modules/@stdlib/blas/base/gdot/test/test.gdot.js
similarity index 99%
rename from lib/node_modules/@stdlib/blas/base/gdot/test/test.main.js
rename to lib/node_modules/@stdlib/blas/base/gdot/test/test.gdot.js
index 3e9dcd7d2d6f..ee665de7ebc9 100644
--- a/lib/node_modules/@stdlib/blas/base/gdot/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/base/gdot/test/test.gdot.js
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
-* Copyright (c) 2020 The Stdlib Authors.
+* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/test/test.gdot.native.js b/lib/node_modules/@stdlib/blas/base/gdot/test/test.gdot.native.js
new file mode 100644
index 000000000000..71eb7710f8fa
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/test/test.gdot.native.js
@@ -0,0 +1,251 @@
+/**
+* @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 Float64Array = require( '@stdlib/array/float64' );
+var tryRequire = require( '@stdlib/utils/try-require' );
+
+
+// VARIABLES //
+
+var gdot = tryRequire( resolve( __dirname, './../lib/caxpy.native.js' ) );
+var opts = {
+ 'skip': ( gdot instanceof Error )
+};
+
+
+// TESTS //
+
+tape( 'main export is a function', opts, function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gdot, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 5', opts, function test( t ) {
+ t.strictEqual( gdot.length, 5, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function calculates the dot product of arrays `x` and `y`', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ];
+ y = [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ];
+
+ dot = gdot( x.length, x, 1, y, 1 );
+ t.strictEqual( dot, -17.0, 'returns expected value' );
+
+ // Short datasets:
+ x = [ 3.0, -4.0, 1.0 ];
+ y = [ 1.0, -2.0, 3.0 ];
+
+ dot = gdot( x.length, x, 1, y, 1 );
+ t.strictEqual( dot, 14.0, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [ 3.0, -4.0, 1.0 ];
+ y = [ 1.0, -2.0, 3.0 ];
+
+ dot = gdot( 0, x, 1, y, 1 );
+ t.strictEqual( dot, 0.0, 'returns expected value' );
+
+ dot = gdot( -4, x, 1, y, 1 );
+ t.strictEqual( dot, 0.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports an `x` stride', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 2.0, // 0
+ -3.0,
+ -5.0, // 1
+ 7.0,
+ 6.0 // 2
+ ];
+ y = [
+ 8.0, // 0
+ 2.0, // 1
+ -3.0, // 2
+ 3.0,
+ -4.0,
+ 1.0
+ ];
+
+ dot = gdot( 3, x, 2, y, 1 );
+ t.strictEqual( dot, -12.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports a `y` stride', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 2.0, // 0
+ -3.0, // 1
+ -5.0, // 2
+ 7.0,
+ 6.0
+ ];
+ y = [
+ 8.0, // 0
+ 2.0,
+ -3.0, // 1
+ 3.0,
+ -4.0, // 2
+ 1.0
+ ];
+
+ dot = gdot( 3, x, 1, y, 2 );
+ t.strictEqual( dot, 45.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports negative strides', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 1.0, // 2
+ 2.0,
+ 3.0, // 1
+ 4.0,
+ 5.0 // 0
+ ];
+ y = [
+ 6.0, // 2
+ 7.0, // 1
+ 8.0, // 0
+ 9.0,
+ 10.0
+ ];
+
+ dot = gdot( 3, x, -2, y, -1 );
+ t.strictEqual( dot, 67.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports complex access patterns', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 1.0, // 0
+ 2.0,
+ 3.0, // 1
+ 4.0,
+ 5.0 // 2
+ ];
+ y = [
+ 6.0, // 2
+ 7.0, // 1
+ 8.0, // 0
+ 9.0,
+ 10.0
+ ];
+
+ dot = gdot( 3, x, 2, y, -1 );
+ t.strictEqual( dot, 59.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports view offsets', opts, function test( t ) {
+ var dot;
+ var x0;
+ var y0;
+ var x1;
+ var y1;
+
+ x0 = new Float64Array([
+ 1.0,
+ 2.0, // 0
+ 3.0,
+ 4.0, // 1
+ 5.0,
+ 6.0 // 2
+ ]);
+ y0 = new Float64Array([
+ 6.0,
+ 7.0,
+ 8.0,
+ 9.0, // 0
+ 10.0, // 1
+ 11.0 // 2
+ ]);
+
+ x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
+ y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 );
+
+ dot = gdot( 3, x1, 2, y1, 1 );
+ t.strictEqual( dot, 124.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'if both strides are equal to `1`, the function efficiently calculates the dot product', opts, function test( t ) {
+ var expected;
+ var dot;
+ var x;
+ var y;
+ var i;
+
+ expected = 0.0;
+ x = new Array( 100 );
+ y = new Array( x.length );
+ for ( i = 0; i < x.length; i++ ) {
+ x[ i ] = i;
+ y[ i ] = x.length - 1;
+ expected += x[ i ] * y[ i ];
+ }
+ dot = gdot( x.length, x, 1, y, 1 );
+ t.strictEqual( dot, expected, 'returns expected value' );
+
+ expected = 0.0;
+ x = new Array( 240 );
+ y = new Array( x.length );
+ for ( i = 0; i < x.length; i++ ) {
+ x[ i ] = i;
+ y[ i ] = x.length - 1;
+ expected += x[ i ] * y[ i ];
+ }
+ dot = gdot( x.length, x, 1, y, 1 );
+ t.strictEqual( dot, expected, 'returns expected value' );
+
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/base/gdot/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/gdot/test/test.ndarray.native.js
new file mode 100644
index 000000000000..43fb8042f358
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/base/gdot/test/test.ndarray.native.js
@@ -0,0 +1,275 @@
+/**
+* @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 Float64Array = require( '@stdlib/array/float64' );
+var tryRequire = require( '@stdlib/utils/try-require' );
+
+
+// VARIABLES //
+
+var gdot = tryRequire( resolve( __dirname, './../lib/caxpy.native.js' ) );
+var opts = {
+ 'skip': ( gdot instanceof Error )
+};
+
+// TESTS //
+
+tape( 'main export is a function', opts, function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gdot, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 7', opts, function test( t ) {
+ t.strictEqual( gdot.length, 7, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function calculates the dot product of arrays `x` and `y`', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ];
+ y = [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ];
+
+ dot = gdot( x.length, x, 1, 0, y, 1, 0 );
+ t.strictEqual( dot, -17.0, 'returns expected value' );
+
+ // Short datasets:
+ x = [ 3.0, -4.0, 1.0 ];
+ y = [ 1.0, -2.0, 3.0 ];
+
+ dot = gdot( x.length, x, 1, 0, y, 1, 0 );
+ t.strictEqual( dot, 14.0, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0`', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [ 3.0, -4.0, 1.0 ];
+ y = [ 1.0, -2.0, 3.0 ];
+
+ dot = gdot( 0, x, 1, 0, y, 1, 0 );
+ t.strictEqual( dot, 0.0, 'returns expected value' );
+
+ dot = gdot( -4, x, 1, 0, y, 1, 0 );
+ t.strictEqual( dot, 0.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports an `x` stride', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 2.0, // 0
+ -3.0,
+ -5.0, // 1
+ 7.0,
+ 6.0 // 2
+ ];
+ y = [
+ 8.0, // 0
+ 2.0, // 1
+ -3.0, // 2
+ 3.0,
+ -4.0,
+ 1.0
+ ];
+
+ dot = gdot( 3, x, 2, 0, y, 1, 0 );
+ t.strictEqual( dot, -12.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports an `x` offset', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 1.0,
+ 2.0, // 0
+ 3.0,
+ 4.0, // 1
+ 5.0,
+ 6.0 // 2
+ ];
+ y = [
+ 6.0, // 0
+ 7.0, // 1
+ 8.0, // 2
+ 9.0,
+ 10.0,
+ 11.0
+ ];
+
+ dot = gdot( 3, x, 2, 1, y, 1, 0 );
+ t.strictEqual( dot, 88.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports a `y` stride', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 2.0, // 0
+ -3.0, // 1
+ -5.0, // 2
+ 7.0,
+ 6.0
+ ];
+ y = [
+ 8.0, // 0
+ 2.0,
+ -3.0, // 1
+ 3.0,
+ -4.0, // 2
+ 1.0
+ ];
+
+ dot = gdot( 3, x, 1, 0, y, 2, 0 );
+ t.strictEqual( dot, 45.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports a `y` offset', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 1.0, // 0
+ 2.0,
+ 3.0, // 1
+ 4.0,
+ 5.0, // 2
+ 6.0
+ ];
+ y = [
+ 6.0,
+ 7.0,
+ 8.0,
+ 9.0, // 0
+ 10.0, // 1
+ 11.0 // 2
+ ];
+
+ dot = gdot( 3, x, 2, 0, y, 1, 3 );
+ t.strictEqual( dot, 94.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports negative strides', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 1.0, // 2
+ 2.0,
+ 3.0, // 1
+ 4.0,
+ 5.0 // 0
+ ];
+ y = [
+ 6.0, // 2
+ 7.0, // 1
+ 8.0, // 0
+ 9.0,
+ 10.0
+ ];
+
+ dot = gdot( 3, x, -2, x.length-1, y, -1, 2 );
+ t.strictEqual( dot, 67.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the function supports complex access patterns', opts, function test( t ) {
+ var dot;
+ var x;
+ var y;
+
+ x = [
+ 1.0, // 0
+ 2.0,
+ 3.0, // 1
+ 4.0,
+ 5.0 // 2
+ ];
+ y = [
+ 6.0,
+ 7.0, // 2
+ 8.0, // 1
+ 9.0, // 0
+ 10.0
+ ];
+
+ dot = gdot( 3, x, 2, 0, y, -1, y.length-2 );
+ t.strictEqual( dot, 68.0, 'returns expected value' );
+ t.end();
+});
+
+tape( 'if both strides are equal to `1`, the function efficiently calculates the dot product', opts, function test( t ) {
+ var expected;
+ var dot;
+ var x;
+ var y;
+ var i;
+
+ expected = 0.0;
+ x = new Float64Array( 100 );
+ y = new Float64Array( x.length );
+ for ( i = 0; i < x.length; i++ ) {
+ x[ i ] = i;
+ y[ i ] = x.length - i;
+ expected += x[ i ] * y[ i ];
+ }
+
+ dot = gdot( x.length, x, 1, 0, y, 1, 0 );
+
+ t.strictEqual( dot, expected, 'returns expected value' );
+
+ expected = 0.0;
+ x = new Float64Array( 240 );
+ y = new Float64Array( x.length );
+ for ( i = 0; i < x.length; i++ ) {
+ x[ i ] = i;
+ y[ i ] = x.length - i;
+ expected += x[ i ] * y[ i ];
+ }
+
+ dot = gdot( x.length, x, 1, 0, y, 1, 0 );
+
+ t.strictEqual( dot, expected, 'returns expected value' );
+ t.end();
+});