From 45d935c216aada8402ade868267193a72d1edea7 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 6 Apr 2025 13:57:44 +0530 Subject: [PATCH 01/18] feat: add c implementation for blas/base/dspr --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: missing_dependencies - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dspr/README.md | 83 ++- .../base/dspr/benchmark/benchmark.native.js | 109 ++++ .../benchmark/benchmark.ndarray.native.js | 109 ++++ .../blas/base/dspr/benchmark/c/Makefile | 146 +++++ .../base/dspr/benchmark/c/benchmark.length.c | 179 ++++++ .../@stdlib/blas/base/dspr/binding.gyp | 265 +++++++++ .../blas/base/dspr/examples/c/Makefile | 146 +++++ .../blas/base/dspr/examples/c/example.c | 46 ++ .../@stdlib/blas/base/dspr/include.gypi | 70 +++ .../base/dspr/include/stdlib/blas/base/dspr.h | 48 ++ .../include/stdlib/blas/base/dspr_cblas.h | 43 ++ .../@stdlib/blas/base/dspr/lib/dspr.native.js | 59 ++ .../@stdlib/blas/base/dspr/lib/native.js | 35 ++ .../blas/base/dspr/lib/ndarray.native.js | 59 ++ .../@stdlib/blas/base/dspr/manifest.json | 311 +++++++++++ .../@stdlib/blas/base/dspr/package.json | 3 + .../@stdlib/blas/base/dspr/src/Makefile | 70 +++ .../@stdlib/blas/base/dspr/src/addon.c | 84 +++ .../@stdlib/blas/base/dspr/src/dspr.c | 106 ++++ .../@stdlib/blas/base/dspr/src/dspr_cblas.c | 36 ++ .../blas/base/dspr/test/test.dspr.native.js | 298 ++++++++++ .../base/dspr/test/test.ndarray.native.js | 518 ++++++++++++++++++ 22 files changed, 2816 insertions(+), 7 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/binding.gyp create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/examples/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/examples/c/example.c create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/include.gypi create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr_cblas.h create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/lib/native.js create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/manifest.json create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/src/Makefile create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/src/addon.c create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index eb930c6c66a8..017e4f856b44 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -183,21 +183,63 @@ console.log( AP ); ### Usage ```c -TODO +#include "stdlib/blas/base/dspr.h" ``` -#### TODO +#### c_dspr( order, uplo, N, alpha, \*X, strideX, \*AP ) -TODO. +Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. + +```c +#include "stdlib/blas/base/shared.h" + +double AP[] = { 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 }; +const double x[] = { 1.0, 2.0, 3.0 }; + +c_dspr( CblasColMajor, CblasUpper, 3, 1.0, x, 1, AP ); +``` + +The function accepts the following arguments: + +- **order**: `[in] CBLAS_LAYOUT` storage layout. +- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. +- **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. +- **alpha**: `[in] double` scalar. +- **X**: `[in] double*` input vector. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **AP**: `[inout] double*` packed form of a symmetric matrix `A`. ```c -TODO +void c_dspr( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) ``` -TODO +#### c_dspr_ndarray( order, uplo, N, alpha, \*X, strideX, \*AP, strideAP, offsetAP ) + +Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. + +```c +#include "stdlib/blas/base/shared.h" + +double AP[] = { 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 }; +const double x[] = { 1.0, 2.0, 3.0 }; + +c_dspr_ndarray( CblasColMajor, CblasUpper, 3, 1.0, x, 1, AP, 1, 0 ); +``` + +The function accepts the following arguments: + +- **order**: `[in] CBLAS_LAYOUT` storage layout. +- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. +- **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. +- **alpha**: `[in] double` scalar. +- **X**: `[in] double*` input vector. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **AP**: `[inout] double*` packed form of a symmetric matrix `A`. +- **strideAP**: `[in] CBLAS_INT` stride length for `AP`. +- **offsetAP**: `[in] CBLAS_INT` starting index for `AP`. ```c -TODO +void c_dspr_ndarray( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) ``` @@ -219,7 +261,34 @@ TODO ### Examples ```c -TODO +#include "stdlib/blas/base/dspr.h" +#include "stdlib/blas/base/shared.h" +#include + +int main( void ) { + // Create strided arrays: + double AP[] = { 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 }; + const double x[] = { 1.0, 2.0, 3.0 }; + + // Specify the number of elements along each dimension of `A`: + const int N = 3; + + // Perform the symmetric rank 1 operation `A = α*x*x^T + A`: + c_dspr( CblasRowMajor, CblasUpper, N, 1.0, x, 1, AP ); + + // Print the result: + for ( int i = 0; i < N*(N+1)/2; i++ ) { + printf( "AP[ %i ] = %f\n", i, AP[ i ] ); + } + + // Perform the symmetric rank 1 operation `A = α*x*x^T + A` using alternative indexing semantics: + c_dspr_ndarray( CblasRowMajor, CblasUpper, N, 1.0, x, 1, 0, AP, 1, 0 ); + + // Print the result: + for ( int i = 0; i < N*(N+1)/2; i++ ) { + printf( "AP[ %i ] = %f\n", i, AP[ i ] ); + } +} ``` diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js new file mode 100644 index 000000000000..05b2a892d850 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js @@ -0,0 +1,109 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var 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 floor = require( '@stdlib/math/base/special/floor' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dspr = tryRequire( resolve( __dirname, './../lib/dspr.native.js' ) ); +var opts = { + 'skip': ( dspr instanceof Error ) +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, options ); + var x = uniform( N, -10.0, 10.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 = dspr( 'row-major', 'upper', N, 1.0, x, 1, AP ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+'::native:size='+( len * ( len + 1 ) / 2 ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js new file mode 100644 index 000000000000..18d3123bfc0a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js @@ -0,0 +1,109 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var 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 floor = require( '@stdlib/math/base/special/floor' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dspr = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dspr instanceof Error ) +}; +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, options ); + var x = uniform( N, -10.0, 10.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 = dspr( 'row-major', 'upper', N, 1.0, x, 1, 0, AP, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+'::native:ndarray:size='+( len * ( len + 1 ) / 2 ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/Makefile new file mode 100644 index 000000000000..cce2c865d7ad --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# 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/dspr/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..4dbbdae3247b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/dspr.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/blas/ext/base/dfill.h" +#include +#include +#include +#include +#include + +#define NAME "dspr" +#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; +} + +/** +* 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; + float AP[ len*(len+1)/2 ]; + float x[ len ]; + double t; + int i; + + stdlib_strided_dfill( len, 0.5, x, 1 ); + stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 ); + t = tic(); + for ( i = 0; i < iterations; i++ ) { + c_dspr( CblasRowMajor, CblasUpper, len, 1.0, x, 1, AP ); + if ( AP[ 0 ] != AP[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( AP[ 0 ] != AP[ 0 ] ) { + 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; + float AP[ len*(len+1)/2 ]; + float x[ len ]; + double t; + int i; + + stdlib_strided_dfill( len, 0.5, x, 1 ); + stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 ); + t = tic(); + for ( i = 0; i < iterations; i++ ) { + c_dspr_ndarray( CblasRowMajor, CblasUpper, len, 1.0, x, 1, 0, AP, 1, 0 ); + if ( AP[ 0 ] != AP[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( AP[ 0 ] != AP[ 0 ] ) { + 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 = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + 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/dspr/binding.gyp b/lib/node_modules/@stdlib/blas/base/dspr/binding.gyp new file mode 100644 index 000000000000..08de71a2020e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/binding.gyp @@ -0,0 +1,265 @@ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # 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/dspr/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/dspr/examples/c/Makefile new file mode 100644 index 000000000000..25ced822f96a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# 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/dspr/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/dspr/examples/c/example.c new file mode 100644 index 000000000000..6e19d8a07630 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/examples/c/example.c @@ -0,0 +1,46 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/dspr.h" +#include "stdlib/blas/base/shared.h" +#include + +int main( void ) { + // Create strided arrays: + double AP[] = { 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 }; + const double x[] = { 1.0, 2.0, 3.0 }; + + // Specify the number of elements along each dimension of `A`: + const int N = 3; + + // Perform the symmetric rank 1 operation `A = α*x*x^T + A`: + c_dspr( CblasRowMajor, CblasUpper, N, 1.0, x, 1, AP ); + + // Print the result: + for ( int i = 0; i < N*(N+1)/2; i++ ) { + printf( "AP[ %i ] = %f\n", i, AP[ i ] ); + } + + // Perform the symmetric rank 1 operation `A = α*x*x^T + A` using alternative indexing semantics: + c_dspr_ndarray( CblasRowMajor, CblasUpper, N, 1.0, x, 1, 0, AP, 1, 0 ); + + // Print the result: + for ( int i = 0; i < N*(N+1)/2; i++ ) { + printf( "AP[ %i ] = %f\n", i, AP[ i ] ); + } +} diff --git a/lib/node_modules/@stdlib/blas/base/dspr/include.gypi b/lib/node_modules/@stdlib/blas/base/dspr/include.gypi new file mode 100644 index 000000000000..4217944b5d20 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/include.gypi @@ -0,0 +1,70 @@ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A GYP include file for building a Node.js native add-on. +# +# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +# +# Variable nesting hacks: +# +# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi +# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004 +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + 'variables': { + # Host BLAS library (to override -Dblas=): + 'blas%': '', + + # Path to BLAS library (to override -Dblas_dir=): + 'blas_dir%': '', + }, # end variables + + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '<@(blas_dir)', + ' [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ] +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dspr( 'row-major', 'upper', 3, 1.0, x, 1, AP ); +* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ] +*/ +function dspr( order, uplo, N, alpha, x, strideX, AP ) { + addon( resolveOrder( order ), resolveUplo( uplo ), N, alpha, x, strideX, AP ); // eslint-disable-line max-len + return AP; +} + + +// EXPORTS // + +module.exports = dspr; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/native.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/native.js new file mode 100644 index 000000000000..708ed13525a2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/native.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dspr = require( './dspr.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( dspr, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dspr; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js new file mode 100644 index 000000000000..0082ae24bdd5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js @@ -0,0 +1,59 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolveOrder = require( '@stdlib/blas/base/layout-resolve-enum' ); +var resolveUplo = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); +var addon = require( './../src/addon.node' ); + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied +* @param {NonNegativeInteger} N - number of elements along each dimension of `A` +* @param {number} alpha - scalar +* @param {Float64Array} x - input vector +* @param {integer} strideX - `x` stride length +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Float64Array} AP - packed form of a symmetric matrix `A` +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index for `AP` +* @returns {Float64Array} `AP` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 ] ); // => [ [ 1.0, 2.0, 3.0 ], [ 0.0, 1.0, 2.0 ], [ 0.0, 0.0, 1.0 ] ] +* var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* +* dspr( 'row-major', 'upper', 3, 1.0, x, 1, 0, AP, 1, 0 ); +* // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ] +*/ +function dspr( order, uplo, N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ) { // eslint-disable-line max-len + addon.ndarray( resolveOrder( order ), resolveUplo( uplo ), N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ); // eslint-disable-line max-len + return AP; +} + + +// EXPORTS // + +module.exports = dspr; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json new file mode 100644 index 000000000000..de9457c31b93 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json @@ -0,0 +1,311 @@ +{ + "options": { + "task": "build", + "os": "linux", + "blas": "", + "wasm": false + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "os": "win", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "win", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "win", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dspr_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-double", + "@stdlib/strided/base/stride2offset" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/ext/base/dfill", + "@stdlib/math/base/special/floor", + "@stdlib/strided/base/stride2offset" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset" + ] + }, + + { + "task": "build", + "os": "", + "blas": "", + "wasm": true, + "src": [ + "./src/dspr.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dspr/package.json b/lib/node_modules/@stdlib/blas/base/dspr/package.json index e753e0dabcf1..cb2d7caea065 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/package.json +++ b/lib/node_modules/@stdlib/blas/base/dspr/package.json @@ -14,11 +14,14 @@ } ], "main": "./lib", + "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/dspr/src/Makefile b/lib/node_modules/@stdlib/blas/base/dspr/src/Makefile new file mode 100644 index 000000000000..7733b6180cb4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2025 The Stdlib Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#/ + +# 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/dspr/src/addon.c b/lib/node_modules/@stdlib/blas/base/dspr/src/addon.c new file mode 100644 index 000000000000..e91b0c4b38ab --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/addon.c @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/dspr.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_int32.h" +#include "stdlib/napi/argv_double.h" +#include "stdlib/napi/argv_strided_float64array.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, 7 ); + + STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 ); + STDLIB_NAPI_ARGV_INT32( env, uplo, argv, 1 ); + + STDLIB_NAPI_ARGV_INT64( env, N, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); + + STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 3 ); + + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, AP, N*(N+1)/2, 1, argv, 6 ); + + API_SUFFIX(c_dspr)( order, uplo, N, alpha, X, strideX, AP ); + + return NULL; +} + +/** +* 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, 10 ); + + STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 ); + STDLIB_NAPI_ARGV_INT32( env, uplo, argv, 1 ); + + STDLIB_NAPI_ARGV_INT64( env, N, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 6 ); + STDLIB_NAPI_ARGV_INT64( env, strideAP, argv, 8 ); + STDLIB_NAPI_ARGV_INT64( env, offsetAP, argv, 9 ); + + STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 3 ); + + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, AP, N*(N+1)/2, strideAP, argv, 7 ); + + API_SUFFIX(c_dspr_ndarray)( order, uplo, N, alpha, X, strideX, offsetX, AP, strideAP, offsetAP ); + + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c new file mode 100644 index 000000000000..c20b960dbbb4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c @@ -0,0 +1,106 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/dspr.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. +* +* @param order storage layout +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param N number of elements along each dimension of `A` +* @param alpha scalar +* @param X input vector +* @param strideX `X` stride length +* @param AP packed form of a symmetric matrix `A` +*/ +void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { + const CBLAS_INT ox = STDLIB_BLAS_BASE_STRIDE2OFFSET( N, strideX ); + API_SUFFIX(c_dspr_ndarray)( order, uplo, N, alpha, X, strideX, ox, AP, 1, 0 ); + return; +} + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param N number of elements along each dimension of `A` +* @param alpha scalar +* @param X input vector +* @param strideX `X` stride length +* @param offsetX starting index of `x` +* @param AP packed form of a symmetric matrix `A` +* @param strideAP stride of the first dimension of `AP` +* @param offsetAP starting index of `AP` +*/ +void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { + CBLAS_INT iap; + CBLAS_INT ix0; + CBLAS_INT ix1; + CBLAS_INT i0; + CBLAS_INT i1; + CBLAS_INT kk; + CBLAS_INT ox; + double tmp; + + if ( N == 0 || alpha == 0.0 ) { + return; + } + ox = offsetX; + kk = offsetAP; + if ( + ( order == CblasRowMajor && uplo == CblasLower ) || + ( order == CblasColMajor && uplo == CblasUpper ) + ) { + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + if ( X[ ix1 ] != 0.0 ) { + tmp = alpha * X[ ix1 ]; + ix0 = ox; + iap = kk; + for ( i0 = 0; i0 <= i1; i0++ ) { + AP[ iap ] += X[ ix0 ] * tmp; + ix0 += strideX; + iap += strideAP; + } + } + ix1 += strideX; + kk += ( i1 + 1 ) * strideAP; + } + return; + } + // ( order == CblasColMajor && uplo == CblasLower ) || ( order == CblasRowMajor && uplo == CblasUpper ) + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + if ( X[ ix1 ] != 0.0 ) { + tmp = alpha * X[ ix1 ]; + ix0 = ix1; + iap = kk; + for ( i0 = 0; i0 < N - i1; i0++ ) { + AP[ iap ] += X[ ix0 ] * tmp; + ix0 += strideX; + iap += strideAP; + } + } + ix1 += strideX; + kk += ( N - i1 ) * strideAP; + } + return; +} diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c new file mode 100644 index 000000000000..81d04d75064d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -0,0 +1,36 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/dspr.h" +#include "stdlib/blas/base/dspr_cblas.h" +#include "stdlib/blas/base/shared.h" + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. +* +* @param order storage layout +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param N number of elements along each dimension of `A` +* @param alpha scalar +* @param X input vector +* @param strideX `x` stride length +* @param AP packed form of a symmetric matrix `A` +*/ +void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { + API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, strideX, AP ); +} diff --git a/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js b/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js new file mode 100644 index 000000000000..400e73e59ef2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js @@ -0,0 +1,298 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'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' ); + + +// FIXTURES // + +var rl = require( './fixtures/row_major_l.json' ); +var ru = require( './fixtures/row_major_u.json' ); +var rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); + +var cl = require( './fixtures/column_major_l.json' ); +var cu = require( './fixtures/column_major_u.json' ); +var cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); + + +// VARIABLES // + +var dspr = tryRequire( resolve( __dirname, './../lib/dspr.native.js' ) ); +var opts = { + 'skip': ( dspr instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dspr, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', opts, function test( t ) { + t.strictEqual( dspr.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rl; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, lower)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cl; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, upper)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ru; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, upper)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the packed form of a symmetric matrix `A`', opts, function test( t ) { + var data; + var out; + var ap; + var x; + + data = rl; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ru; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP ); + + out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP ); + + out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, ap ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js new file mode 100644 index 000000000000..f9600ef68704 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js @@ -0,0 +1,518 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'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' ); + + +// FIXTURES // + +var rl = require( './fixtures/row_major_l.json' ); +var ru = require( './fixtures/row_major_u.json' ); +var rxp = require( './fixtures/row_major_xp.json' ); +var rxn = require( './fixtures/row_major_xn.json' ); +var rox = require( './fixtures/row_major_ox.json' ); +var rsap = require( './fixtures/row_major_sap.json' ); +var rsapn = require( './fixtures/row_major_sapn.json' ); +var roap = require( './fixtures/row_major_oap.json' ); +var rcap = require( './fixtures/row_major_complex_access_pattern.json' ); + +var cl = require( './fixtures/column_major_l.json' ); +var cu = require( './fixtures/column_major_u.json' ); +var cxp = require( './fixtures/column_major_xp.json' ); +var cxn = require( './fixtures/column_major_xn.json' ); +var cox = require( './fixtures/column_major_ox.json' ); +var csap = require( './fixtures/column_major_sap.json' ); +var csapn = require( './fixtures/column_major_sapn.json' ); +var coap = require( './fixtures/column_major_oap.json' ); +var ccap = require( './fixtures/column_major_complex_access_pattern.json' ); + + +// VARIABLES // + +var dspr = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dspr instanceof Error ) +}; + + +// TESTS // + +tape( 'main export is a function', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dspr, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', opts, function test( t ) { + t.strictEqual( dspr.length, 10, 'returns expected value' ); + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rl; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, lower)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cl; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, upper)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ru; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (column-major, upper)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a reference to the packed form of a symmetric matrix `A`', opts, function test( t ) { + var data; + var out; + var ap; + var x; + + data = rl; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ru; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP ); + + out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `N` is zero or `α` is zero, respectively, the function returns `AP` unchanged (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cu; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP ); + + out = dspr( data.order, data.uplo, 0, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + out = dspr( data.order, data.uplo, data.N, 0.0, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( ap, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` stride (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxp; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative `x` stride (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cxn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rox; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an `x` offset (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = cox; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride for `AP` (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rsap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a stride for `AP` (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = csap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride for `AP` (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rsapn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying a negative stride for `AP` (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = csapn; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset for `AP` (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = roap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying an offset for `AP` (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = coap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = rcap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports complex access patterns (column-major)', opts, function test( t ) { + var expected; + var data; + var out; + var ap; + var x; + + data = ccap; + + ap = new Float64Array( data.AP ); + x = new Float64Array( data.x ); + + expected = new Float64Array( data.AP_out ); + + out = dspr( data.order, data.uplo, data.N, data.alpha, x, data.strideX, data.offsetX, ap, data.strideAP, data.offsetAP ); + t.strictEqual( out, ap, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); From 1e4ae4f5825480813ef3cc6f600a0b44dd6fcb21 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 6 Apr 2025 14:16:33 +0530 Subject: [PATCH 02/18] fix: change precision --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c index 4dbbdae3247b..0fd472d3a43a 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c @@ -88,8 +88,8 @@ static double tic( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - float AP[ len*(len+1)/2 ]; - float x[ len ]; + double AP[ len*(len+1)/2 ]; + double x[ len ]; double t; int i; @@ -119,8 +119,8 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - float AP[ len*(len+1)/2 ]; - float x[ len ]; + double AP[ len*(len+1)/2 ]; + double x[ len ]; double t; int i; From ad90bb372b992243014d15cff9b1b4e519ad2154 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Wed, 7 May 2025 15:21:55 +0530 Subject: [PATCH 03/18] chore: update implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dspr/manifest.json | 12 ++- .../@stdlib/blas/base/dspr/src/dspr.c | 70 +-------------- .../@stdlib/blas/base/dspr/src/dspr_cblas.c | 30 ++++++- .../@stdlib/blas/base/dspr/src/dspr_ndarray.c | 88 +++++++++++++++++++ 4 files changed, 126 insertions(+), 74 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c diff --git a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json index de9457c31b93..00226dd29099 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json @@ -232,7 +232,8 @@ "blas": "", "wasm": false, "src": [ - "./src/dspr.c" + "./src/dspr.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -256,7 +257,8 @@ "blas": "", "wasm": false, "src": [ - "./src/dspr.c" + "./src/dspr.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -276,7 +278,8 @@ "blas": "", "wasm": false, "src": [ - "./src/dspr.c" + "./src/dspr.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -295,7 +298,8 @@ "blas": "", "wasm": true, "src": [ - "./src/dspr.c" + "./src/dspr.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c index c20b960dbbb4..25243abe3d77 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c @@ -32,75 +32,7 @@ * @param AP packed form of a symmetric matrix `A` */ void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { - const CBLAS_INT ox = STDLIB_BLAS_BASE_STRIDE2OFFSET( N, strideX ); + const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); API_SUFFIX(c_dspr_ndarray)( order, uplo, N, alpha, X, strideX, ox, AP, 1, 0 ); return; } - -/** -* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. -* -* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced -* @param N number of elements along each dimension of `A` -* @param alpha scalar -* @param X input vector -* @param strideX `X` stride length -* @param offsetX starting index of `x` -* @param AP packed form of a symmetric matrix `A` -* @param strideAP stride of the first dimension of `AP` -* @param offsetAP starting index of `AP` -*/ -void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { - CBLAS_INT iap; - CBLAS_INT ix0; - CBLAS_INT ix1; - CBLAS_INT i0; - CBLAS_INT i1; - CBLAS_INT kk; - CBLAS_INT ox; - double tmp; - - if ( N == 0 || alpha == 0.0 ) { - return; - } - ox = offsetX; - kk = offsetAP; - if ( - ( order == CblasRowMajor && uplo == CblasLower ) || - ( order == CblasColMajor && uplo == CblasUpper ) - ) { - ix1 = ox; - for ( i1 = 0; i1 < N; i1++ ) { - if ( X[ ix1 ] != 0.0 ) { - tmp = alpha * X[ ix1 ]; - ix0 = ox; - iap = kk; - for ( i0 = 0; i0 <= i1; i0++ ) { - AP[ iap ] += X[ ix0 ] * tmp; - ix0 += strideX; - iap += strideAP; - } - } - ix1 += strideX; - kk += ( i1 + 1 ) * strideAP; - } - return; - } - // ( order == CblasColMajor && uplo == CblasLower ) || ( order == CblasRowMajor && uplo == CblasUpper ) - ix1 = ox; - for ( i1 = 0; i1 < N; i1++ ) { - if ( X[ ix1 ] != 0.0 ) { - tmp = alpha * X[ ix1 ]; - ix0 = ix1; - iap = kk; - for ( i0 = 0; i0 < N - i1; i0++ ) { - AP[ iap ] += X[ ix0 ] * tmp; - ix0 += strideX; - iap += strideAP; - } - } - ix1 += strideX; - kk += ( N - i1 ) * strideAP; - } - return; -} diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c index 81d04d75064d..94e3d64e4d34 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -32,5 +32,33 @@ * @param AP packed form of a symmetric matrix `A` */ void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { - API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, strideX, AP ); + CBLAS_INT sx = strideX; + if ( sx < 0 ) { + sx = -sx; + } + API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); +} + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* +* @param order storage layout +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param N number of elements along each dimension of `A` +* @param alpha scalar +* @param X input vector +* @param strideX `x` stride length +* @param offsetX starting index for `x` +* @param AP packed form of a symmetric matrix `A` +* @param strideAP `AP` stride length +* @param offsetAP starting index for `AP` +*/ +void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { + CBLAS_INT sx = strideX; + X += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer + AP += stdlib_strided_min_view_buffer_index( N, strideAP, offsetAP ); // adjust array pointer + if ( sx < 0 ) { + sx = -sx; + } + API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, offsetX, AP, strideAP, offsetAP ); } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c new file mode 100644 index 000000000000..fb9aaccbb7fb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdlib/blas/base/dspr.h" +#include "stdlib/blas/base/shared.h" + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param N number of elements along each dimension of `A` +* @param alpha scalar +* @param X input vector +* @param strideX `X` stride length +* @param offsetX starting index of `x` +* @param AP packed form of a symmetric matrix `A` +* @param strideAP stride of the first dimension of `AP` +* @param offsetAP starting index of `AP` +*/ +void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { + CBLAS_INT iap; + CBLAS_INT ix0; + CBLAS_INT ix1; + CBLAS_INT i0; + CBLAS_INT i1; + CBLAS_INT kk; + CBLAS_INT ox; + double tmp; + + if ( N == 0 || alpha == 0.0f ) { + return; + } + ox = offsetX; + kk = offsetAP; + if ( + ( order == CblasRowMajor && uplo == CblasLower ) || + ( order == CblasColMajor && uplo == CblasUpper ) + ) { + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + if ( X[ ix1 ] != 0.0f ) { + tmp = alpha * X[ ix1 ]; + ix0 = ox; + iap = kk; + for ( i0 = 0; i0 <= i1; i0++ ) { + AP[ iap ] += X[ ix0 ] * tmp; + ix0 += strideX; + iap += strideAP; + } + } + ix1 += strideX; + kk += ( i1 + 1 ) * strideAP; + } + return; + } + // ( order == CblasColMajor && uplo == CblasLower ) || ( order == CblasRowMajor && uplo == CblasUpper ) + ix1 = ox; + for ( i1 = 0; i1 < N; i1++ ) { + if ( X[ ix1 ] != 0.0f ) { + tmp = alpha * X[ ix1 ]; + ix0 = ix1; + iap = kk; + for ( i0 = 0; i0 < N - i1; i0++ ) { + AP[ iap ] += X[ ix0 ] * tmp; + ix0 += strideX; + iap += strideAP; + } + } + ix1 += strideX; + kk += ( N - i1 ) * strideAP; + } + return; +} From 0084fccaf94f74af9408ab2dd1cd5a8522013c6f Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Wed, 7 May 2025 15:24:12 +0530 Subject: [PATCH 04/18] chore: clean-up Co-authored-by: Athan Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index 017e4f856b44..fa706011f7ae 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -202,7 +202,7 @@ c_dspr( CblasColMajor, CblasUpper, 3, 1.0, x, 1, AP ); The function accepts the following arguments: - **order**: `[in] CBLAS_LAYOUT` storage layout. -- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. +- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied. - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. - **alpha**: `[in] double` scalar. - **X**: `[in] double*` input vector. From 1fd44ca0d074d7dc27881cde392c8c58d009bbfe Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Wed, 7 May 2025 15:31:49 +0530 Subject: [PATCH 05/18] chore: update markdown --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/blas/base/dspr/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index fa706011f7ae..37157be28434 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -196,7 +196,7 @@ Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scala double AP[] = { 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 }; const double x[] = { 1.0, 2.0, 3.0 }; -c_dspr( CblasColMajor, CblasUpper, 3, 1.0, x, 1, AP ); +c_dspr( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP ); ``` The function accepts the following arguments: @@ -223,7 +223,7 @@ Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scala double AP[] = { 1.0, 2.0, 3.0, 1.0, 2.0, 1.0 }; const double x[] = { 1.0, 2.0, 3.0 }; -c_dspr_ndarray( CblasColMajor, CblasUpper, 3, 1.0, x, 1, AP, 1, 0 ); +c_dspr_ndarray( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP, 1, 0 ); ``` The function accepts the following arguments: From 676ed0f7d0c112cfcb3a743ac466776fdada7c97 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 11 May 2025 12:06:08 +0530 Subject: [PATCH 06/18] chore: update api --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dspr/src/dspr_cblas.c | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c index 94e3d64e4d34..8bc3cab7fc85 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -54,11 +54,33 @@ void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const * @param offsetAP starting index for `AP` */ void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { + CBLAS_INT sx = strideX; + if ( sx < 0 ) { + sx = -sx; + } + API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); +} + +/** +* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* +* @param order storage layout +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param N number of elements along each dimension of `A` +* @param alpha scalar +* @param X input vector +* @param strideX `x` stride length +* @param offsetX starting index for `x` +* @param AP packed form of a symmetric matrix `A` +* @param strideAP `AP` stride length +* @param offsetAP starting index for `AP` +*/ +void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { CBLAS_INT sx = strideX; X += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer AP += stdlib_strided_min_view_buffer_index( N, strideAP, offsetAP ); // adjust array pointer if ( sx < 0 ) { sx = -sx; } - API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, offsetX, AP, strideAP, offsetAP ); + API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); } From fea4c94866a2f63f0fbb0354d48ff65b8c6e3841 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Fri, 30 May 2025 16:42:25 +0530 Subject: [PATCH 07/18] chore: update manifest.json --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dspr/manifest.json | 187 +++++++++++++++--- 1 file changed, 164 insertions(+), 23 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json index 00226dd29099..2bee9b0a2468 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json @@ -30,7 +30,72 @@ "confs": [ { "task": "build", - "os": "win", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c", + "./src/dspr_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-int32", + "@stdlib/napi/argv-double", + "@stdlib/napi/argv-strided-float64array" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c", + "./src/dspr_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/ext/base/sfill" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c", + "./src/dspr_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset" + ] + }, + + { + "task": "build", + "os": "linux", "blas": "openblas", "wasm": false, "src": [ @@ -46,17 +111,18 @@ "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-int32", - "@stdlib/napi/argv-strided-float64array", - "@stdlib/napi/argv-double" + "@stdlib/napi/argv-double", + "@stdlib/napi/argv-strided-float64array" ] }, { "task": "benchmark", - "os": "win", + "os": "linux", "blas": "openblas", "wasm": false, "src": [ @@ -71,12 +137,14 @@ ], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared" + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/blas/ext/base/sfill" ] }, { "task": "examples", - "os": "win", + "os": "linux", "blas": "openblas", "wasm": false, "src": [ @@ -91,7 +159,73 @@ ], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared" + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c", + "./src/dspr_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-int32", + "@stdlib/napi/argv-double", + "@stdlib/napi/argv-strided-float64array" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c", + "./src/dspr_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/ext/base/sfill" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/dspr.c", + "./src/dspr_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset" ] }, @@ -112,12 +246,13 @@ "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-int32", - "@stdlib/napi/argv-strided-float64array", - "@stdlib/napi/argv-double" + "@stdlib/napi/argv-double", + "@stdlib/napi/argv-strided-float64array" ] }, { @@ -136,7 +271,9 @@ ], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared" + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/blas/ext/base/sfill" ] }, { @@ -155,7 +292,8 @@ ], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared" + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" ] }, @@ -177,12 +315,13 @@ "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-int32", - "@stdlib/napi/argv-strided-float64array", - "@stdlib/napi/argv-double" + "@stdlib/napi/argv-double", + "@stdlib/napi/argv-strided-float64array" ] }, { @@ -202,7 +341,9 @@ ], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared" + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/blas/ext/base/sfill" ] }, { @@ -222,13 +363,14 @@ ], "libpath": [], "dependencies": [ - "@stdlib/blas/base/shared" + "@stdlib/blas/base/shared", + "@stdlib/strided/base/min-view-buffer-index" ] }, { "task": "build", - "os": "linux", + "os": "win", "blas": "", "wasm": false, "src": [ @@ -242,18 +384,18 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-int32", - "@stdlib/napi/argv-strided-float64array", "@stdlib/napi/argv-double", - "@stdlib/strided/base/stride2offset" + "@stdlib/napi/argv-strided-float64array" ] }, { "task": "benchmark", - "os": "linux", + "os": "win", "blas": "", "wasm": false, "src": [ @@ -267,14 +409,12 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/blas/ext/base/dfill", - "@stdlib/math/base/special/floor", "@stdlib/strided/base/stride2offset" ] }, { "task": "examples", - "os": "linux", + "os": "win", "blas": "", "wasm": false, "src": [ @@ -288,7 +428,8 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/stride2offset" + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/ext/base/sfill" ] }, From 097e3804b240692c5d10e9bad1351cc7634e3c77 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 30 May 2025 16:49:10 +0530 Subject: [PATCH 08/18] chore: update packages Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- .../@stdlib/blas/base/dspr/manifest.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json index 2bee9b0a2468..da9edf618c36 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json @@ -70,7 +70,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/stride2offset", - "@stdlib/blas/ext/base/sfill" + "@stdlib/blas/ext/base/dfill" ] }, { @@ -139,7 +139,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/blas/ext/base/sfill" + "@stdlib/blas/ext/base/dfill" ] }, { @@ -206,7 +206,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/stride2offset", - "@stdlib/blas/ext/base/sfill" + "@stdlib/blas/ext/base/dfill" ] }, { @@ -273,7 +273,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/blas/ext/base/sfill" + "@stdlib/blas/ext/base/dfill" ] }, { @@ -343,7 +343,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/min-view-buffer-index", - "@stdlib/blas/ext/base/sfill" + "@stdlib/blas/ext/base/dfill" ] }, { @@ -429,7 +429,7 @@ "dependencies": [ "@stdlib/blas/base/shared", "@stdlib/strided/base/stride2offset", - "@stdlib/blas/ext/base/sfill" + "@stdlib/blas/ext/base/dfill" ] }, From 22d7083e8e697384be2922c82356139b2821509b Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Fri, 30 May 2025 17:28:50 +0530 Subject: [PATCH 09/18] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index 37157be28434..d953f29825c5 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -229,7 +229,7 @@ c_dspr_ndarray( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP, 1, 0 ); The function accepts the following arguments: - **order**: `[in] CBLAS_LAYOUT` storage layout. -- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced. +- **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied. - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. - **alpha**: `[in] double` scalar. - **X**: `[in] double*` input vector. From cd7bb25940f42078cf49ee0c2a2f9d367b917fd3 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sat, 28 Jun 2025 16:10:08 +0530 Subject: [PATCH 10/18] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: missing_dependencies - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/blas/base/dspr/README.md | 2 +- .../base/dspr/benchmark/c/benchmark.length.c | 12 +++---- .../base/dspr/include/stdlib/blas/base/dspr.h | 2 +- .../@stdlib/blas/base/dspr/src/dspr_cblas.c | 32 ++----------------- .../@stdlib/blas/base/dspr/src/dspr_ndarray.c | 10 +++--- 5 files changed, 16 insertions(+), 42 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index d953f29825c5..ed468a173e7f 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -215,7 +215,7 @@ void c_dspr( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, #### c_dspr_ndarray( order, uplo, N, alpha, \*X, strideX, \*AP, strideAP, offsetAP ) -Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. ```c #include "stdlib/blas/base/shared.h" diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c index 0fd472d3a43a..220817dbbca2 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c @@ -93,18 +93,18 @@ static double benchmark1( int iterations, int len ) { double t; int i; - stdlib_strided_dfill( len, 0.5, x, 1 ); + stdlib_strided_dfill( len, 1.0, x, 1 ); stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 ); t = tic(); for ( i = 0; i < iterations; i++ ) { c_dspr( CblasRowMajor, CblasUpper, len, 1.0, x, 1, AP ); - if ( AP[ 0 ] != AP[ 0 ] ) { + if ( AP[ i%len ] != AP[ i%len ] ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - t; - if ( AP[ 0 ] != AP[ 0 ] ) { + if ( AP[ i%len ] != AP[ i%len ] ) { printf( "should not return NaN\n" ); } return elapsed; @@ -124,18 +124,18 @@ static double benchmark2( int iterations, int len ) { double t; int i; - stdlib_strided_dfill( len, 0.5, x, 1 ); + stdlib_strided_dfill( len, 1.0, x, 1 ); stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 ); t = tic(); for ( i = 0; i < iterations; i++ ) { c_dspr_ndarray( CblasRowMajor, CblasUpper, len, 1.0, x, 1, 0, AP, 1, 0 ); - if ( AP[ 0 ] != AP[ 0 ] ) { + if ( AP[ i%len ] != AP[ i%len ] ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - t; - if ( AP[ 0 ] != AP[ 0 ] ) { + if ( AP[ i%len ] != AP[ i%len ] ) { printf( "should not return NaN\n" ); } return elapsed; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h b/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h index f48b66b415fc..3b24c62fe7cb 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h +++ b/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h @@ -37,7 +37,7 @@ extern "C" { void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ); /** -* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. */ void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ); diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c index 8bc3cab7fc85..a4101908352c 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -24,7 +24,7 @@ * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * * @param order storage layout -* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param N number of elements along each dimension of `A` * @param alpha scalar * @param X input vector @@ -32,40 +32,14 @@ * @param AP packed form of a symmetric matrix `A` */ void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { - CBLAS_INT sx = strideX; - if ( sx < 0 ) { - sx = -sx; - } - API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); -} - -/** -* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. -* -* @param order storage layout -* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced -* @param N number of elements along each dimension of `A` -* @param alpha scalar -* @param X input vector -* @param strideX `x` stride length -* @param offsetX starting index for `x` -* @param AP packed form of a symmetric matrix `A` -* @param strideAP `AP` stride length -* @param offsetAP starting index for `AP` -*/ -void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { - CBLAS_INT sx = strideX; - if ( sx < 0 ) { - sx = -sx; - } API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); } /** -* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * * @param order storage layout -* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param N number of elements along each dimension of `A` * @param alpha scalar * @param X input vector diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c index fb9aaccbb7fb..a2e647c5a4e6 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c @@ -20,9 +20,9 @@ #include "stdlib/blas/base/shared.h" /** -* Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form using alternative indexing semantics. +* Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * -* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced +* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param N number of elements along each dimension of `A` * @param alpha scalar * @param X input vector @@ -42,7 +42,7 @@ void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo CBLAS_INT ox; double tmp; - if ( N == 0 || alpha == 0.0f ) { + if ( N == 0 || alpha == 0.0 ) { return; } ox = offsetX; @@ -53,7 +53,7 @@ void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo ) { ix1 = ox; for ( i1 = 0; i1 < N; i1++ ) { - if ( X[ ix1 ] != 0.0f ) { + if ( X[ ix1 ] != 0.0 ) { tmp = alpha * X[ ix1 ]; ix0 = ox; iap = kk; @@ -71,7 +71,7 @@ void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo // ( order == CblasColMajor && uplo == CblasLower ) || ( order == CblasRowMajor && uplo == CblasUpper ) ix1 = ox; for ( i1 = 0; i1 < N; i1++ ) { - if ( X[ ix1 ] != 0.0f ) { + if ( X[ ix1 ] != 0.0 ) { tmp = alpha * X[ ix1 ]; ix0 = ix1; iap = kk; From d049962b3225f4e0aeb858c6ac7c306ae11d7121 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sat, 28 Jun 2025 16:37:53 +0530 Subject: [PATCH 11/18] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c index a4101908352c..e6b5c8b7f3b4 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -19,6 +19,7 @@ #include "stdlib/blas/base/dspr.h" #include "stdlib/blas/base/dspr_cblas.h" #include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/min_view_buffer_index.h" /** * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. From c632a9a2950b1b80fc36a96345d809da912dc432 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 29 Jun 2025 21:10:27 +0530 Subject: [PATCH 12/18] chore: update implementation --- .../@stdlib/blas/base/dspr/README.md | 23 ++-- .../blas/base/dspr/benchmark/benchmark.js | 8 +- .../base/dspr/benchmark/benchmark.native.js | 8 +- .../base/dspr/benchmark/benchmark.ndarray.js | 8 +- .../benchmark/benchmark.ndarray.native.js | 8 +- .../base/dspr/benchmark/c/benchmark.length.c | 48 +++---- .../@stdlib/blas/base/dspr/docs/repl.txt | 12 +- .../base/dspr/include/stdlib/blas/base/dspr.h | 4 +- .../include/stdlib/blas/base/dspr_cblas.h | 2 +- .../@stdlib/blas/base/dspr/lib/dspr.js | 1 + .../@stdlib/blas/base/dspr/lib/dspr.native.js | 23 ++++ .../@stdlib/blas/base/dspr/lib/ndarray.js | 1 + .../blas/base/dspr/lib/ndarray.native.js | 24 ++++ .../@stdlib/blas/base/dspr/manifest.json | 45 ++++--- .../@stdlib/blas/base/dspr/src/addon.c | 8 +- .../@stdlib/blas/base/dspr/src/dspr.c | 6 +- .../@stdlib/blas/base/dspr/src/dspr_cblas.c | 31 +---- .../@stdlib/blas/base/dspr/src/dspr_ndarray.c | 8 +- .../blas/base/dspr/test/test.dspr.native.js | 100 ++++++++++++++ .../base/dspr/test/test.ndarray.native.js | 123 ++++++++++++++++++ 20 files changed, 374 insertions(+), 117 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index ed468a173e7f..3a80ab1cd0f6 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -51,7 +51,7 @@ The function has the following parameters: - **N**: number of elements along each dimension of `A`. - **α**: scalar constant. - **x**: input [`Float64Array`][mdn-float64array]. -- **sx**: index increment for `x`. +- **sx**: stride length for `x`. - **AP**: packed form of a symmetric matrix `A` stored as a [`Float64Array`][mdn-float64array]. The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of `x` in reverse order, @@ -101,7 +101,7 @@ dspr.ndarray( 'row-major', 'lower', 3, 1.0, x, 1, 0, AP, 1, 0 ); The function has the following additional parameters: - **ox**: starting index for `x`. -- **sap**: `AP` stride length. +- **sap**: stride length for `AP`. - **oap**: starting index for `AP`. While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, @@ -186,7 +186,7 @@ console.log( AP ); #include "stdlib/blas/base/dspr.h" ``` -#### c_dspr( order, uplo, N, alpha, \*X, strideX, \*AP ) +#### c_dspr( layout, uplo, N, alpha, \*X, sx, \*AP ) Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. @@ -201,19 +201,19 @@ c_dspr( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP ); The function accepts the following arguments: -- **order**: `[in] CBLAS_LAYOUT` storage layout. +- **layout**: `[in] CBLAS_LAYOUT` storage layout. - **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied. - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. - **alpha**: `[in] double` scalar. - **X**: `[in] double*` input vector. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **sx**: `[in] CBLAS_INT` stride length for `X`. - **AP**: `[inout] double*` packed form of a symmetric matrix `A`. ```c -void c_dspr( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) +void c_dspr( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *x, const CBLAS_INT strideX, double *ap ) ``` -#### c_dspr_ndarray( order, uplo, N, alpha, \*X, strideX, \*AP, strideAP, offsetAP ) +#### c_dspr_ndarray( layout, uplo, N, alpha, \*X, sx, \*AP, sap, offsetAP ) Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. @@ -228,18 +228,19 @@ c_dspr_ndarray( CblasRowMajor, CblasUpper, 3, 1.0, x, 1, AP, 1, 0 ); The function accepts the following arguments: -- **order**: `[in] CBLAS_LAYOUT` storage layout. +- **layout**: `[in] CBLAS_LAYOUT` storage layout. - **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied. - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. - **alpha**: `[in] double` scalar. - **X**: `[in] double*` input vector. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **sx**: `[in] CBLAS_INT` stride length for `X`. +- **ox**: `[in] CBLAS_INT` starting index for `x`. - **AP**: `[inout] double*` packed form of a symmetric matrix `A`. -- **strideAP**: `[in] CBLAS_INT` stride length for `AP`. +- **sap**: `[in] CBLAS_INT` stride length for `AP`. - **offsetAP**: `[in] CBLAS_INT` starting index for `AP`. ```c -void c_dspr_ndarray( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) +void c_dspr_ndarray( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *ap, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) ``` diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js index b58be056c17f..bb457d36edb7 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js @@ -85,7 +85,7 @@ function createBenchmark( N ) { * @private */ function main() { - var len; + var N; var min; var max; var f; @@ -95,9 +95,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( len ); - bench( pkg+':size='+( len * ( len + 1 ) / 2 ), f ); + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':size='+( N * ( N + 1 ) / 2 ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js index 05b2a892d850..82e0703c9bb4 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js @@ -90,7 +90,7 @@ function createBenchmark( N ) { * @private */ function main() { - var len; + var N; var min; var max; var f; @@ -100,9 +100,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( len ); - bench( pkg+'::native:size='+( len * ( len + 1 ) / 2 ), opts, f ); + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+'::native:size='+( N * ( N + 1 ) / 2 ), opts, f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js index e551208abd39..f47c6d7f8327 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js @@ -85,7 +85,7 @@ function createBenchmark( N ) { * @private */ function main() { - var len; + var N; var min; var max; var f; @@ -95,9 +95,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( len ); - bench( pkg+':ndarray:size='+( len * ( len + 1 ) / 2 ), f ); + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:size='+( N * ( N + 1 ) / 2 ), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js index 18d3123bfc0a..931ff95a661c 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js @@ -90,7 +90,7 @@ function createBenchmark( N ) { * @private */ function main() { - var len; + var N; var min; var max; var f; @@ -100,9 +100,9 @@ function main() { max = 6; // 10^max for ( i = min; i <= max; i++ ) { - len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - f = createBenchmark( len ); - bench( pkg+'::native:ndarray:size='+( len * ( len + 1 ) / 2 ), opts, f ); + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+'::native:ndarray:size='+( N * ( N + 1 ) / 2 ), opts, f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c index 220817dbbca2..e8a1df133a38 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/c/benchmark.length.c @@ -83,28 +83,28 @@ static double tic( void ) { * Runs a benchmark. * * @param iterations number of iterations -* @param len array length +* @param N array dimension size * @return elapsed time in seconds */ -static double benchmark1( int iterations, int len ) { +static double benchmark1( int iterations, int N ) { double elapsed; - double AP[ len*(len+1)/2 ]; - double x[ len ]; + double AP[ N*(N+1)/2 ]; + double x[ N ]; double t; int i; - stdlib_strided_dfill( len, 1.0, x, 1 ); - stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 ); + stdlib_strided_dfill( N, 1.0, x, 1 ); + stdlib_strided_dfill( N*(N+1)/2, 1.0, AP, 1 ); t = tic(); for ( i = 0; i < iterations; i++ ) { - c_dspr( CblasRowMajor, CblasUpper, len, 1.0, x, 1, AP ); - if ( AP[ i%len ] != AP[ i%len ] ) { + c_dspr( CblasRowMajor, CblasUpper, N, 1.0, x, 1, AP ); + if ( AP[ i%N ] != AP[ i%N ] ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - t; - if ( AP[ i%len ] != AP[ i%len ] ) { + if ( AP[ i%N ] != AP[ i%N ] ) { printf( "should not return NaN\n" ); } return elapsed; @@ -114,28 +114,28 @@ static double benchmark1( int iterations, int len ) { * Runs a benchmark. * * @param iterations number of iterations -* @param len array length +* @param N array dimension size * @return elapsed time in seconds */ -static double benchmark2( int iterations, int len ) { +static double benchmark2( int iterations, int N ) { double elapsed; - double AP[ len*(len+1)/2 ]; - double x[ len ]; + double AP[ N*(N+1)/2 ]; + double x[ N ]; double t; int i; - stdlib_strided_dfill( len, 1.0, x, 1 ); - stdlib_strided_dfill( len*(len+1)/2, 1.0, AP, 1 ); + stdlib_strided_dfill( N, 1.0, x, 1 ); + stdlib_strided_dfill( N*(N+1)/2, 1.0, AP, 1 ); t = tic(); for ( i = 0; i < iterations; i++ ) { - c_dspr_ndarray( CblasRowMajor, CblasUpper, len, 1.0, x, 1, 0, AP, 1, 0 ); - if ( AP[ i%len ] != AP[ i%len ] ) { + c_dspr_ndarray( CblasRowMajor, CblasUpper, N, 1.0, x, 1, 0, AP, 1, 0 ); + if ( AP[ i%N ] != AP[ i%N ] ) { printf( "should not return NaN\n" ); break; } } elapsed = tic() - t; - if ( AP[ i%len ] != AP[ i%len ] ) { + if ( AP[ i%N ] != AP[ i%N ] ) { printf( "should not return NaN\n" ); } return elapsed; @@ -148,7 +148,7 @@ int main( void ) { double elapsed; int count; int iter; - int len; + int N; int i; int j; @@ -158,19 +158,19 @@ int main( void ) { print_version(); count = 0; for ( i = MIN; i <= MAX; i++ ) { - len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); 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 ); + printf( "# c::%s:N=%d\n", NAME, N ); + elapsed = benchmark1( iter, N ); 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 ); + printf( "# c::%s:ndarray:N=%d\n", NAME, N ); + elapsed = benchmark2( iter, N ); print_results( iter, elapsed ); printf( "ok %d benchmark finished\n", count ); } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/dspr/docs/repl.txt index 7bb0921b6230..f66ec1db43e1 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/dspr/docs/repl.txt @@ -1,5 +1,5 @@ -{{alias}}( ord, uplo, N, α, x, sx, AP ) +{{alias}}( order, uplo, N, α, x, sx, AP ) Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. @@ -12,7 +12,7 @@ Parameters ---------- - ord: string + order: string Row-major (C-style) or column-major (Fortran-style) order. Must be either 'row-major' or 'column-major'. @@ -48,7 +48,7 @@ [ 2.0, 3.0, 4.0 ] -{{alias}}.ndarray( ord, uplo, N, α, x, sx, ox, AP, sap, oap ) +{{alias}}.ndarray( order, uplo, N, α, x, sx, ox, AP, sap, oap ) Performs the symmetric rank 1 operation `A = α*x*x^T + A` using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. @@ -59,7 +59,7 @@ Parameters ---------- - ord: string + order: string Row-major (C-style) or column-major (Fortran-style) order. Must be either 'row-major' or 'column-major'. @@ -100,9 +100,9 @@ -------- > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0 ] ); > var AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0 ] ); - > var ord = 'row-major'; + > var order = 'row-major'; > var uplo = 'upper'; - > {{alias}}.ndarray( ord, uplo, 2, 1.0, x, 1, 0, AP, 1, 0 ) + > {{alias}}.ndarray( order, uplo, 2, 1.0, x, 1, 0, AP, 1, 0 ) [ 2.0, 3.0, 4.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h b/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h index 3b24c62fe7cb..2b3c6602155b 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h +++ b/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr.h @@ -34,12 +34,12 @@ extern "C" { /** * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. */ -void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ); +void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ); /** * Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. */ -void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ); +void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr_cblas.h b/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr_cblas.h index 461f6fafe90f..8e476aea652e 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr_cblas.h +++ b/lib/node_modules/@stdlib/blas/base/dspr/include/stdlib/blas/base/dspr_cblas.h @@ -34,7 +34,7 @@ extern "C" { /** * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. */ -void API_SUFFIX(cblas_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ); +void API_SUFFIX(cblas_dspr)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.js index 327c936f3aaf..517b270b9d6d 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.js @@ -69,6 +69,7 @@ function dspr( order, uplo, N, alpha, x, strideX, AP ) { if ( strideX === 0 ) { throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) ); } + // Check if we can early return... if ( N === 0 || alpha === 0.0 ) { return AP; } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.native.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.native.js index b41f02af8e61..4d4b1d44f6fd 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/dspr.native.js @@ -20,8 +20,11 @@ // MODULES // +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); var resolveOrder = require( '@stdlib/blas/base/layout-resolve-enum' ); var resolveUplo = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); +var format = require( '@stdlib/string/format' ); var addon = require( './../src/addon.node' ); @@ -37,6 +40,10 @@ var addon = require( './../src/addon.node' ); * @param {Float64Array} x - input vector * @param {integer} strideX - `x` stride length * @param {Float64Array} AP - packed form of a symmetric matrix `A` +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} sixth argument must be non-zero * @returns {Float64Array} `AP` * * @example @@ -49,6 +56,22 @@ var addon = require( './../src/addon.node' ); * // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ] */ function dspr( order, uplo, N, alpha, x, strideX, AP ) { + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) ); + } + // Check if we can early return... + if ( N === 0 || alpha === 0.0 ) { + return AP; + } addon( resolveOrder( order ), resolveUplo( uplo ), N, alpha, x, strideX, AP ); // eslint-disable-line max-len return AP; } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.js index c99c99a0e305..a115f2fb8599 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.js @@ -73,6 +73,7 @@ function dspr( order, uplo, N, alpha, x, strideX, offsetX, AP, strideAP, offsetA if ( strideAP === 0 ) { throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideAP ) ); } + // Check if we can early return... if ( N === 0 || alpha === 0.0 ) { return AP; } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js index 0082ae24bdd5..4726dd712a73 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js @@ -37,6 +37,11 @@ var addon = require( './../src/addon.node' ); * @param {Float64Array} AP - packed form of a symmetric matrix `A` * @param {integer} strideAP - `AP` stride length * @param {NonNegativeInteger} offsetAP - starting index for `AP` +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} sixth argument must be non-zero +* @throws {RangeError} ninth argument must be non-zero * @returns {Float64Array} `AP` * * @example @@ -49,6 +54,25 @@ var addon = require( './../src/addon.node' ); * // AP => [ 2.0, 4.0, 6.0, 5.0, 8.0, 10.0 ] */ function dspr( order, uplo, N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ) { // eslint-disable-line max-len + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideX === 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be non-zero. Value: `%d`.', strideX ) ); + } + if ( strideAP === 0 ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideAP ) ); + } + // Check if we can early return... + if ( N === 0 || alpha === 0.0 ) { + return AP; + } addon.ndarray( resolveOrder( order ), resolveUplo( uplo ), N, alpha, x, strideX, offsetX, AP, strideAP, offsetAP ); // eslint-disable-line max-len return AP; } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json index da9edf618c36..9baf6af51df9 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/dspr/manifest.json @@ -99,7 +99,8 @@ "blas": "openblas", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -111,7 +112,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/strided/base/stride2offset", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", @@ -126,7 +127,8 @@ "blas": "openblas", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -138,7 +140,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/strided/base/stride2offset", "@stdlib/blas/ext/base/dfill" ] }, @@ -148,7 +150,8 @@ "blas": "openblas", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -160,7 +163,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index" + "@stdlib/strided/base/stride2offset" ] }, @@ -235,7 +238,8 @@ "blas": "apple_accelerate_framework", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -246,7 +250,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/strided/base/stride2offset", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", @@ -261,7 +265,8 @@ "blas": "apple_accelerate_framework", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -272,7 +277,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/strided/base/stride2offset", "@stdlib/blas/ext/base/dfill" ] }, @@ -282,7 +287,8 @@ "blas": "apple_accelerate_framework", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -293,7 +299,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index" + "@stdlib/strided/base/stride2offset" ] }, @@ -303,7 +309,8 @@ "blas": "openblas", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -315,7 +322,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/strided/base/stride2offset", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", @@ -330,7 +337,8 @@ "blas": "openblas", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -342,7 +350,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index", + "@stdlib/strided/base/stride2offset", "@stdlib/blas/ext/base/dfill" ] }, @@ -352,7 +360,8 @@ "blas": "openblas", "wasm": false, "src": [ - "./src/dspr_cblas.c" + "./src/dspr_cblas.c", + "./src/dspr_ndarray.c" ], "include": [ "./include" @@ -364,7 +373,7 @@ "libpath": [], "dependencies": [ "@stdlib/blas/base/shared", - "@stdlib/strided/base/min-view-buffer-index" + "@stdlib/strided/base/stride2offset" ] }, diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/addon.c b/lib/node_modules/@stdlib/blas/base/dspr/src/addon.c index e91b0c4b38ab..878832620148 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/addon.c @@ -36,7 +36,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV( env, info, argv, argc, 7 ); - STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 ); + STDLIB_NAPI_ARGV_INT32( env, layout, argv, 0 ); STDLIB_NAPI_ARGV_INT32( env, uplo, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 2 ); @@ -47,7 +47,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, AP, N*(N+1)/2, 1, argv, 6 ); - API_SUFFIX(c_dspr)( order, uplo, N, alpha, X, strideX, AP ); + API_SUFFIX(c_dspr)( layout, uplo, N, alpha, X, strideX, AP ); return NULL; } @@ -62,7 +62,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) { static napi_value addon_method( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV( env, info, argv, argc, 10 ); - STDLIB_NAPI_ARGV_INT32( env, order, argv, 0 ); + STDLIB_NAPI_ARGV_INT32( env, layout, argv, 0 ); STDLIB_NAPI_ARGV_INT32( env, uplo, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, N, argv, 2 ); @@ -76,7 +76,7 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 4 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, AP, N*(N+1)/2, strideAP, argv, 7 ); - API_SUFFIX(c_dspr_ndarray)( order, uplo, N, alpha, X, strideX, offsetX, AP, strideAP, offsetAP ); + API_SUFFIX(c_dspr_ndarray)( layout, uplo, N, alpha, X, strideX, offsetX, AP, strideAP, offsetAP ); return NULL; } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c index 25243abe3d77..11c7c31bd0ea 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c @@ -23,7 +23,7 @@ /** * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * -* @param order storage layout +* @param layout storage layout * @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced * @param N number of elements along each dimension of `A` * @param alpha scalar @@ -31,8 +31,8 @@ * @param strideX `X` stride length * @param AP packed form of a symmetric matrix `A` */ -void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { +void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); - API_SUFFIX(c_dspr_ndarray)( order, uplo, N, alpha, X, strideX, ox, AP, 1, 0 ); + API_SUFFIX(c_dspr_ndarray)( layout, uplo, N, alpha, X, strideX, ox, AP, 1, 0 ); return; } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c index e6b5c8b7f3b4..8b438578b0ab 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -19,12 +19,11 @@ #include "stdlib/blas/base/dspr.h" #include "stdlib/blas/base/dspr_cblas.h" #include "stdlib/blas/base/shared.h" -#include "stdlib/strided/base/min_view_buffer_index.h" /** * Performs the symmetric rank 1 operation `A = α*x*x^T + A` where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. * -* @param order storage layout +* @param layout storage layout * @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param N number of elements along each dimension of `A` * @param alpha scalar @@ -32,30 +31,6 @@ * @param strideX `x` stride length * @param AP packed form of a symmetric matrix `A` */ -void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { - API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); -} - -/** -* Performs the symmetric rank 1 operation `A = α*x*x^T + A`, using alternative indexing semantics and where `α` is a scalar, `x` is an `N` element vector, and `A` is an `N` by `N` symmetric matrix supplied in packed form. -* -* @param order storage layout -* @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied -* @param N number of elements along each dimension of `A` -* @param alpha scalar -* @param X input vector -* @param strideX `x` stride length -* @param offsetX starting index for `x` -* @param AP packed form of a symmetric matrix `A` -* @param strideAP `AP` stride length -* @param offsetAP starting index for `AP` -*/ -void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const float alpha, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { - CBLAS_INT sx = strideX; - X += stdlib_strided_min_view_buffer_index( N, strideX, offsetX ); // adjust array pointer - AP += stdlib_strided_min_view_buffer_index( N, strideAP, offsetAP ); // adjust array pointer - if ( sx < 0 ) { - sx = -sx; - } - API_SUFFIX(cblas_dspr)( order, uplo, N, alpha, X, sx, AP ); +void API_SUFFIX(c_dspr)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, double *AP ) { + API_SUFFIX(cblas_dspr)( layout, uplo, N, alpha, X, strideX, AP ); } diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c index a2e647c5a4e6..acb95ca90673 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c @@ -32,7 +32,7 @@ * @param strideAP stride of the first dimension of `AP` * @param offsetAP starting index of `AP` */ -void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { +void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT layout, const CBLAS_UPLO uplo, const CBLAS_INT N, const double alpha, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, double *AP, const CBLAS_INT strideAP, const CBLAS_INT offsetAP ) { CBLAS_INT iap; CBLAS_INT ix0; CBLAS_INT ix1; @@ -48,8 +48,8 @@ void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo ox = offsetX; kk = offsetAP; if ( - ( order == CblasRowMajor && uplo == CblasLower ) || - ( order == CblasColMajor && uplo == CblasUpper ) + ( layout == CblasRowMajor && uplo == CblasLower ) || + ( layout == CblasColMajor && uplo == CblasUpper ) ) { ix1 = ox; for ( i1 = 0; i1 < N; i1++ ) { @@ -68,7 +68,7 @@ void API_SUFFIX(c_dspr_ndarray)( const CBLAS_LAYOUT order, const CBLAS_UPLO uplo } return; } - // ( order == CblasColMajor && uplo == CblasLower ) || ( order == CblasRowMajor && uplo == CblasUpper ) + // ( layout == CblasColMajor && uplo == CblasLower ) || ( layout == CblasRowMajor && uplo == CblasUpper ) ix1 = ox; for ( i1 = 0; i1 < N; i1++ ) { if ( X[ ix1 ] != 0.0 ) { diff --git a/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js b/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js index 400e73e59ef2..bf12ca4073a6 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/test/test.dspr.native.js @@ -62,6 +62,106 @@ tape( 'the function has an arity of 7', opts, function test( t ) { t.end(); }); +tape( 'the function throws an error if provided an invalid first argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( value, data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.AP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, value, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.AP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, data.uplo, value, data.alpha, new Float64Array( data.x ), data.strideX, data.AP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, data.uplo, data.N, data.alpha, new Float64Array( data.x ), value, data.AP ); + }; + } +}); + tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)', opts, function test( t ) { var expected; var data; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js index f9600ef68704..cacaf870f540 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/test/test.ndarray.native.js @@ -72,6 +72,129 @@ tape( 'the function has an arity of 10', opts, function test( t ) { t.end(); }); +tape( 'the function throws an error if provided an invalid first argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( value, data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, data.AP, data.strideAP, data.offsetAP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, value, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, data.AP, data.strideAP, data.offsetAP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, data.uplo, value, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, data.AP, data.strideAP, data.offsetAP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, data.uplo, data.N, data.alpha, new Float64Array( data.x ), value, data.offsetx, data.AP, data.strideAP, data.offsetAP ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', opts, function test( t ) { + var values; + var data; + var i; + + data = rl; + + values = [ + 0 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dspr( data.order, data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetx, data.AP, value, data.offsetAP ); + }; + } +}); + tape( 'the symmetric rank 1 operation `A = α*A*x*x^T + A` (row-major, lower)', opts, function test( t ) { var expected; var data; From 4b674f2ca903292ee11c856c76abf195b1b520bf Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 29 Jun 2025 21:16:02 +0530 Subject: [PATCH 13/18] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js index 4726dd712a73..11b1fd4c38c6 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/lib/ndarray.native.js @@ -20,8 +20,11 @@ // MODULES // +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); var resolveOrder = require( '@stdlib/blas/base/layout-resolve-enum' ); var resolveUplo = require( '@stdlib/blas/base/matrix-triangle-resolve-enum' ); +var format = require( '@stdlib/string/format' ); var addon = require( './../src/addon.node' ); /** From a706d476b7d4d7cc8a89f143c9625127291dc7b2 Mon Sep 17 00:00:00 2001 From: ShabiShett07 Date: Sun, 29 Jun 2025 21:25:09 +0530 Subject: [PATCH 14/18] chore: clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js | 2 +- .../@stdlib/blas/base/dspr/benchmark/benchmark.native.js | 2 +- .../@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js | 2 +- .../blas/base/dspr/benchmark/benchmark.ndarray.native.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js index bb457d36edb7..b0b2e060882a 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.js @@ -85,9 +85,9 @@ function createBenchmark( N ) { * @private */ function main() { - var N; var min; var max; + var N; var f; var i; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js index 82e0703c9bb4..dae3727e67e0 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.native.js @@ -90,9 +90,9 @@ function createBenchmark( N ) { * @private */ function main() { - var N; var min; var max; + var N; var f; var i; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js index f47c6d7f8327..bb9887931fc0 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.js @@ -85,9 +85,9 @@ function createBenchmark( N ) { * @private */ function main() { - var N; var min; var max; + var N; var f; var i; diff --git a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js index 931ff95a661c..55366006c6cb 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dspr/benchmark/benchmark.ndarray.native.js @@ -90,9 +90,9 @@ function createBenchmark( N ) { * @private */ function main() { - var N; var min; var max; + var N; var f; var i; From 08f5cef2c006aafa609ea55b4658b692a2cdcd9b Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:55:51 +0530 Subject: [PATCH 15/18] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c index 8b438578b0ab..402aea873c61 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_cblas.c @@ -26,7 +26,7 @@ * @param layout storage layout * @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param N number of elements along each dimension of `A` -* @param alpha scalar +* @param alpha scalar constant * @param X input vector * @param strideX `x` stride length * @param AP packed form of a symmetric matrix `A` From ecff6cd87f98a7604872b92ff7f5a07fbf01c125 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:56:01 +0530 Subject: [PATCH 16/18] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c index 11c7c31bd0ea..dd9f91d38591 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr.c @@ -26,7 +26,7 @@ * @param layout storage layout * @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` should be referenced * @param N number of elements along each dimension of `A` -* @param alpha scalar +* @param alpha scalar constant * @param X input vector * @param strideX `X` stride length * @param AP packed form of a symmetric matrix `A` From c79f2ee564685d74df985843408f674e1b16fa04 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:56:12 +0530 Subject: [PATCH 17/18] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c index acb95ca90673..802dc8fb75ba 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c +++ b/lib/node_modules/@stdlib/blas/base/dspr/src/dspr_ndarray.c @@ -24,7 +24,7 @@ * * @param uplo specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied * @param N number of elements along each dimension of `A` -* @param alpha scalar +* @param alpha scalar constant * @param X input vector * @param strideX `X` stride length * @param offsetX starting index of `x` From d9ddef03730410cb4900ab80045cefd34c63ab76 Mon Sep 17 00:00:00 2001 From: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:57:19 +0530 Subject: [PATCH 18/18] chore: minor clean-up Signed-off-by: Shabareesh Shetty <139731143+ShabiShett07@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/base/dspr/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dspr/README.md b/lib/node_modules/@stdlib/blas/base/dspr/README.md index 3a80ab1cd0f6..9f41fae6bbf8 100644 --- a/lib/node_modules/@stdlib/blas/base/dspr/README.md +++ b/lib/node_modules/@stdlib/blas/base/dspr/README.md @@ -204,7 +204,7 @@ The function accepts the following arguments: - **layout**: `[in] CBLAS_LAYOUT` storage layout. - **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied. - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. -- **alpha**: `[in] double` scalar. +- **alpha**: `[in] double` scalar constant. - **X**: `[in] double*` input vector. - **sx**: `[in] CBLAS_INT` stride length for `X`. - **AP**: `[inout] double*` packed form of a symmetric matrix `A`. @@ -231,7 +231,7 @@ The function accepts the following arguments: - **layout**: `[in] CBLAS_LAYOUT` storage layout. - **uplo**: `[in] CBLAS_UPLO` specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied. - **N**: `[in] CBLAS_INT` number of elements along each dimension of `A`. -- **alpha**: `[in] double` scalar. +- **alpha**: `[in] double` scalar constant. - **X**: `[in] double*` input vector. - **sx**: `[in] CBLAS_INT` stride length for `X`. - **ox**: `[in] CBLAS_INT` starting index for `x`.