File tree Expand file tree Collapse file tree 2 files changed +14
-22
lines changed
lib/node_modules/@stdlib/math/base/special/cinv Expand file tree Collapse file tree 2 files changed +14
-22
lines changed Original file line number Diff line number Diff line change @@ -77,20 +77,16 @@ var im = imag( v );
77
77
<!-- eslint no-undef: "error" -->
78
78
79
79
``` 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' );
82
83
var cinv = require ( ' @stdlib/math/base/special/cinv' );
83
84
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 ) );
91
87
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 );
94
90
```
95
91
96
92
</section >
Original file line number Diff line number Diff line change 18
18
19
19
'use strict' ;
20
20
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' ) ;
23
24
var cinv = require ( './../lib' ) ;
24
25
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 ) ) ;
28
28
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 ) ;
You can’t perform that action at this time.
0 commit comments