From c1cc6bf58aae2bdf74cc28994431a878f049b182 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Wed, 6 May 2026 13:13:04 -0700 Subject: [PATCH] docs: improve doctests for complex number typed arrays in `constants` --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../constants/complex128/nan/README.md | 23 ++------------- .../complex128/nan/examples/index.js | 29 +++---------------- .../constants/complex128/zero/README.md | 23 ++------------- .../complex128/zero/examples/index.js | 29 +++---------------- .../@stdlib/constants/complex64/nan/README.md | 23 ++------------- .../constants/complex64/nan/examples/index.js | 29 +++---------------- .../constants/complex64/zero/README.md | 23 ++------------- .../complex64/zero/examples/index.js | 29 +++---------------- 8 files changed, 24 insertions(+), 184 deletions(-) diff --git a/lib/node_modules/@stdlib/constants/complex128/nan/README.md b/lib/node_modules/@stdlib/constants/complex128/nan/README.md index 2dce6056eec5..da919ce26ac0 100644 --- a/lib/node_modules/@stdlib/constants/complex128/nan/README.md +++ b/lib/node_modules/@stdlib/constants/complex128/nan/README.md @@ -56,33 +56,14 @@ var im = imag( COMPLEX128_NAN ); ```javascript -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); var Complex128Array = require( '@stdlib/array/complex128' ); var COMPLEX128_NAN = require( '@stdlib/constants/complex128/nan' ); var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = real( v ); -// returns 1.0 - -var im = imag( v ); -// returns 2.0 +// returns [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX128_NAN ); - -v = x.get( 0 ); -// returns - -re = real( v ); -// returns NaN - -im = imag( v ); -// returns NaN +// x => [ NaN, NaN, NaN, NaN ] ``` diff --git a/lib/node_modules/@stdlib/constants/complex128/nan/examples/index.js b/lib/node_modules/@stdlib/constants/complex128/nan/examples/index.js index 14acbc8d3888..1f5401bd595f 100644 --- a/lib/node_modules/@stdlib/constants/complex128/nan/examples/index.js +++ b/lib/node_modules/@stdlib/constants/complex128/nan/examples/index.js @@ -18,34 +18,13 @@ 'use strict'; -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); var Complex128Array = require( '@stdlib/array/complex128' ); var COMPLEX128_NAN = require( './../lib' ); var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = real( v ); -console.log( re ); -// => 1.0 - -var im = imag( v ); -console.log( im ); -// => 2.0 +console.log( x ); +// => [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX128_NAN ); - -v = x.get( 0 ); -// returns - -re = real( v ); -console.log( re ); -// => NaN - -im = imag( v ); -console.log( im ); -// => NaN +console.log( x ); +// => [ NaN, NaN, NaN, NaN ] diff --git a/lib/node_modules/@stdlib/constants/complex128/zero/README.md b/lib/node_modules/@stdlib/constants/complex128/zero/README.md index 3f0f07d985f1..31882de4d980 100644 --- a/lib/node_modules/@stdlib/constants/complex128/zero/README.md +++ b/lib/node_modules/@stdlib/constants/complex128/zero/README.md @@ -56,33 +56,14 @@ var im = imag( COMPLEX128_ZERO ); ```javascript -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); var Complex128Array = require( '@stdlib/array/complex128' ); var COMPLEX128_ZERO = require( '@stdlib/constants/complex128/zero' ); var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = real( v ); -// returns 1.0 - -var im = imag( v ); -// returns 2.0 +// returns [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX128_ZERO ); - -v = x.get( 0 ); -// returns - -re = real( v ); -// returns 0.0 - -im = imag( v ); -// returns 0.0 +// x => [ 0.0, 0.0, 0.0, 0.0 ] ``` diff --git a/lib/node_modules/@stdlib/constants/complex128/zero/examples/index.js b/lib/node_modules/@stdlib/constants/complex128/zero/examples/index.js index 10e4b295a464..16cebfae0ed2 100644 --- a/lib/node_modules/@stdlib/constants/complex128/zero/examples/index.js +++ b/lib/node_modules/@stdlib/constants/complex128/zero/examples/index.js @@ -18,34 +18,13 @@ 'use strict'; -var real = require( '@stdlib/complex/float64/real' ); -var imag = require( '@stdlib/complex/float64/imag' ); var Complex128Array = require( '@stdlib/array/complex128' ); var COMPLEX128_ZERO = require( './../lib' ); var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = real( v ); -console.log( re ); -// => 1.0 - -var im = imag( v ); -console.log( im ); -// => 2.0 +console.log( x ); +// => [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX128_ZERO ); - -v = x.get( 0 ); -// returns - -re = real( v ); -console.log( re ); -// => 0.0 - -im = imag( v ); -console.log( im ); -// => 0.0 +console.log( x ); +// => [ 0.0, 0.0, 0.0, 0.0 ] diff --git a/lib/node_modules/@stdlib/constants/complex64/nan/README.md b/lib/node_modules/@stdlib/constants/complex64/nan/README.md index 7cb38e21fdff..ba823088d416 100644 --- a/lib/node_modules/@stdlib/constants/complex64/nan/README.md +++ b/lib/node_modules/@stdlib/constants/complex64/nan/README.md @@ -56,33 +56,14 @@ var im = imagf( COMPLEX64_NAN ); ```javascript -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var Complex64Array = require( '@stdlib/array/complex64' ); var COMPLEX64_NAN = require( '@stdlib/constants/complex64/nan' ); var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = realf( v ); -// returns 1.0 - -var im = imagf( v ); -// returns 2.0 +// returns [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX64_NAN ); - -v = x.get( 0 ); -// returns - -re = realf( v ); -// returns NaN - -im = imagf( v ); -// returns NaN +// x => [ NaN, NaN, NaN, NaN ] ``` diff --git a/lib/node_modules/@stdlib/constants/complex64/nan/examples/index.js b/lib/node_modules/@stdlib/constants/complex64/nan/examples/index.js index 5f18ee17f960..5c893745f6c7 100644 --- a/lib/node_modules/@stdlib/constants/complex64/nan/examples/index.js +++ b/lib/node_modules/@stdlib/constants/complex64/nan/examples/index.js @@ -18,34 +18,13 @@ 'use strict'; -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var Complex64Array = require( '@stdlib/array/complex64' ); var COMPLEX64_NAN = require( './../lib' ); var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = realf( v ); -console.log( re ); -// => 1.0 - -var im = imagf( v ); -console.log( im ); -// => 2.0 +console.log( x ); +// => [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX64_NAN ); - -v = x.get( 0 ); -// returns - -re = realf( v ); -console.log( re ); -// => NaN - -im = imagf( v ); -console.log( im ); -// => NaN +console.log( x ); +// => [ NaN, NaN, NaN, NaN ] diff --git a/lib/node_modules/@stdlib/constants/complex64/zero/README.md b/lib/node_modules/@stdlib/constants/complex64/zero/README.md index 8618b5fa2bdc..862c2e736b2c 100644 --- a/lib/node_modules/@stdlib/constants/complex64/zero/README.md +++ b/lib/node_modules/@stdlib/constants/complex64/zero/README.md @@ -56,33 +56,14 @@ var im = imagf( COMPLEX64_ZERO ); ```javascript -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var Complex64Array = require( '@stdlib/array/complex64' ); var COMPLEX64_ZERO = require( '@stdlib/constants/complex64/zero' ); var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = realf( v ); -// returns 1.0 - -var im = imagf( v ); -// returns 2.0 +// returns [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX64_ZERO ); - -v = x.get( 0 ); -// returns - -re = realf( v ); -// returns 0.0 - -im = imagf( v ); -// returns 0.0 +// x => [ 0.0, 0.0, 0.0, 0.0 ] ``` diff --git a/lib/node_modules/@stdlib/constants/complex64/zero/examples/index.js b/lib/node_modules/@stdlib/constants/complex64/zero/examples/index.js index bc22548eaeff..20a42161ab74 100644 --- a/lib/node_modules/@stdlib/constants/complex64/zero/examples/index.js +++ b/lib/node_modules/@stdlib/constants/complex64/zero/examples/index.js @@ -18,34 +18,13 @@ 'use strict'; -var realf = require( '@stdlib/complex/float32/real' ); -var imagf = require( '@stdlib/complex/float32/imag' ); var Complex64Array = require( '@stdlib/array/complex64' ); var COMPLEX64_ZERO = require( './../lib' ); var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -// returns - -var v = x.get( 0 ); -// returns - -var re = realf( v ); -console.log( re ); -// => 1.0 - -var im = imagf( v ); -console.log( im ); -// => 2.0 +console.log( x ); +// => [ 1.0, 2.0, 3.0, 4.0 ] x.fill( COMPLEX64_ZERO ); - -v = x.get( 0 ); -// returns - -re = realf( v ); -console.log( re ); -// => 0.0 - -im = imagf( v ); -console.log( im ); -// => 0.0 +console.log( x ); +// => [ 0.0, 0.0, 0.0, 0.0 ]