Skip to content

Commit 24d2a7d

Browse files
docs: improve doctests for complex number instances in strided/base/cmap
--- 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: passed - task: lint_javascript_src status: passed - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent e57055b commit 24d2a7d

File tree

5 files changed

+14
-98
lines changed

5 files changed

+14
-98
lines changed

lib/node_modules/@stdlib/strided/base/cmap/README.md

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ Applies a unary function to a single-precision complex floating-point strided in
4242

4343
```javascript
4444
var Complex64Array = require( '@stdlib/array/complex64' );
45-
var real = require( '@stdlib/complex/float64/real' );
46-
var imag = require( '@stdlib/complex/float64/imag' );
4745
var cceilf = require( '@stdlib/math/base/special/cceilf' );
4846

4947
var x = new Complex64Array( [ -2.3, 1.5, 3.1, -5.2, 4.8, 0.0, -1.6, 3.4 ] );
@@ -52,13 +50,7 @@ var y = new Complex64Array( x.length );
5250
cmap( x.length, x, 1, y, 1, cceilf );
5351

5452
var v = y.get( 0 );
55-
// returns <Complex64>
56-
57-
var re = real( v );
58-
// returns -2.0
59-
60-
var im = imag( v );
61-
// returns 2.0
53+
// returns <Complex64>[ -2.0, 2.0 ]
6254
```
6355

6456
The function accepts the following arguments:
@@ -74,8 +66,6 @@ The `N` and stride parameters determine which elements in the strided arrays are
7466

7567
```javascript
7668
var Complex64Array = require( '@stdlib/array/complex64' );
77-
var real = require( '@stdlib/complex/float64/real' );
78-
var imag = require( '@stdlib/complex/float64/imag' );
7969
var cceilf = require( '@stdlib/math/base/special/cceilf' );
8070

8171
var x = new Complex64Array( [ -2.3, 1.5, 3.1, -5.2, 4.8, 0.0, -1.6, 3.4 ] );
@@ -84,21 +74,13 @@ var y = new Complex64Array( x.length );
8474
cmap( 2, x, 2, y, -1, cceilf );
8575

8676
var v = y.get( 0 );
87-
// returns <Complex64>
88-
89-
var re = real( v );
90-
// returns 5.0
91-
92-
var im = imag( v );
93-
// returns 0.0
77+
// returns <Complex64>[ 5.0, 0.0 ]
9478
```
9579

9680
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][@stdlib/array/complex64] views.
9781

9882
```javascript
9983
var Complex64Array = require( '@stdlib/array/complex64' );
100-
var real = require( '@stdlib/complex/float64/real' );
101-
var imag = require( '@stdlib/complex/float64/imag' );
10284
var cceilf = require( '@stdlib/math/base/special/cceilf' );
10385

10486
// Initial arrays...
@@ -112,13 +94,7 @@ var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3r
11294
cmap( 2, x1, -2, y1, 1, cceilf );
11395

11496
var v = y0.get( 2 );
115-
// returns <Complex64>
116-
117-
var re = real( v );
118-
// returns -1.0
119-
120-
var im = imag( v );
121-
// returns 4.0
97+
// returns <Complex64>[ -1.0, 4.0 ]
12298
```
12399

124100
#### cmap.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, fcn )
@@ -127,8 +103,6 @@ Applies a unary function to a single-precision complex floating-point strided in
127103

128104
```javascript
129105
var Complex64Array = require( '@stdlib/array/complex64' );
130-
var real = require( '@stdlib/complex/float64/real' );
131-
var imag = require( '@stdlib/complex/float64/imag' );
132106
var cceilf = require( '@stdlib/math/base/special/cceilf' );
133107

134108
var x = new Complex64Array( [ -2.3, 1.5, 3.1, -5.2, 4.8, 0.0, -1.6, 3.4 ] );
@@ -137,13 +111,7 @@ var y = new Complex64Array( x.length );
137111
cmap.ndarray( x.length, x, 1, 0, y, 1, 0, cceilf );
138112

139113
var v = y.get( 0 );
140-
// returns <Complex64>
141-
142-
var re = real( v );
143-
// returns -2.0
144-
145-
var im = imag( v );
146-
// returns 2.0
114+
// returns <Complex64>[ -2.0, 2.0 ]
147115
```
148116

149117
The function accepts the following additional arguments:
@@ -155,8 +123,6 @@ While [`typed array`][@stdlib/array/complex64] views mandate a view offset based
155123

156124
```javascript
157125
var Complex64Array = require( '@stdlib/array/complex64' );
158-
var real = require( '@stdlib/complex/float64/real' );
159-
var imag = require( '@stdlib/complex/float64/imag' );
160126
var cceilf = require( '@stdlib/math/base/special/cceilf' );
161127

162128
var x = new Complex64Array( [ -2.3, 1.5, 3.1, -5.2, 4.8, 0.0, -1.6, 3.4 ] );
@@ -165,13 +131,7 @@ var y = new Complex64Array( x.length );
165131
cmap.ndarray( 2, x, 2, 1, y, -1, y.length-1, cceilf );
166132

167133
var v = y.get( y.length-1 );
168-
// returns <Complex64>
169-
170-
var re = real( v );
171-
// returns 4.0
172-
173-
var im = imag( v );
174-
// returns -5.0
134+
// returns <Complex64>[ 4.0, -5.0 ]
175135
```
176136

