Skip to content

Commit dd68407

Browse files
committed
docs: refactor readme
--- 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 fdc9e73 commit dd68407

File tree

1 file changed

+17
-10
lines changed
  • lib/node_modules/@stdlib/array/base/linspace2d

1 file changed

+17
-10
lines changed

lib/node_modules/@stdlib/array/base/linspace2d/README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ x = linspace2d( 0, 100, [ 2, 3 ], true );
4242
// returns [ [ 0, 40, 80 ], [ 20, 60, 100 ] ]
4343
```
4444

45+
The function accepts the following arguments:
46+
47+
- **start**: First array value.
48+
- **stop**: Last array value.
49+
- **shape**: Array shape.
50+
- **colexicographic**: Specifies whether generated array values should be stored in colexicographic order.
51+
4552
</section>
4653

4754
<!-- /.usage -->
@@ -63,19 +70,19 @@ x = linspace2d( 0, 100, [ 2, 3 ], true );
6370

6471
```javascript
6572
var roundn = require( '@stdlib/math/base/special/roundn' );
73+
var map2d = require( '@stdlib/array/base/map2d' );
6674
6775
// Create an array subject to floating-point rounding errors:
68-
var arr = linspace( 0, 10, [ 3, 3 ], false );
69-
70-
// Round each value to the nearest hundredth:
71-
var i;
72-
var j;
73-
for ( i = 0; i < arr.length; i++ ) {
74-
for ( j = 0; j < arr[i].length; j++ ) {
75-
arr[ i ][ j ] = roundn( arr[ i ][ j ], -2 );
76-
}
76+
var arr = linspace2d( 0, 11, [ 3, 3 ], false );
77+
// returns [ [ 0, 1.375, 2.75 ], [ 4.125, 5.5, 6.875 ], [ 8.25, 9.625, 11 ] ]
78+
79+
// Round each value to the nearest tenth:
80+
var out = map2d( arr, [ 3, 3 ], clbk );
81+
// returns [ [ 0, 1.4, 2.8 ], [ 4.1, 5.5, 6.9 ], [ 8.3, 9.6, 11 ] ]
82+
83+
function clbk( v ) {
84+
return roundn( v, -1 );
7785
}
78-
console.log( arr.join( '\n' ) );
7986
```
8087

8188
</section>

0 commit comments

Comments
 (0)