diff --git a/lib/node_modules/@stdlib/blas/ext/circshift/lib/main.js b/lib/node_modules/@stdlib/blas/ext/circshift/lib/main.js index c83f975c12c5..dffddc966b72 100644 --- a/lib/node_modules/@stdlib/blas/ext/circshift/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/circshift/lib/main.js @@ -85,8 +85,8 @@ function circshift( x, k ) { } // Case: circshift( x, k_ndarray ) if ( isndarrayLike( k ) ) { - // As the operation is performed across all dimensions, `k` is assumed to be a zero-dimensional ndarray... - return base( x, k ); + // As the operation is performed across all dimensions, `k` is assumed to be a zero-dimensional ndarray, so ensure that `k` is broadcast-compatible with a zero-dimensional shape... + return base( x, maybeBroadcastArray( k, [] ) ); } throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or an integer. Value: `%s`.', k ) ); } @@ -108,7 +108,7 @@ function circshift( x, k ) { if ( hasOwnProp( opts, 'dims' ) ) { ka = maybeBroadcastArray( k, nonCoreShape( getShape( x ), opts.dims ) ); // eslint-disable-line max-len } else { - ka = k; + ka = maybeBroadcastArray( k, [] ); } } else { throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or an integer. Value: `%s`.', k ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/sort/lib/main.js b/lib/node_modules/@stdlib/blas/ext/sort/lib/main.js index e63d1b1a31d7..c273441391cf 100644 --- a/lib/node_modules/@stdlib/blas/ext/sort/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/sort/lib/main.js @@ -176,8 +176,8 @@ function sort( x ) { } // Case: sort( x, sortOrder_ndarray ) if ( isndarrayLike( o ) ) { - // As the operation is performed across all dimensions, `o` is assumed to be a zero-dimensional ndarray... - return base( x, o ); + // As the operation is performed across all dimensions, `o` is assumed to be a zero-dimensional ndarray, so ensure that `o` is broadcast-compatible with a zero-dimensional shape... + return base( x, maybeBroadcastArray( o, [] ) ); } // Case: sort( x, opts ) opts = o; @@ -204,6 +204,8 @@ function sort( x ) { // When not provided `dims`, the operation is performed across all dimensions and `o` is assumed to be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `o` to match the shape of the non-core dimensions... if ( hasOwnProp( opts, 'dims' ) ) { o = maybeBroadcastArray( o, nonCoreShape( getShape( x ), opts.dims ) ); + } else { + o = maybeBroadcastArray( o, [] ); } } else { throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray, a numeric scalar value, or a supported string. Value: `%s`.', o ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/sorthp/lib/main.js b/lib/node_modules/@stdlib/blas/ext/sorthp/lib/main.js index fb9353958dc3..128b27abcb54 100644 --- a/lib/node_modules/@stdlib/blas/ext/sorthp/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/sorthp/lib/main.js @@ -176,8 +176,8 @@ function sorthp( x ) { } // Case: sorthp( x, sortOrder_ndarray ) if ( isndarrayLike( o ) ) { - // As the operation is performed across all dimensions, `o` is assumed to be a zero-dimensional ndarray... - return base( x, o ); + // As the operation is performed across all dimensions, `o` is assumed to be a zero-dimensional ndarray, so ensure that `o` is broadcast-compatible with a zero-dimensional shape... + return base( x, maybeBroadcastArray( o, [] ) ); } // Case: sorthp( x, opts ) opts = o; @@ -204,6 +204,8 @@ function sorthp( x ) { // When not provided `dims`, the operation is performed across all dimensions and `o` is assumed to be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `o` to match the shape of the non-core dimensions... if ( hasOwnProp( opts, 'dims' ) ) { o = maybeBroadcastArray( o, nonCoreShape( getShape( x ), opts.dims ) ); + } else { + o = maybeBroadcastArray( o, [] ); } } else { throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray, a numeric scalar value, or a supported string. Value: `%s`.', o ) );