177137
</section>

lib/node_modules/@stdlib/strided/base/cmap/docs/repl.txt

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,13 @@
4343
> var y = new {{alias:@stdlib/array/complex64}}( x.length );
4444
> {{alias}}( x.length, x, 1, y, 1, {{alias:@stdlib/complex/float32/base/identity}} );
4545
> var v = y.get( 0 )
46-
<Complex64>
47-
> var re = {{alias:@stdlib/complex/float64/real}}( v )
48-
1.0
49-
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
50-
2.0
46+
<Complex64>[ 1.0, 2.0 ]
5147

5248
// Using `N` and stride parameters:
5349
> y = new {{alias:@stdlib/array/complex64}}( x.length );
5450
> {{alias}}( 2, x, 2, y, -1, {{alias:@stdlib/complex/float32/base/identity}} );
5551
> v = y.get( 0 )
56-
<Complex64>
57-
> re = {{alias:@stdlib/complex/float64/real}}( v )
58-
5.0
59-
> im = {{alias:@stdlib/complex/float64/imag}}( v )
60-
6.0
52+
<Complex64>[ 5.0, 6.0 ]
6153

6254
// Using view offsets:
6355
> var x0 = new {{alias:@stdlib/array/complex64}}( xbuf );
@@ -66,11 +58,7 @@
6658
> var y1 = new {{alias:@stdlib/array/complex64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
6759
> {{alias}}( 2, x1, -2, y1, 1, {{alias:@stdlib/complex/float32/base/identity}} );
6860
> v = y1.get( 0 )
69-
<Complex64>
70-
> re = {{alias:@stdlib/complex/float64/real}}( v )
71-
7.0
72-
> im = {{alias:@stdlib/complex/float64/imag}}( v )
73-
8.0
61+
<Complex64>[ 7.0, 8.0 ]
7462

7563

7664
{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, fcn )
@@ -121,22 +109,14 @@
121109
> var y = new {{alias:@stdlib/array/complex64}}( x.length );
122110
> {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0, {{alias:@stdlib/complex/float32/base/identity}} );
123111
> var v = y.get( 0 )
124-
<Complex64>
125-
> var re = {{alias:@stdlib/complex/float64/real}}( v )
126-
1.0
127-
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
128-
2.0
112+
<Complex64>[ 1.0, 2.0 ]
129113

130114
// Advanced indexing:
131115
> x = new {{alias:@stdlib/array/complex64}}( xbuf );
132116
> y = new {{alias:@stdlib/array/complex64}}( x.length );
133117
> {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1, {{alias:@stdlib/complex/float32/base/identity}} );
134118
> v = y.get( y.length-1 )
135-
<Complex64>
136-
> re = {{alias:@stdlib/complex/float64/real}}( v )
137-
3.0
138-
> im = {{alias:@stdlib/complex/float64/imag}}( v )
139-
4.0
119+
<Complex64>[ 3.0, 4.0 ]
140120

141121
See Also
142122
--------

lib/node_modules/@stdlib/strided/base/cmap/lib/index.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,7 @@
4242
* cmap( x.length, x, 1, y, 1, scale );
4343
*
4444
* var v = y.get( 0 );
45-
* // returns <Complex64>
46-
*
47-
* var re = real( v );
48-
* // returns 10.0
49-
*
50-
* var im = imag( v );
51-
* // returns 10.0
45+
* // returns <Complex64>[ 10.0, 10.0 ]
5246
*
5347
* @example
5448
* var Complex64Array = require( '@stdlib/array/complex64' );
@@ -69,13 +63,7 @@
6963
* cmap.ndarray( x.length, x, 1, 0, y, 1, 0, scale );
7064
*
7165
* var v = y.get( 0 );
72-
* // returns <Complex64>
73-
*
74-
* var re = real( v );
75-
* // returns 10.0
76-
*
77-
* var im = imag( v );
78-
* // returns 10.0
66+
* // returns <Complex64>[ 10.0, 10.0 ]
7967
*/
8068

8169
// MODULES //

lib/node_modules/@stdlib/strided/base/cmap/lib/main.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ var ndarray = require( './ndarray.js' );
5555
* cmap( x.length, x, 1, y, 1, scale );
5656
*
5757
* var v = y.get( 0 );
58-
* // returns <Complex64>
59-
*
60-
* var re = real( v );
61-
* // returns 10.0
62-
*
63-
* var im = imag( v );
64-
* // returns 10.0
58+
* // returns <Complex64>[ 10.0, 10.0 ]
6559
*/
6660
function cmap( N, x, strideX, y, strideY, fcn ) {
6761
return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ), fcn ); // eslint-disable-line max-len

lib/node_modules/@stdlib/strided/base/cmap/lib/ndarray.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,7 @@
5151
* cmap( x.length, x, 1, 0, y, 1, 0, scale );
5252
*
5353
* var v = y.get( 0 );
54-
* // returns <Complex64>
55-
*
56-
* var re = real( v );
57-
* // returns 10.0
58-
*
59-
* var im = imag( v );
60-
* // returns 10.0
54+
* // returns <Complex64>[ 10.0, 10.0 ]
6155
*/
6256
function cmap( N, x, strideX, offsetX, y, strideY, offsetY, fcn ) {
6357
var ix;

0 commit comments

Comments
 (0)