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..5d8e897b39be 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` must be broadcast-compatible with a zero-dimensional ndarray... + return base( x, maybeBroadcastArray( k, [] ) ); } throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or an integer. Value: `%s`.', k ) ); } @@ -104,12 +104,13 @@ function circshift( x, k ) { } // Case: circshift( x, k_ndarray, opts ) else if ( isndarrayLike( k ) ) { - // When not provided `dims`, the operation is performed across all dimensions and `k` is assumed to be a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `k` to match the shape of the non-core dimensions... + // When not provided `dims`, the operation is performed across all dimensions and `k` must be broadcast-compatible with a zero-dimensional ndarray; when `dims` is provided, we need to broadcast `k` to match the shape of the non-core dimensions... if ( hasOwnProp( opts, 'dims' ) ) { - ka = maybeBroadcastArray( k, nonCoreShape( getShape( x ), opts.dims ) ); // eslint-disable-line max-len + sh = nonCoreShape( getShape( x ), opts.dims ); } else { - ka = k; + sh = []; } + ka = maybeBroadcastArray( k, sh ); } 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..0c8d9f4a04cc 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` must be broadcast-compatible with a zero-dimensional ndarray... + return base( x, maybeBroadcastArray( o, [] ) ); } // Case: sort( x, opts ) opts = o; @@ -201,10 +201,13 @@ function sort( x ) { } // Case: sort( x, sortOrder_ndarray, opts ) else if ( isndarrayLike( o ) ) { - // 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... + // When not provided `dims`, the operation is performed across all dimensions and `o` must be broadcast-compatible with 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 ) ); + sh = nonCoreShape( getShape( x ), opts.dims ); + } else { + sh = []; } + o = maybeBroadcastArray( o, sh ); } 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..c12cb11e96d8 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` must be broadcast-compatible with a zero-dimensional ndarray... + return base( x, maybeBroadcastArray( o, [] ) ); } // Case: sorthp( x, opts ) opts = o; @@ -201,10 +201,13 @@ function sorthp( x ) { } // Case: sorthp( x, sortOrder_ndarray, opts ) else if ( isndarrayLike( o ) ) { - // 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... + // When not provided `dims`, the operation is performed across all dimensions and `o` must be broadcast-compatible with 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 ) ); + sh = nonCoreShape( getShape( x ), opts.dims ); + } else { + sh = []; } + o = maybeBroadcastArray( o, sh ); } 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 ) ); }