Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jan 13, 2025
1 parent edf79b1 commit e8c3075
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<section class="release" id="unreleased">

## Unreleased (2025-01-11)
## Unreleased (2025-01-13)

<section class="features">

Expand All @@ -22,6 +22,7 @@

<details>

- [`705dd30`](https://github.com/stdlib-js/stdlib/commit/705dd302fe6448af5addcacf9215574da5473f31) - **docs:** update examples _(by Athan Reines)_
- [`3767255`](https://github.com/stdlib-js/stdlib/commit/3767255c7cfe85f09cea5c007e21297cd628245d) - **feat:** add `ndarray/base/spread-dimensions` _(by Athan Reines)_

</details>
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ var spreadDimensions = require( '@stdlib/ndarray-base-spread-dimensions' );
Expands the shape of an array to a specified dimensionality by spreading its dimensions to specified dimension indices and inserting dimensions of size one for the remaining dimensions.

```javascript
var ndarray2array = require( '@stdlib/ndarray-to-array' );
var array = require( '@stdlib/ndarray-array' );

// Create a 2x2 ndarray:
Expand All @@ -91,19 +92,28 @@ var y = spreadDimensions( 3, x, [ 1, 2 ] );
var sh = y.shape;
// returns [ 1, 2, 2 ]

var a = ndarray2array( y );
// returns [ [ [ 1, 2 ], [ 3, 4 ] ] ]

// Append a singleton dimension:
y = spreadDimensions( 3, x, [ 0, 1 ] );
// returns <ndarray>

sh = y.shape;
// returns [ 2, 2, 1 ]

a = ndarray2array( y );
// returns [ [ [ 1 ], [ 2 ] ], [ [ 3 ], [ 4 ] ] ]

// Insert a singleton dimension:
y = spreadDimensions( 3, x, [ 0, 2 ] );
// returns <ndarray>

sh = y.shape;
// returns [ 2, 1, 2 ]

a = ndarray2array( y );
// returns [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
```

</section>
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8c3075

Please sign in to comment.