From e583fa938fe45d65a981ae81e29b53c090c60b29 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 12:15:12 +0000 Subject: [PATCH 1/4] fix: support empty arrays and resolve README links in `ndarray/from-arraybuffer` Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017wWD79mcKgFp6uqWTuGTWj --- lib/node_modules/@stdlib/ndarray/from-arraybuffer/README.md | 4 +--- lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/from-arraybuffer/README.md b/lib/node_modules/@stdlib/ndarray/from-arraybuffer/README.md index d27ebaa2dbfb..fbe3ee8948a4 100644 --- a/lib/node_modules/@stdlib/ndarray/from-arraybuffer/README.md +++ b/lib/node_modules/@stdlib/ndarray/from-arraybuffer/README.md @@ -187,9 +187,7 @@ v = arr.get( 1, 2, 1, 2 ); [@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/dtypes -[@stdlib/ndarray/orders]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/orders - -[@stdlib/ndarray/index-modes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/index-modes +[@stdlib/array/buffer]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/buffer diff --git a/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js b/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js index e531b5f8cd85..71f38eaeddc9 100644 --- a/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js @@ -179,7 +179,7 @@ function arraybuffer2ndarray( dtype, buffer, shape, strides, byteOffset, order, // Compute the number of underlying elements across which the ndarray view will span: offset = strides2offset( shape, strides ); idx = minmaxViewBufferIndex( shape, strides, offset ); - N = idx[ 1 ] - idx[ 0 ] + 1; + N = ( numel( shape ) === 0 ) ? 0 : idx[ 1 ] - idx[ 0 ] + 1; // Create the underlying ndarray buffer: if ( isBinaryDataType( dtype ) ) { From 3fac6b8d0ecd9673a9ea5e0d9a10252132b3f0ec Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 12:15:19 +0000 Subject: [PATCH 2/4] docs: sync README C example with `examples/c/example.c` in `math/base/special/cinv` Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017wWD79mcKgFp6uqWTuGTWj --- lib/node_modules/@stdlib/math/base/special/cinv/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cinv/README.md b/lib/node_modules/@stdlib/math/base/special/cinv/README.md index 721d12368c83..5e7f146725e3 100644 --- a/lib/node_modules/@stdlib/math/base/special/cinv/README.md +++ b/lib/node_modules/@stdlib/math/base/special/cinv/README.md @@ -216,7 +216,7 @@ stdlib_complex128_t stdlib_base_cinv( const stdlib_complex128_t z ); #include "stdlib/complex/float64/reim.h" #include -int main() { +int main( void ) { const stdlib_complex128_t x[] = { stdlib_complex128( 3.14, 1.5 ), stdlib_complex128( -3.14, -1.5 ), From b2575e6b68f3ba4c5cd043517f01665dce42b715 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 12:15:20 +0000 Subject: [PATCH 3/4] docs: sync README example with `examples/index.js` in `math/base/special/cinvf` Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017wWD79mcKgFp6uqWTuGTWj --- lib/node_modules/@stdlib/math/base/special/cinvf/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/math/base/special/cinvf/README.md b/lib/node_modules/@stdlib/math/base/special/cinvf/README.md index 39b6e38dbc26..9295f72c5a8d 100644 --- a/lib/node_modules/@stdlib/math/base/special/cinvf/README.md +++ b/lib/node_modules/@stdlib/math/base/special/cinvf/README.md @@ -128,7 +128,9 @@ var logEachMap = require( '@stdlib/console/log-each-map' ); var cinvf = require( '@stdlib/math/base/special/cinvf' ); // Create an array of random numbers: -var arr = new Complex64Array( uniform( 200, -100.0, 100.0 ) ); +var arr = new Complex64Array( uniform( 200, -100.0, 100.0, { + 'dtype': 'float32' +})); // Compute the inverse of each number in the array: logEachMap( '1.0 / (%s) = %s', arr, cinvf ); From 0c5af61720d760b1670713624d3096839829b46f Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 4 Nov 2026 00:19:33 +0100 Subject: [PATCH 4/4] refactor: assign computed value to internal variable Signed-off-by: Athan --- .../@stdlib/ndarray/from-arraybuffer/lib/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js b/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js index 71f38eaeddc9..10dc3849f600 100644 --- a/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/from-arraybuffer/lib/main.js @@ -141,6 +141,7 @@ function arraybuffer2ndarray( dtype, buffer, shape, strides, byteOffset, order, var ndims; var buf; var idx; + var len; var N; if ( !isDataType( dtype ) ) { @@ -179,7 +180,8 @@ function arraybuffer2ndarray( dtype, buffer, shape, strides, byteOffset, order, // Compute the number of underlying elements across which the ndarray view will span: offset = strides2offset( shape, strides ); idx = minmaxViewBufferIndex( shape, strides, offset ); - N = ( numel( shape ) === 0 ) ? 0 : idx[ 1 ] - idx[ 0 ] + 1; + len = numel( shape ); + N = ( len === 0 ) ? 0 : idx[ 1 ] - idx[ 0 ] + 1; // Create the underlying ndarray buffer: if ( isBinaryDataType( dtype ) ) { @@ -189,7 +191,7 @@ function arraybuffer2ndarray( dtype, buffer, shape, strides, byteOffset, order, } else { buf = typedarray( buffer, byteOffset, N, dtype ); } - if ( ndims > 0 && !isBufferLengthCompatible( buf.length, shape, strides, offset ) && numel( shape ) > 0 ) { // eslint-disable-line max-len + if ( ndims > 0 && len > 0 && !isBufferLengthCompatible( buf.length, shape, strides, offset ) ) { // eslint-disable-line max-len throw new Error( 'invalid arguments. Input buffer is incompatible with the specified meta data. Ensure that the offset is valid with regard to the strides array and that the buffer has enough elements to satisfy the desired array shape.' ); } // Return a new ndarray instance: