From 4f90d206d187eb9914a061652d8441f30ee45c4f Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Sun, 2 Feb 2025 15:27:52 +0530 Subject: [PATCH 1/8] feat: add C ndarray interface and refactor 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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: 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: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/ext/base/dsortsh/README.md | 134 +++++++++++- .../ext/base/dsortsh/benchmark/c/Makefile | 146 +++++++++++++ .../c/benchmark.unsorted_random.length.c | 191 ++++++++++++++++++ .../blas/ext/base/dsortsh/docs/repl.txt | 30 ++- .../ext/base/dsortsh/docs/types/index.d.ts | 12 +- .../ext/base/dsortsh/examples/c/example.c | 2 +- .../include/stdlib/blas/ext/base/dsortsh.h | 9 +- .../blas/ext/base/dsortsh/lib/dsortsh.js | 59 +----- .../ext/base/dsortsh/lib/dsortsh.native.js | 6 +- .../blas/ext/base/dsortsh/lib/ndarray.js | 18 +- .../ext/base/dsortsh/lib/ndarray.native.js | 19 +- .../blas/ext/base/dsortsh/manifest.json | 51 ++++- .../@stdlib/blas/ext/base/dsortsh/src/addon.c | 22 +- .../base/dsortsh/src/{dsortsh.c => main.c} | 61 +++--- 14 files changed, 615 insertions(+), 145 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/Makefile create mode 100644 lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c rename lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/{dsortsh.c => main.c} (63%) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md index 26a73d85ee9d..908d2957e871 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md @@ -30,9 +30,9 @@ limitations under the License. var dsortsh = require( '@stdlib/blas/ext/base/dsortsh' ); ``` -#### dsortsh( N, order, x, stride ) +#### dsortsh( N, order, x, strideX ) -Sorts a double-precision floating-point strided array `x` using Shellsort. +Sorts a double-precision floating-point strided array using Shellsort. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -48,7 +48,7 @@ The function has the following parameters: - **N**: number of indexed elements. - **order**: sort order. If `order < 0.0`, the input strided array is sorted in **decreasing** order. If `order > 0.0`, the input strided array is sorted in **increasing** order. If `order == 0.0`, the input strided array is left unchanged. - **x**: input [`Float64Array`][@stdlib/array/float64]. -- **stride**: index increment. +- **strideX**: stride length. The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to sort every other element @@ -77,9 +77,9 @@ dsortsh( 2, -1.0, x1, 2 ); // x0 => [ 1.0, 4.0, 3.0, 2.0 ] ``` -#### dsortsh.ndarray( N, order, x, stride, offset ) +#### dsortsh.ndarray( N, order, x, strideX, offsetX ) -Sorts a double-precision floating-point strided array `x` using Shellsort and alternative indexing semantics. +Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -92,9 +92,9 @@ dsortsh.ndarray( x.length, 1.0, x, 1, 0 ); The function has the following additional parameters: -- **offset**: starting index. +- **offsetX**: starting index. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of `x` +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements: ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -167,6 +167,126 @@ console.log( x ); * * * +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/dsortsh.h" +``` + +#### stdlib_strided_dsortsh( N, order, \*X, strideX ) + +Sorts a double-precision floating-point strided array using Shellsort. + +```c +double x[] = { 1.0, -2.0, 3.0, -4.0 }; + +stdlib_strided_dsortsh( 2, -1, x, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. +- **X**: `[inout] double*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. + +```c +stdlib_strided_dsortsh( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX ); +``` + + + +#### stdlib_strided_dsortsh_ndarray( N, order, \*X, strideX, offsetX ) + + + +Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. + +```c +double x[] = { 1.0, -2.0, 3.0, -4.0 }; + +stdlib_strided_dsortsh_ndarray( 4, 1, x, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **order**: `[in] CBLAS_INT` sort order. +- **X**: `[inout] double*` input array. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. + +```c +stdlib_strided_dsortsh_ndarray( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/dsortsh.h" +#include + +int main( void ) { + // Create a strided array: + double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 }; + + // Specify the number of elements: + int N = 8; + + // Specify a stride: + int strideX = 1; + + // Sort the array: + stdlib_strided_dsortsh( N, 1.0, x, strideX ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + } +} + +``` + +
+ + + +
+ + + ## See Also - [`@stdlib/blas/ext/base/dsort2sh`][@stdlib/blas/ext/base/dsort2sh]: simultaneously sort two double-precision floating-point strided arrays based on the sort order of the first array using Shellsort. diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/Makefile new file mode 100644 index 000000000000..25ced822f96a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/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 := 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/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c new file mode 100644 index 000000000000..ea38a69ddf35 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c @@ -0,0 +1,191 @@ +/** +* @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/ext/base/dsortsh.h" +#include +#include +#include +#include +#include + +#define NAME "dsort2sh" +#define ITERATIONS 10000000 +#define REPEATS 3 +#define MIN 1 +#define MAX 6 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param iterations number of iterations +* @param elapsed elapsed time in seconds +*/ +static void print_results( int iterations, double elapsed ) { + double rate = (double)iterations / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", iterations ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [0,1). +* +* @return random number +*/ +static double rand_double( void ) { + int r = rand(); + return (double)r / ( (double)RAND_MAX + 1.0 ); +} + +/** +* Runs a benchmark. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark1( int iterations, int len ) { + double elapsed; + double x[ len ]; + double t; + int i; + + for ( i = 0; i < len; i++ ) { + x[ i ] = ( rand_double()*20.0 ) - 10.0; + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + stdlib_strided_dsortsh( len, 1, x, 1 ); + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( x[ 0 ] != x[ 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; + double x[ len ]; + double t; + int i; + + for ( i = 0; i < len; i++ ) { + x[ i ] = ( rand_double()*20.0 ) - 10.0; + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + stdlib_strided_dsortsh_ndarray( len, 1, x, 1, 0 ); + if ( x[ 0 ] != x[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( x[ 0 ] != x[ 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 = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:unsorted,random:len=%d\n", NAME, len ); + elapsed = benchmark1( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + for ( i = MIN; i <= MAX; i++ ) { + len = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:ndarray:unsorted,random: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/ext/base/dsortsh/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt index 7f0915abd0c7..fff92464b9bf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt @@ -1,8 +1,8 @@ -{{alias}}( N, order, x, stride ) +{{alias}}( N, order, x, strideX ) Sorts a double-precision floating-point strided array using Shellsort. - The `N` and `stride` parameters determine which elements in `x` are accessed + The `N` and stride parameters determine which elements in are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use typed @@ -42,13 +42,13 @@ x: Float64Array Input array. - stride: integer - Index increment for `x`. + strideX: integer + Stride length. Returns ------- x: Float64Array - Input array `x`. + Output Array. Examples -------- @@ -59,20 +59,19 @@ // Using `N` and `stride` parameters: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}( N, -1, x, 2 ) + > {{alias}}( 2, -1, x, 2 ) [ 3.0, -2.0, 1.0, -4.0 ] // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); - > {{alias}}( N, 1, x1, 2 ) + > {{alias}}( 2, 1, x1, 2 ) [ -4.0, 3.0, -2.0 ] > x0 [ 1.0, -4.0, 3.0, -2.0 ] -{{alias}}.ndarray( N, order, x, stride, offset ) + +{{alias}}.ndarray( N, order, x, strideX, offsetX ) Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. @@ -92,16 +91,16 @@ x: Float64Array Input array. - stride: integer - Index increment for `x`. + strideX: integer + Stride length. - offset: integer + offsetX: integer Starting index of `x`. Returns ------- x: Float64Array - Input array `x`. + Output Array. Examples -------- @@ -112,8 +111,7 @@ // Using an index offset: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, 1, x, 2, 1 ) + > {{alias}}.ndarray( 2, 1, x, 2, 1 ) [ 1.0, -4.0, 3.0, -2.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/types/index.d.ts index 196e7051f4fb..260c564e9767 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/types/index.d.ts @@ -28,7 +28,7 @@ interface Routine { * @param N - number of indexed elements * @param order - sort order * @param x - input array - * @param stride - stride length + * @param strideX - stride length * @returns `x` * * @example @@ -39,7 +39,7 @@ interface Routine { * dsortsh( x.length, 1, x, 1 ); * // x => [ -4.0, -2.0, 1.0, 3.0 ] */ - ( N: number, order: number, x: Float64Array, stride: number ): Float64Array; + ( N: number, order: number, x: Float64Array, strideX: number ): Float64Array; /** * Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. @@ -47,8 +47,8 @@ interface Routine { * @param N - number of indexed elements * @param order - sort order * @param x - input array - * @param stride - stride length - * @param offset - starting index + * @param strideX - stride length + * @param offsetX - starting index * @returns `x` * * @example @@ -59,7 +59,7 @@ interface Routine { * dsortsh.ndarray( x.length, 1, x, 1, 0 ); * // x => [ -4.0, -2.0, 1.0, 3.0 ] */ - ndarray( N: number, order: number, x: Float64Array, stride: number, offset: number ): Float64Array; + ndarray( N: number, order: number, x: Float64Array, strideX: number, offsetX: number ): Float64Array; } /** @@ -68,7 +68,7 @@ interface Routine { * @param N - number of indexed elements * @param order - sort order * @param x - input array -* @param stride - stride length +* @param strideX - stride length * @returns `x` * * @example diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c index 76ec1c849d71..ca0f4ede6153 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c @@ -30,7 +30,7 @@ int main( void ) { int strideX = 1; // Sort the array: - c_dsortsh( N, 1.0, x, strideX ); + stdlib_strided_dsortsh( N, 1.0, x, strideX ); // Print the result: for ( int i = 0; i < 8; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h index a7fea982abda..ca2556fe56ba 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h @@ -19,7 +19,7 @@ #ifndef STDLIB_BLAS_EXT_BASE_DSORTSH_H #define STDLIB_BLAS_EXT_BASE_DSORTSH_H -#include +#include "stdlib/blas/base/shared.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. @@ -31,7 +31,12 @@ extern "C" { /** * Sorts a double-precision floating-point strided array using Shellsort. */ -void c_dsortsh( const int64_t N, const double order, double *X, const int64_t stride ); +void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX ); + +/** +* Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. +*/ +void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js index 4bf00d9e0b4e..a74e64e168f0 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js @@ -20,14 +20,8 @@ // MODULES // -var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var GAPS = require( './gaps.json' ); - - -// VARIABLES // - -var NGAPS = GAPS.length; +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); // MAIN // @@ -47,7 +41,7 @@ var NGAPS = GAPS.length; * @param {PositiveInteger} N - number of indexed elements * @param {number} order - sort order * @param {Float64Array} x - input array -* @param {integer} stride - index increment +* @param {integer} strideX - stride length * @returns {Float64Array} input array * * @example @@ -58,50 +52,11 @@ var NGAPS = GAPS.length; * dsortsh( x.length, 1.0, x, 1 ); * // x => [ -4.0, -2.0, 1.0, 3.0 ] */ -function dsortsh( N, order, x, stride ) { - var offset; - var flg; - var gap; - var v; - var u; - var i; - var j; - var k; - - if ( N <= 0 || order === 0.0 ) { - return x; - } - // For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order... - if ( order < 0.0 ) { - stride *= -1; - } - if ( stride < 0 ) { - offset = (1-N) * stride; - } else { - offset = 0; - } - for ( i = 0; i < NGAPS; i++ ) { - gap = GAPS[ i ]; - for ( j = gap; j < N; j++ ) { - v = x[ offset+(j*stride) ]; +function dsortsh( N, order, x, strideX ) { + var offsetX; - // If `NaN`, the current value is already sorted to its place... - if ( isnan( v ) ) { - continue; - } - // Perform insertion sort on the "gapped" subarray... - flg = isNegativeZero( v ); - for ( k = j; k >= gap; k -= gap ) { - u = x[ offset+((k-gap)*stride) ]; - if ( u <= v && !(flg && u === v) ) { - break; - } - x[ offset+(k*stride) ] = u; - } - x[ offset+(k*stride) ] = v; - } - } - return x; + offsetX = stride2offset( N, strideX ); + return ndarray( N, order, x, strideX, offsetX, offsetX ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.native.js b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.native.js index 70b36372020e..a67388a737d0 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.native.js @@ -31,7 +31,7 @@ var addon = require( './../src/addon.node' ); * @param {PositiveInteger} N - number of indexed elements * @param {number} order - sort order * @param {Float64Array} x - input array -* @param {integer} stride - index increment +* @param {integer} strideX - stride length * @returns {Float64Array} input array * * @example @@ -42,8 +42,8 @@ var addon = require( './../src/addon.node' ); * dsortsh( x.length, 1.0, x, 1 ); * // x => [ -4.0, -2.0, 1.0, 3.0 ] */ -function dsortsh( N, order, x, stride ) { - addon( N, order, x, stride ); +function dsortsh( N, order, x, strideX ) { + addon( N, order, x, strideX ); return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.js index 6a664fa8a2c7..6c167928081b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.js @@ -47,8 +47,8 @@ var NGAPS = GAPS.length; * @param {PositiveInteger} N - number of indexed elements * @param {number} order - sort order * @param {Float64Array} x - input array -* @param {integer} stride - index increment -* @param {NonNegativeInteger} offset - starting index +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index * @returns {Float64Array} input array * * @example @@ -59,7 +59,7 @@ var NGAPS = GAPS.length; * dsortsh( x.length, 1.0, x, 1, 0 ); * // x => [ -4.0, -2.0, 1.0, 3.0 ] */ -function dsortsh( N, order, x, stride, offset ) { +function dsortsh( N, order, x, strideX, offsetX ) { var flg; var gap; var v; @@ -73,13 +73,13 @@ function dsortsh( N, order, x, stride, offset ) { } // For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order... if ( order < 0.0 ) { - stride *= -1; - offset -= (N-1) * stride; + strideX *= -1; + offsetX -= (N-1) * strideX; } for ( i = 0; i < NGAPS; i++ ) { gap = GAPS[ i ]; for ( j = gap; j < N; j++ ) { - v = x[ offset+(j*stride) ]; + v = x[ offsetX+(j*strideX) ]; // If `NaN`, the current value is already sorted to its place... if ( isnan( v ) ) { @@ -88,13 +88,13 @@ function dsortsh( N, order, x, stride, offset ) { // Perform insertion sort on the "gapped" subarray... flg = isNegativeZero( v ); for ( k = j; k >= gap; k -= gap ) { - u = x[ offset+((k-gap)*stride) ]; + u = x[ offsetX+((k-gap)*strideX) ]; if ( u <= v && !(flg && u === v) ) { break; } - x[ offset+(k*stride) ] = u; + x[ offsetX+(k*strideX) ] = u; } - x[ offset+(k*stride) ] = v; + x[ offsetX+(k*strideX) ] = v; } } return x; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.native.js index 04a4826ca225..67df06c5f25c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/ndarray.native.js @@ -20,8 +20,7 @@ // MODULES // -var offsetView = require( '@stdlib/strided/base/offset-view' ); -var addon = require( './dsortsh.native.js' ); +var addon = require( './../src/addon.node' ); // MAIN // @@ -32,8 +31,8 @@ var addon = require( './dsortsh.native.js' ); * @param {PositiveInteger} N - number of indexed elements * @param {number} order - sort order * @param {Float64Array} x - input array -* @param {integer} stride - index increment -* @param {NonNegativeInteger} offset - starting index +* @param {integer} strideX - stride length +* @param {NonNegativeInteger} offsetX - starting index * @returns {Float64Array} input array * * @example @@ -43,16 +42,8 @@ var addon = require( './dsortsh.native.js' ); * * dsortsh( x.length, 1.0, x, 1, 0 ); */ -function dsortsh( N, order, x, stride, offset ) { - var view; - if ( stride < 0 ) { - order *= -1.0; - stride *= -1; - offset -= (N-1) * stride; - } - view = offsetView( x, offset ); - addon( N, order, view, stride ); - +function dsortsh( N, order, x, strideX, offsetX ) { + addon.ndarray( N, order, x, strideX, offsetX ); return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json index c1abfaef7028..9de317c054a7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json @@ -24,15 +24,14 @@ ], "confs": [ { + "task": "build", "src": [ - "./src/dsortsh.c" + "./src/main.c" ], "include": [ "./include" ], - "libraries": [ - "-lm" - ], + "libraries": [], "libpath": [], "dependencies": [ "@stdlib/napi/export", @@ -41,7 +40,49 @@ "@stdlib/napi/argv", "@stdlib/napi/argv-int64", "@stdlib/napi/argv-double", - "@stdlib/napi/argv-strided-float64array" + "@stdlib/napi/argv-strided-float64array", + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/floor", + "@stdlib/math/base/assert/is-positive-zero", + "@stdlib/napi/create-double", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/floor", + "@stdlib/math/base/assert/is-positive-zero", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/assert/is-nan", + "@stdlib/math/base/special/floor", + "@stdlib/math/base/assert/is-positive-zero", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared" ] } ] diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c index 74c6dc94bf47..4a4fad16e398 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c @@ -37,10 +37,26 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_DOUBLE( env, order, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, order, argv, 2 ); + API_SUFFIX(stdlib_strided_dsortsh)( N, order, X, strideX ); + return NULL; +} - c_dsortsh( N, order, X, strideX ); - +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon_method( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 5 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_DOUBLE( env, order, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 ); + API_SUFFIX(stdlib_strided_dsortsh_ndarray)( N, order, X, strideX, offsetX ); return NULL; } -STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/dsortsh.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c similarity index 63% rename from lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/dsortsh.c rename to lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c index 76479745876d..e91f4e0e68a3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/dsortsh.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2020 The Stdlib Authors. +* Copyright (c) 2025 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,8 @@ #include "stdlib/blas/ext/base/dsortsh.h" #include "stdlib/math/base/assert/is_negative_zero.h" #include "stdlib/math/base/assert/is_nan.h" -#include +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" #include /** @@ -34,44 +35,50 @@ * - Shell, Donald L. 1959. "A High-Speed Sorting Procedure." _Communications of the ACM_ 2 (7). Association for Computing Machinery: 30–32. doi:[10.1145/368370.368387](https://doi.org/10.1145/368370.368387). * - Ciura, Marcin. 2001. "Best Increments for the Average Case of Shellsort." In _Fundamentals of Computation Theory_, 106–17. Springer Berlin Heidelberg. doi:[10.1007/3-540-44669-9\_12](https://doi.org/10.1007/3-540-44669-9_12). * -* @param N number of indexed elements -* @param order sort order -* @param X input array -* @param stride index increment +* @param N number of indexed elements +* @param order sort order +* @param X input array +* @param strideX index increment */ -void c_dsortsh( const int64_t N, const double order, double *X, const int64_t stride ) { - int64_t offset; - int64_t gap; - int64_t sx; - int64_t i; - int64_t j; - int64_t k; +void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX ) { + CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + API_SUFFIX(stdlib_strided_dsortsh_ndarray)( N, order, X, strideX, ox ); +} + +/** +* Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. +* +* @param N number of indexed elements +* @param order sort order +* @param X input array +* @param strideX index increment +* @param offsetX starting index +*/ +void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX ) { + CBLAS_INT gap; + CBLAS_INT i; + CBLAS_INT j; + CBLAS_INT k; double v; double u; bool flg; // Ciura's gap sequence: - const static int64_t GAPS[] = { 701, 301, 132, 57, 23, 10, 4, 1 }; - const static int64_t NGAPS = 8; + const static CBLAS_INT GAPS[] = { 701, 301, 132, 57, 23, 10, 4, 1 }; + const static CBLAS_INT NGAPS = 8; if ( N <= 0 || order == 0.0 ) { return; } // For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order... if ( order < 0.0 ) { - sx = -stride; - } else { - sx = stride; - } - if ( sx < 0 ) { - offset = (1-N) * sx; - } else { - offset = 0; + strideX *= -1; + offsetX -= (N-1) * strideX; } for ( i = 0; i < NGAPS; i++ ) { gap = GAPS[ i ]; for ( j = gap; j < N; j++ ) { - v = X[ offset+(j*sx) ]; + v = X[ offsetX+(j*strideX) ]; // If `NaN`, the current value is already sorted to its place... if ( stdlib_base_is_nan( v ) ) { @@ -80,13 +87,13 @@ void c_dsortsh( const int64_t N, const double order, double *X, const int64_t st // Perform insertion sort on the "gapped" subarray... flg = stdlib_base_is_negative_zero( v ); for ( k = j; k >= gap; k -= gap ) { - u = X[ offset+((k-gap)*sx) ]; + u = X[ offsetX+((k-gap)*strideX) ]; if ( u <= v && !(flg && u == v) ) { break; } - X[ offset+(k*sx) ] = u; + X[ offsetX+(k*strideX) ] = u; } - X[ offset+(k*sx) ] = v; + X[ offsetX+(k*strideX) ] = v; } } return; From ca832608672b35c094af25d679bb8e771e2c39f5 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Sun, 2 Feb 2025 18:11:10 +0530 Subject: [PATCH 2/8] chore: updated manifest file --- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: failed --- --- .../@stdlib/blas/ext/base/dsortsh/manifest.json | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json index 9de317c054a7..5b00d69337f0 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json @@ -41,10 +41,6 @@ "@stdlib/napi/argv-int64", "@stdlib/napi/argv-double", "@stdlib/napi/argv-strided-float64array", - "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/floor", - "@stdlib/math/base/assert/is-positive-zero", - "@stdlib/napi/create-double", "@stdlib/strided/base/stride2offset", "@stdlib/blas/base/shared" ] @@ -61,8 +57,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/floor", - "@stdlib/math/base/assert/is-positive-zero", + "@stdlib/math/base/assert/is-negative-zero", "@stdlib/strided/base/stride2offset", "@stdlib/blas/base/shared" ] @@ -79,8 +74,7 @@ "libpath": [], "dependencies": [ "@stdlib/math/base/assert/is-nan", - "@stdlib/math/base/special/floor", - "@stdlib/math/base/assert/is-positive-zero", + "@stdlib/math/base/assert/is-negative-zero", "@stdlib/strided/base/stride2offset", "@stdlib/blas/base/shared" ] From 3d08e3efe830f50ddef7cfbabee12e4981023f9a Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Sun, 2 Feb 2025 18:32:53 +0530 Subject: [PATCH 3/8] chore: addon strideX on array --- 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: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: failed --- --- .../@stdlib/blas/ext/base/dsortsh/examples/c/example.c | 2 +- lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c index ca0f4ede6153..80c83f937ca3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/c/example.c @@ -30,7 +30,7 @@ int main( void ) { int strideX = 1; // Sort the array: - stdlib_strided_dsortsh( N, 1.0, x, strideX ); + API_SUFFIX(stdlib_strided_dsortsh)( N, 1.0, x, strideX ); // Print the result: for ( int i = 0; i < 8; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c index 4a4fad16e398..31d0834147f3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/addon.c @@ -36,7 +36,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); STDLIB_NAPI_ARGV_DOUBLE( env, order, argv, 1 ); STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); - STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, order, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 ); API_SUFFIX(stdlib_strided_dsortsh)( N, order, X, strideX ); return NULL; } From f6216efaee0bb1ee885b377b3170aea4d2213a8a Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Mon, 3 Feb 2025 16:12:36 +0530 Subject: [PATCH 4/8] fix: update order parameter to use double literals in dsortsh functions --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: 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: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: failed --- --- .../@stdlib/blas/ext/base/dsortsh/README.md | 12 ++++----- .../c/benchmark.unsorted_random.length.c | 4 +-- .../blas/ext/base/dsortsh/docs/repl.txt | 2 +- .../include/stdlib/blas/ext/base/dsortsh.h | 4 +-- .../blas/ext/base/dsortsh/lib/dsortsh.js | 5 +--- .../@stdlib/blas/ext/base/dsortsh/src/main.c | 26 ++++++++++++------- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md index 908d2957e871..98b231d58c49 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md @@ -196,7 +196,7 @@ Sorts a double-precision floating-point strided array using Shellsort. ```c double x[] = { 1.0, -2.0, 3.0, -4.0 }; -stdlib_strided_dsortsh( 2, -1, x, 1 ); +stdlib_strided_dsortsh( 2, -1.0, x, 1 ); ``` The function accepts the following arguments: @@ -207,7 +207,7 @@ The function accepts the following arguments: - **strideX**: `[in] CBLAS_INT` stride length for `X`. ```c -stdlib_strided_dsortsh( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX ); +stdlib_strided_dsortsh( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX ); ``` @@ -221,19 +221,19 @@ Sorts a double-precision floating-point strided array using Shellsort and altern ```c double x[] = { 1.0, -2.0, 3.0, -4.0 }; -stdlib_strided_dsortsh_ndarray( 4, 1, x, 1, 0 ); +stdlib_strided_dsortsh_ndarray( 4, 1.0, x, 1, 0 ); ``` The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. -- **order**: `[in] CBLAS_INT` sort order. -- **X**: `[inout] double*` input array. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. +- **order**: `[in] CBLAS_INT` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. - **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **X**: `[inout] double*` input array. - **offsetX**: `[in] CBLAS_INT` starting index for `X`. ```c -stdlib_strided_dsortsh_ndarray( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX ); +stdlib_strided_dsortsh_ndarray( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); ``` diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c index ea38a69ddf35..e22dc029d8a9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c @@ -105,7 +105,7 @@ static double benchmark1( int iterations, int len ) { } t = tic(); for ( i = 0; i < iterations; i++ ) { - stdlib_strided_dsortsh( len, 1, x, 1 ); + stdlib_strided_dsortsh( len, 1.0, x, 1 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; @@ -136,7 +136,7 @@ static double benchmark2( int iterations, int len ) { } t = tic(); for ( i = 0; i < iterations; i++ ) { - stdlib_strided_dsortsh_ndarray( len, 1, x, 1, 0 ); + stdlib_strided_dsortsh_ndarray( len, 1.0, x, 1, 0 ); if ( x[ 0 ] != x[ 0 ] ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt index fff92464b9bf..3053c008371b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt @@ -76,7 +76,7 @@ alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the `offset` parameter supports indexing semantics based on a + buffer, the offset parameter supports indexing semantics based on a starting index. Parameters diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h index ca2556fe56ba..c142542b1c09 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/include/stdlib/blas/ext/base/dsortsh.h @@ -31,12 +31,12 @@ extern "C" { /** * Sorts a double-precision floating-point strided array using Shellsort. */ -void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX ); +void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX ); /** * Sorts a double-precision floating-point strided array using Shellsort and alternative indexing semantics. */ -void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX ); +void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js index a74e64e168f0..81ab03353448 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/lib/dsortsh.js @@ -53,10 +53,7 @@ var ndarray = require( './ndarray.js' ); * // x => [ -4.0, -2.0, 1.0, 3.0 ] */ function dsortsh( N, order, x, strideX ) { - var offsetX; - - offsetX = stride2offset( N, strideX ); - return ndarray( N, order, x, strideX, offsetX, offsetX ); + return ndarray( N, order, x, strideX, stride2offset( N, strideX ) ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c index e91f4e0e68a3..0008fb34ea79 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c @@ -40,7 +40,7 @@ * @param X input array * @param strideX index increment */ -void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX ) { +void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX ) { CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); API_SUFFIX(stdlib_strided_dsortsh_ndarray)( N, order, X, strideX, ox ); } @@ -54,8 +54,10 @@ void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, * @param strideX index increment * @param offsetX starting index */ -void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, CBLAS_INT strideX, CBLAS_INT offsetX ) { +void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { CBLAS_INT gap; + CBLAS_INT ox; + CBLAS_INT sx; CBLAS_INT i; CBLAS_INT j; CBLAS_INT k; @@ -64,21 +66,25 @@ void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double bool flg; // Ciura's gap sequence: - const static CBLAS_INT GAPS[] = { 701, 301, 132, 57, 23, 10, 4, 1 }; - const static CBLAS_INT NGAPS = 8; + const static int64_t GAPS[] = { 701, 301, 132, 57, 23, 10, 4, 1 }; + const static int64_t NGAPS = 8; if ( N <= 0 || order == 0.0 ) { return; } // For a positive stride, sorting in decreasing order is equivalent to providing a negative stride and sorting in increasing order, and, for a negative stride, sorting in decreasing order is equivalent to providing a positive stride and sorting in increasing order... if ( order < 0.0 ) { - strideX *= -1; - offsetX -= (N-1) * strideX; + sx = -strideX; + ox = offsetX - ( (N-1) * sx ); + } else { + sx = strideX; + ox = offsetX; } + for ( i = 0; i < NGAPS; i++ ) { gap = GAPS[ i ]; for ( j = gap; j < N; j++ ) { - v = X[ offsetX+(j*strideX) ]; + v = X[ ox+(j*sx) ]; // If `NaN`, the current value is already sorted to its place... if ( stdlib_base_is_nan( v ) ) { @@ -87,13 +93,13 @@ void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double // Perform insertion sort on the "gapped" subarray... flg = stdlib_base_is_negative_zero( v ); for ( k = j; k >= gap; k -= gap ) { - u = X[ offsetX+((k-gap)*strideX) ]; + u = X[ ox+((k-gap)*sx) ]; if ( u <= v && !(flg && u == v) ) { break; } - X[ offsetX+(k*strideX) ] = u; + X[ ox+(k*sx) ] = u; } - X[ offsetX+(k*strideX) ] = v; + X[ ox+(k*sx) ] = v; } } return; From 6d90d5ba51b529e3f6380c61e5c44febe2910152 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Mon, 3 Feb 2025 16:33:29 +0530 Subject: [PATCH 5/8] fix: add build task option to dsortsh manifest --- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json index 5b00d69337f0..348693c06e61 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/manifest.json @@ -1,5 +1,7 @@ { - "options": {}, + "options": { + "task": "build" + }, "fields": [ { "field": "src", From 5bf3254097c5ac5a37b90f2c5c96a9a0f56f8d66 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Tue, 4 Feb 2025 16:06:35 +0530 Subject: [PATCH 6/8] fix: update documentation for dsortsh parameters and examples --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: passed - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../@stdlib/blas/ext/base/dsortsh/README.md | 17 +++++++++-------- .../@stdlib/blas/ext/base/dsortsh/docs/repl.txt | 12 ++++++------ .../blas/ext/base/dsortsh/examples/index.js | 7 ++++--- .../@stdlib/blas/ext/base/dsortsh/src/main.c | 4 ++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md index 98b231d58c49..7711b0edd701 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md @@ -50,7 +50,7 @@ The function has the following parameters: - **x**: input [`Float64Array`][@stdlib/array/float64]. - **strideX**: stride length. -The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to sort every other element +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to sort every other element: ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -94,7 +94,7 @@ The function has the following additional parameters: - **offsetX**: starting index. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements: +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements: ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -132,11 +132,12 @@ dsortsh.ndarray( 3, 1.0, x, 1, x.length-3 ); ```javascript -var filledarrayBy = require( '@stdlib/array/filled-by' ); -var uniform = require( '@stdlib/random/base/uniform' ).factory; +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var dsortsh = require( '@stdlib/blas/ext/base/dsortsh' ); -var x = filledarrayBy( 100, 'float64', uniform( -100.0, 100.0 ) ); +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'float64' +}); console.log( x ); dsortsh( x.length, -1.0, x, -1 ); @@ -227,10 +228,10 @@ stdlib_strided_dsortsh_ndarray( 4, 1.0, x, 1, 0 ); The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. -- **order**: `[in] CBLAS_INT` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. +- **strideX**: `[in] CBLAS_INT` stride length. - **X**: `[inout] double*` input array. -- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index. ```c stdlib_strided_dsortsh_ndarray( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt index 3053c008371b..e6e7182e3067 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/docs/repl.txt @@ -2,8 +2,8 @@ {{alias}}( N, order, x, strideX ) Sorts a double-precision floating-point strided array using Shellsort. - The `N` and stride parameters determine which elements in are accessed - at runtime. + The `N` and stride parameters determine which elements in the strided array + are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use typed array views. @@ -48,7 +48,7 @@ Returns ------- x: Float64Array - Output Array. + Input array. Examples -------- @@ -76,8 +76,8 @@ alternative indexing semantics. While typed array views mandate a view offset based on the underlying - buffer, the offset parameter supports indexing semantics based on a - starting index. + buffer, the offset parameter supports indexing semantics based on a starting + index. Parameters ---------- @@ -100,7 +100,7 @@ Returns ------- x: Float64Array - Output Array. + Input array. Examples -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/index.js index a036fb73dc8a..b4c2c1920948 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/examples/index.js @@ -18,11 +18,12 @@ 'use strict'; -var filledarrayBy = require( '@stdlib/array/filled-by' ); -var uniform = require( '@stdlib/random/base/uniform' ).factory; +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var dsortsh = require( './../lib' ); -var x = filledarrayBy( 100, 'float64', uniform( -100.0, 100.0 ) ); +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'float64' +}); console.log( x ); dsortsh( x.length, -1.0, x, -1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c index 0008fb34ea79..f8c7c6e0006a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/src/main.c @@ -38,7 +38,7 @@ * @param N number of indexed elements * @param order sort order * @param X input array -* @param strideX index increment +* @param strideX stride length */ void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX ) { CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); @@ -51,7 +51,7 @@ void API_SUFFIX(stdlib_strided_dsortsh)( const CBLAS_INT N, const double order, * @param N number of indexed elements * @param order sort order * @param X input array -* @param strideX index increment +* @param strideX stride length * @param offsetX starting index */ void API_SUFFIX(stdlib_strided_dsortsh_ndarray)( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) { From 24200103f7fd6eb08337919fac220ef4e9e3152e Mon Sep 17 00:00:00 2001 From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com> Date: Tue, 4 Feb 2025 23:32:56 +0500 Subject: [PATCH 7/8] docs: apply suggestions from code review Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md index 7711b0edd701..281fe373c3ea 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/README.md @@ -205,7 +205,7 @@ The function accepts the following arguments: - **N**: `[in] CBLAS_INT` number of indexed elements. - **order**: `[in] double` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged. - **X**: `[inout] double*` input array. -- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **strideX**: `[in] CBLAS_INT` stride length. ```c stdlib_strided_dsortsh( const CBLAS_INT N, const double order, double *X, const CBLAS_INT strideX ); From 5f1f3cc3e1e4b7c0cb5c58dc5d2196bf34ea7380 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Mon, 10 Feb 2025 14:58:53 +0530 Subject: [PATCH 8/8] fix: correct benchmark name from dsort2sh to dsortsh --- 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: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: failed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: failed --- --- .../base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c index e22dc029d8a9..6f36c2b4832c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dsortsh/benchmark/c/benchmark.unsorted_random.length.c @@ -23,7 +23,7 @@ #include #include -#define NAME "dsort2sh" +#define NAME "dsortsh" #define ITERATIONS 10000000 #define REPEATS 3 #define MIN 1