Skip to content

Commit ba76851

Browse files
committed
docs: replace manual for loop in 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: passed - 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 ed88389 commit ba76851

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

lib/node_modules/@stdlib/math/base/special/cinv/README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,16 @@ var im = imag( v );
7777
<!-- eslint no-undef: "error" -->
7878

7979
```javascript
80-
var Complex128 = require( '@stdlib/complex/float64/ctor' );
81-
var uniform = require( '@stdlib/random/base/uniform' );
80+
var Complex128Array = require( '@stdlib/array/complex64' );
81+
var uniform = require( '@stdlib/random/array/uniform' );
82+
var logEachMap = require( '@stdlib/console/log-each-map' );
8283
var cinv = require( '@stdlib/math/base/special/cinv' );
8384

84-
var z1;
85-
var z2;
86-
var i;
87-
88-
for ( i = 0; i < 100; i++ ) {
89-
z1 = new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) );
90-
z2 = cinv( z1 );
85+
// Create an array of random numbers:
86+
var arr = new Complex128Array( uniform( 200, -100.0, 100.0 ) );
9187

92-
console.log( '1.0 / (%s) = %s', z1.toString(), z2.toString() );
93-
}
88+
// Compute the inverse of each number in the array:
89+
logEachMap( '1.0 / (%s) = %s', arr, cinv );
9490
```
9591

9692
</section>

lib/node_modules/@stdlib/math/base/special/cinv/examples/index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@
1818

1919
'use strict';
2020

21-
var Complex128 = require( '@stdlib/complex/float64/ctor' );
22-
var uniform = require( '@stdlib/random/base/uniform' );
21+
var Complex128Array = require( '@stdlib/array/complex64' );
22+
var uniform = require( '@stdlib/random/array/uniform' );
23+
var logEachMap = require( '@stdlib/console/log-each-map' );
2324
var cinv = require( './../lib' );
2425

25-
var z1;
26-
var z2;
27-
var i;
26+
// Create an array of random numbers:
27+
var arr = new Complex128Array( uniform( 200, -100.0, 100.0 ) );
2828

29-
for ( i = 0; i < 100; i++ ) {
30-
z1 = new Complex128( uniform( -50.0, 50.0 ), uniform( -50.0, 50.0 ) );
31-
z2 = cinv( z1 );
32-
33-
console.log( '1.0 / (%s) = %s', z1.toString(), z2.toString() );
34-
}
29+
// Compute the inverse of each number in the array:
30+
logEachMap( '1.0 / (%s) = %s', arr, cinv );

0 commit comments

Comments
 (0)