Skip to content

Commit 39c21b4

Browse files
committed
Auto-generated commit
1 parent dc6ed6e commit 39c21b4

File tree

2 files changed

+77
-24
lines changed

2 files changed

+77
-24
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Features
1212

13+
- [`b77641d`](https://github.com/stdlib-js/stdlib/commit/b77641d288f89a5333abf07b421cf54e575c5d03) - update `ndarray/base` TypeScript declarations [(#10558)](https://github.com/stdlib-js/stdlib/pull/10558)
1314
- [`2db642e`](https://github.com/stdlib-js/stdlib/commit/2db642edf40e64407f05bcffcb3f0cdae718f8aa) - update `ndarray` TypeScript declarations [(#10560)](https://github.com/stdlib-js/stdlib/pull/10560)
1415
- [`f91aca6`](https://github.com/stdlib-js/stdlib/commit/f91aca6650536cb46c7b4c41bd05a2a37e0fe475) - add `maybeBroadcastArrayExceptDimensions` to namespace
1516
- [`5324e96`](https://github.com/stdlib-js/stdlib/commit/5324e9618a4b8688b4792ccceb146b348d9a9f2f) - add `ndarray/base/maybe-broadcast-array-except-dimensions` [(#10413)](https://github.com/stdlib-js/stdlib/pull/10413)
@@ -688,6 +689,11 @@
688689

689690
### BREAKING CHANGES
690691

692+
- [`b77641d`](https://github.com/stdlib-js/stdlib/commit/b77641d288f89a5333abf07b421cf54e575c5d03): add writable parameter to and always return a new ndarray in `removeSingletonDimensions`
693+
694+
- To migrate, in order to preserve prior writable behavior, users should set the final parameter equal to a boolean indicating whether the input ndarray is writable. If not, pass `false`; if yes, pass `true`.
695+
To preserve prior behavior in which the input ndarray is returned if it does not have singleton dimensions, use `maybeRemoveSingletonDimensions`.
696+
691697
- [`9df924b`](https://github.com/stdlib-js/stdlib/commit/9df924b5f0b773c8b06d06b40e54dee75059ce08): add writable parameter
692698

693699
- To migrate and preserve prior behavior, users should always pass `true` for the second parameter.
@@ -775,6 +781,7 @@ A total of 44 issues were closed in this release:
775781

776782
<details>
777783

784+
- [`b77641d`](https://github.com/stdlib-js/stdlib/commit/b77641d288f89a5333abf07b421cf54e575c5d03) - **feat:** update `ndarray/base` TypeScript declarations [(#10558)](https://github.com/stdlib-js/stdlib/pull/10558) _(by stdlib-bot)_
778785
- [`2db642e`](https://github.com/stdlib-js/stdlib/commit/2db642edf40e64407f05bcffcb3f0cdae718f8aa) - **feat:** update `ndarray` TypeScript declarations [(#10560)](https://github.com/stdlib-js/stdlib/pull/10560) _(by stdlib-bot)_
779786
- [`2cc758b`](https://github.com/stdlib-js/stdlib/commit/2cc758b7e8b6e3a713cadbabd6d13ad635cb2fcd) - **docs:** update namespace table of contents [(#10561)](https://github.com/stdlib-js/stdlib/pull/10561) _(by stdlib-bot)_
780787
- [`f7bad8d`](https://github.com/stdlib-js/stdlib/commit/f7bad8d512bc207e4e25ed18a15b43a6e98540aa) - **test:** update test _(by Athan Reines)_

base/docs/types/index.d.ts

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import any = require( './../../../base/any' );
2424
import anyBy = require( './../../../base/any-by' );
2525
import assert = require( './../../../base/assert' );
2626
import assign = require( './../../../base/assign' );
27+
import atleastnd = require( './../../../base/atleastnd' );
2728
import binary = require( './../../../base/binary' );
2829
import binaryInputCastingDataType = require( './../../../base/binary-input-casting-dtype' );
2930
import binaryLoopOrder = require( './../../../base/binary-loop-interchange-order' );
@@ -163,6 +164,7 @@ import toFlippedud = require( './../../../base/to-flippedud' );
163164
import toNormalizedIndices = require( './../../../base/to-normalized-indices' );
164165
import toReversed = require( './../../../base/to-reversed' );
165166
import toReversedDimension = require( './../../../base/to-reversed-dimension' );
167+
import toTransposed = require( './../../../base/to-transposed' );
166168
import toUniqueNormalizedIndices = require( './../../../base/to-unique-normalized-indices' );
167169
import transpose = require( './../../../base/transpose' );
168170
import unary = require( './../../../base/unary' );
@@ -180,6 +182,7 @@ import unaryReduceSubarrayBy = require( './../../../base/unary-reduce-subarray-b
180182
import unaryStrided1dDispatch = require( './../../../base/unary-strided1d-dispatch' );
181183
import unaryStrided1dDispatchFactory = require( './../../../base/unary-strided1d-dispatch-factory' );
182184
import unaryBlockSize = require( './../../../base/unary-tiling-block-size' );
185+
import unflattenShape = require( './../../../base/unflatten-shape' );
183186
import vind2bind = require( './../../../base/vind2bind' );
184187
import wrapIndex = require( './../../../base/wrap-index' );
185188
import zeros = require( './../../../base/zeros' );
@@ -301,6 +304,27 @@ interface Namespace {
301304
*/
302305
assign: typeof assign;
303306

307+
/**
308+
* Converts a list of values (scalars and/or ndarrays) to ndarrays having at least a specified number of dimensions.
309+
*
310+
* @param ndims - minimum number of dimensions
311+
* @param arrays - array-like object containing a list of scalars and/or ndarrays
312+
* @returns an array of ndarrays
313+
*
314+
* @example
315+
* var array = require( './../../../array' );
316+
*
317+
* var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ] ] );
318+
* // returns <ndarray>[ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ] ]
319+
*
320+
* var y = array( [ [ 5.0, 6.0 ], [ 7.0, 8.0 ] ] );
321+
* // returns <ndarray>[ [ 5.0, 6.0 ], [ 7.0, 8.0 ] ]
322+
*
323+
* var out = ns.atleastnd( 3, [ x, y ] );
324+
* // returns [ <ndarray>, <ndarray> ]
325+
*/
326+
atleastnd: typeof atleastnd;
327+
304328
/**
305329
* Applies a binary callback to elements in input ndarrays and assigns results to elements in an output ndarray.
306330
*
@@ -3378,14 +3402,14 @@ interface Namespace {
33783402
quinaryBlockSize: typeof quinaryBlockSize;
33793403

33803404
/**
3381-
* Returns an array without singleton dimensions.
3405+
* Returns an ndarray without singleton dimensions.
33823406
*
33833407
* ## Notes
33843408
*
3385-
* - If a provided ndarray does not have any singleton dimensions, the function returns the provided ndarray unchanged.
3386-
* - If a provided ndarray does have singleton dimensions, the function returns a new ndarray view.
3409+
* - The function always returns a new ndarray instance even if the input ndarray does not contain any singleton dimensions.
33873410
*
33883411
* @param x - input array
3412+
* @param writable - boolean indicating whether a returned array should be writable
33893413
* @returns squeezed array
33903414
*
33913415
* @example
@@ -3394,28 +3418,10 @@ interface Namespace {
33943418
* var x = array( [ [ 1, 2 ], [ 3, 4 ] ], {
33953419
* 'ndmin': 5
33963420
* });
3397-
* // returns <ndarray>
3398-
*
3399-
* var shx = x.shape;
3400-
* // returns [ 1, 1, 1, 2, 2 ]
3401-
*
3402-
* var y = ns.removeSingletonDimensions( x );
3403-
* // returns <ndarray>
3404-
*
3405-
* var shy = y.shape;
3406-
* // returns [ 2, 2 ]
3407-
*
3408-
* var v = y.get( 0, 0 );
3409-
* // returns 1
3410-
*
3411-
* v = y.get( 0, 1 );
3412-
* // returns 2
3413-
*
3414-
* v = y.get( 1, 0 );
3415-
* // returns 3
3421+
* // returns <ndarray>[ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ]
34163422
*
3417-
* v = y.get( 1, 1 );
3418-
* // returns 4
3423+
* var y = ns.removeSingletonDimensions( x, false );
3424+
* // returns <ndarray>[ [ 1, 2 ], [ 3, 4 ] ]
34193425
*/
34203426
removeSingletonDimensions: typeof removeSingletonDimensions;
34213427

@@ -4598,6 +4604,23 @@ interface Namespace {
45984604
*/
45994605
toReversedDimension: typeof toReversedDimension;
46004606

4607+
/**
4608+
* Returns a new ndarray containing the elements of an input ndarray but whose last two dimensions are transposed.
4609+
*
4610+
* @param x - input array
4611+
* @returns output ndarray
4612+
*
4613+
* @example
4614+
* var array = require( './../../../array' );
4615+
*
4616+
* var x = array( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] );
4617+
* // returns <ndarray>[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
4618+
*
4619+
* var out = ns.toTransposed( x );
4620+
* // returns <ndarray>[ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
4621+
*/
4622+
toTransposed: typeof toTransposed;
4623+
46014624
/**
46024625
* Returns a list of unique indices after normalizing to the interval `[0,max]`.
46034626
*
@@ -5198,6 +5221,29 @@ interface Namespace {
51985221
*/
51995222
unaryBlockSize: typeof unaryBlockSize;
52005223

5224+
/**
5225+
* Expands a dimension over multiple dimensions.
5226+
*
5227+
* @param shape - array shape
5228+
* @param dim - dimension to be unflattened
5229+
* @param sizes - new shape of the unflattened dimension
5230+
* @returns unflattened shape
5231+
*
5232+
* @example
5233+
* var sh = ns.unflattenShape( [ 6, 2, 1 ], 0, [ 3, 2 ] );
5234+
* // returns [ 3, 2, 2, 1 ]
5235+
*
5236+
* @example
5237+
* var o = [ 0, 0, 0, 0 ];
5238+
*
5239+
* var out = ns.unflattenShape.assign( [ 6, 2, 1 ], 0, [ 3, 2 ], o );
5240+
* // returns [ 3, 2, 2, 1 ]
5241+
*
5242+
* var bool = ( out === o );
5243+
* // returns true
5244+
*/
5245+
unflattenShape: typeof unflattenShape;
5246+
52015247
/**
52025248
* Converts a linear index in an array view to a linear index in an underlying data buffer.
52035249
*

0 commit comments

Comments
 (0)