You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- To migrate, users should explicitly provide a third argument indicating whether to return a read-only ndarray. To preserve prior behavior, users should provide a boolean based on whether an input ndarray is read-only.
635
+
631
636
-[`327cda9`](https://github.com/stdlib-js/stdlib/commit/327cda9b2dda086b20da9ce256df388573486946): move `dim` argument to option
632
637
633
638
- To migrate, users wanting to specify a dimension along which to concatenate input arrays should provide an object containing a `dim` property.
@@ -689,6 +694,7 @@ A total of 40 issues were closed in this release:
689
694
690
695
<details>
691
696
697
+
-[`f475c84`](https://github.com/stdlib-js/stdlib/commit/f475c843a4b1579eef6533e464e4c16766d7ecdd) - **feat:** add writable parameter to `ndarray/base/expand-dimensions`[(#9476)](https://github.com/stdlib-js/stdlib/pull/9476)_(by Muhammad Haris, Athan Reines)_
-**axis**: axis at which to insert a singleton dimension
81
+
-**writable**: boolean indicating whether a returned ndarray should be writable.
82
+
77
83
</section>
78
84
79
85
<!-- /.usage -->
@@ -85,6 +91,7 @@ sh = getShape( y );
85
91
## Notes
86
92
87
93
- A provided axis must reside on the interval `[-N-1, N]`, where `N` is the rank (i.e., number of dimensions) of the provided input array. If provided a negative `axis`, the axis position at which to insert a singleton dimension is computed as `N + axis + 1`. Hence, if provided `-1`, the resolved axis position is `N` (i.e., a singleton dimension is appended to the input array).
94
+
- The `writable` parameter **only** applies to ndarray constructors supporting **read-only** instances.
88
95
89
96
</section>
90
97
@@ -99,32 +106,15 @@ sh = getShape( y );
99
106
<!-- eslint no-undef: "error" -->
100
107
101
108
```javascript
102
-
var array =require( '@stdlib/ndarray/array' );
103
-
var numel =require( '@stdlib/ndarray/base/numel' );
104
-
var ind2sub =require( '@stdlib/ndarray/ind2sub' );
105
-
var getShape =require( '@stdlib/ndarray/shape' );
109
+
var uniform =require( '@stdlib/random/uniform' );
110
+
var ndarray2array =require( '@stdlib/ndarray/to-array' );
106
111
var expandDimensions =require( '@stdlib/ndarray/base/expand-dimensions' );
107
112
108
-
// Create a 2-dimensional array:
109
-
var x =array( [ [ 1, 2 ], [ 3, 4 ] ] );
110
-
// returns <ndarray>
111
-
112
-
// Insert a singleton dimension:
113
-
var y =expandDimensions( x, 1 );
114
-
// returns <ndarray>
115
-
116
-
// Retrieve the shape:
117
-
var sh =getShape( y );
118
-
// returns [ 2, 1, 2 ]
119
-
120
-
// Retrieve the number of elements:
121
-
varN=numel( sh );
113
+
var x =uniform( [ 3, 3, 3 ], -10.0, 10.0 );
114
+
console.log( ndarray2array( x ) );
122
115
123
-
// Loop through the array elements...
124
-
var i;
125
-
for ( i =0; i <N; i++ ) {
126
-
console.log( 'Y[%s] = %d', ind2sub( sh, i ).join( ', ' ), y.iget( i ) );
0 commit comments