Skip to content

Commit 705dd30

Browse files
committed
docs: update examples
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent fd622e8 commit 705dd30

File tree

1 file changed

+10
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/base/spread-dimensions

1 file changed

+10
-0
lines changed

lib/node_modules/@stdlib/ndarray/base/spread-dimensions/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var spreadDimensions = require( '@stdlib/ndarray/base/spread-dimensions' );
4545
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.
4646

4747
```javascript
48+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
4849
var array = require( '@stdlib/ndarray/array' );
4950

5051
// Create a 2x2 ndarray:
@@ -58,19 +59,28 @@ var y = spreadDimensions( 3, x, [ 1, 2 ] );
5859
var sh = y.shape;
5960
// returns [ 1, 2, 2 ]
6061

62+
var a = ndarray2array( y );
63+
// returns [ [ [ 1, 2 ], [ 3, 4 ] ] ]
64+
6165
// Append a singleton dimension:
6266
y = spreadDimensions( 3, x, [ 0, 1 ] );
6367
// returns <ndarray>
6468

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

72+
a = ndarray2array( y );
73+
// returns [ [ [ 1 ], [ 2 ] ], [ [ 3 ], [ 4 ] ] ]
74+
6875
// Insert a singleton dimension:
6976
y = spreadDimensions( 3, x, [ 0, 2 ] );
7077
// returns <ndarray>
7178

7279
sh = y.shape;
7380
// returns [ 2, 1, 2 ]
81+
82+
a = ndarray2array( y );
83+
// returns [ [ [ 1, 2 ] ], [ [ 3, 4 ] ] ]
7484
```
7585

7686
</section>

0 commit comments

Comments
 (0)