-
-
Notifications
You must be signed in to change notification settings - Fork 836
docs: change examples for complex/float64/base/add
#7177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,22 +123,17 @@ The function supports the following parameters: | |
<!-- eslint no-undef: "error" --> | ||
|
||
```javascript | ||
var Complex128 = require( '@stdlib/complex/float64/ctor' ); | ||
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; | ||
var Complex128Array = require( '@stdlib/array/complex128' ); | ||
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); | ||
var logEachMap = require( '@stdlib/console/log-each-map' ); | ||
var add = require( '@stdlib/complex/float64/base/add' ); | ||
|
||
var rand = discreteUniform( -50, 50 ); | ||
|
||
var z1; | ||
var z2; | ||
var z3; | ||
var i; | ||
for ( i = 0; i < 100; i++ ) { | ||
z1 = new Complex128( rand(), rand() ); | ||
z2 = new Complex128( rand(), rand() ); | ||
z3 = add( z1, z2 ); | ||
console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); | ||
} | ||
// Generate arrays of random values: | ||
var z1 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); | ||
var z2 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); | ||
|
||
// Perform multiplication on each element of arrays: | ||
logEachMap( '(%s) * (%s) = %s', z1, z2, add ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is incorrect. |
||
``` | ||
|
||
</section> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,19 +18,14 @@ | |
|
||
'use strict'; | ||
|
||
var Complex128 = require( '@stdlib/complex/float64/ctor' ); | ||
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; | ||
var Complex128Array = require( '@stdlib/array/complex128' ); | ||
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); | ||
var logEachMap = require( '@stdlib/console/log-each-map' ); | ||
var add = require( './../lib' ); | ||
|
||
var rand = discreteUniform( -50, 50 ); | ||
// Generate an array of random values: | ||
var z1 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); | ||
var z2 = new Complex128Array( discreteUniform( 200, -50, 50 ) ); | ||
|
||
var z1; | ||
var z2; | ||
var z3; | ||
var i; | ||
for ( i = 0; i < 100; i++ ) { | ||
z1 = new Complex128( rand(), rand() ); | ||
z2 = new Complex128( rand(), rand() ); | ||
z3 = add( z1, z2 ); | ||
console.log( '(%s) + (%s) = %s', z1.toString(), z2.toString(), z3.toString() ); | ||
} | ||
// Scale each by a scalar constant: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Planeshifter Same comment. |
||
logEachMap( '(%s) * (%s) = %s', z1, z2, add ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is incorrect. The operation is addition not multiplication. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Planeshifter Please perform more careful reviews. This comment is clearly incorrect.