Skip to content

Commit f49428b

Browse files
committed
docs: improve doctests for complex number typed arrays
--- 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: passed - task: lint_license_headers status: passed ---
1 parent e8c8651 commit f49428b

File tree

8 files changed

+48
-109
lines changed

8 files changed

+48
-109
lines changed

lib/node_modules/@stdlib/blas/ext/base/cfill/README.md

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,15 @@ var cfill = require( '@stdlib/blas/ext/base/cfill' );
3535
Fills a single-precision complex floating-point strided array `x` with a specified scalar constant `alpha`.
3636

3737
```javascript
38-
var Float32Array = require( '@stdlib/array/float32' );
3938
var Complex64Array = require( '@stdlib/array/complex64' );
4039
var Complex64 = require( '@stdlib/complex/float32/ctor' );
4140

42-
var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
43-
var x = new Complex64Array( arr );
41+
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
4442

4543
var alpha = new Complex64( 10.0, 10.0 );
4644

4745
cfill( x.length, alpha, x, 1 );
48-
49-
var y = x.get( 0 );
50-
// returns <Complex64>[ 10.0, 10.0 ]
46+
// x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
5147
```
5248

5349
The function has the following parameters:
@@ -60,36 +56,25 @@ The function has the following parameters:
6056
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to fill every other element:
6157

6258
```javascript
63-
var Float32Array = require( '@stdlib/array/float32' );
6459
var Complex64Array = require( '@stdlib/array/complex64' );
6560
var Complex64 = require( '@stdlib/complex/float32/ctor' );
6661

67-
var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
68-
var x = new Complex64Array( arr );
62+
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
6963

7064
var alpha = new Complex64( 10.0, 10.0 );
7165

7266
cfill( 2, alpha, x, 2 );
73-
74-
var y = x.get( 0 );
75-
// returns <Complex64>[ 10.0, 10.0 ]
76-
77-
y = x.get( 1 );
78-
// returns <Complex64>[ 3.0, 4.0 ]
67+
// x => <Complex64Array>[ 10.0, 10.0, 3.0, 4.0, 10.0, 10.0, 7.0, 8.0 ]
7968
```
8069

8170
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
8271

8372
```javascript
84-
var Float32Array = require( '@stdlib/array/float32' );
8573
var Complex64Array = require( '@stdlib/array/complex64' );
8674
var Complex64 = require( '@stdlib/complex/float32/ctor' );
8775

88-
// Create the underlying floating-point array:
89-
var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
90-
9176
// Initial array:
92-
var x0 = new Complex64Array( arr );
77+
var x0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
9378

9479
// Create an offset view:
9580
var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
@@ -99,32 +84,23 @@ var alpha = new Complex64( 10.0, 10.0 );
9984

10085
// Fill every other element:
10186
cfill( 2, alpha, x1, 2 );
102-
103-
var y = x0.get( 0 );
104-
// returns <Complex64>[ 1.0, 2.0 ]
105-
106-
y = x0.get( 1 );
107-
// returns <Complex64>[ 10.0, 10.0 ]
87+
// x0 => <Complex64Array>[ 1.0, 2.0, 10.0, 10.0, 5.0, 6.0, 10.0, 10.0 ]
10888
```
10989

11090
#### cfill.ndarray( N, alpha, x, strideX, offsetX )
11191

11292
Fills a single-precision complex floating-point strided array `x` with a specified scalar constant `alpha` using alternative indexing semantics.
11393

11494
```javascript
115-
var Float32Array = require( '@stdlib/array/float32' );
11695
var Complex64Array = require( '@stdlib/array/complex64' );
11796
var Complex64 = require( '@stdlib/complex/float32/ctor' );
11897

119-
var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
120-
var x = new Complex64Array( arr );
98+
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
12199

122100
var alpha = new Complex64( 10.0, 10.0 );
123101

124102
cfill.ndarray( x.length, alpha, x, 1, 0 );
125-
126-
var y = x.get( 0 );
127-
// returns <Complex64>[ 10.0, 10.0 ]
103+
// x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
128104
```
129105

130106
The function has the following additional parameters:
@@ -134,25 +110,15 @@ The function has the following additional parameters:
134110
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last two elements of the strided array:
135111

136112
```javascript
137-
var Float32Array = require( '@stdlib/array/float32' );
138113
var Complex64Array = require( '@stdlib/array/complex64' );
139114
var Complex64 = require( '@stdlib/complex/float32/ctor' );
140115

141-
var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
142-
var x = new Complex64Array( arr );
116+
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
143117

144118
var alpha = new Complex64( 10.0, 10.0 );
145119

146-
cfill.ndarray( 2, alpha, x, 1, x.length-2 );
147-
148-
var y = x.get( 0 );
149-
// returns <Complex64>[ 1.0, 2.0 ]
150-
151-
y = x.get( 1 );
152-
// returns <Complex64>[ 10.0, 10.0 ]
153-
154-
y = x.get( 2 );
155-
// returns <Complex64>[ 10.0, 10.0 ]
120+
cfill.ndarray( 2, alpha, x, 1, 1 );
121+
// x => <Complex64Array>[ 1.0, 2.0, 10.0, 10.0, 10.0, 10.0 ]
156122
```
157123

158124
</section>

lib/node_modules/@stdlib/blas/ext/base/cfill/docs/repl.txt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,23 @@
3636
> var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
3737
> var alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, -5.0 );
3838
> {{alias}}( x.length, alpha, x, 1 );
39-
> var z = x.get( 0 )
40-
<Complex64>[ 5.0, -5.0 ]
39+
> x
40+
<Complex64Array>[ 5.0, -5.0, 5.0, -5.0 ]
4141

4242
// Using `N` and stride parameters:
4343
> x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
4444
> alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, -5.0 );
4545
> {{alias}}( 2, alpha, x, 2 );
46-
> z = x.get( 0 )
47-
<Complex64>[ 5.0, -5.0 ]
48-
> z = x.get( 1 )
49-
<Complex64>[ 3.0, 4.0 ]
46+
> x
47+
<Complex64Array>[ 5.0, -5.0, 3.0, 4.0, 5.0, -5.0 ]
5048

5149
// Using view offsets:
5250
> var x0 = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
5351
> var x1 = new {{alias:@stdlib/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
5452
> alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, -5.0 );
5553
> {{alias}}( 2, alpha, x1, 1 );
56-
> z = x0.get( 0 )
57-
<Complex64>[ 1.0, 2.0 ]
58-
> z = x0.get( 1 )
59-
<Complex64>[ 5.0, -5.0 ]
54+
> x0
55+
<Complex64Array>[ 1.0, 2.0, 5.0, -5.0, 5.0, -5.0 ]
6056

6157

6258
{{alias}}.ndarray( N, alpha, x, strideX, offsetX )
@@ -95,17 +91,15 @@
9591
> var x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
9692
> var alpha = new {{alias:@stdlib/complex/float32/ctor}}( 2.0, 2.0 );
9793
> {{alias}}.ndarray( x.length, alpha, x, 1, 0 );
98-
> var z = x.get( 0 )
99-
<Complex64>[ 2.0, 2.0 ]
94+
> x
95+
<Complex64Array>[ 2.0, 2.0, 2.0, 2.0 ]
10096

10197
// Using an index offset:
10298
> x = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
10399
> alpha = new {{alias:@stdlib/complex/float32/ctor}}( 5.0, -5.0 );
104100
> {{alias}}.ndarray( 2, alpha, x, 2, 1 );
105-
> z = x.get( 0 )
106-
<Complex64>[ 1.0, 2.0 ]
107-
> z = x.get( 1 )
108-
<Complex64>[ 5.0, -5.0 ]
101+
> x
102+
<Complex64Array>[ 1.0, 2.0, 5.0, -5.0, 5.0, 6.0, 5.0, -5.0 ]
109103

110104
See Also
111105
--------

lib/node_modules/@stdlib/blas/ext/base/cfill/docs/types/index.d.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@ interface Routine {
3737
* @returns input array
3838
*
3939
* @example
40-
* var Float32Array = require( '@stdlib/array/float32' );
4140
* var Complex64Array = require( '@stdlib/array/complex64' );
4241
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
4342
*
44-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
45-
* var x = new Complex64Array( arr );
43+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
4644
*
4745
* var alpha = new Complex64( 10.0, 10.0 );
4846
*
4947
* cfill( x.length, alpha, x, 1 );
50-
*
51-
* var y = x.get( 0 );
52-
* // returns <Complex64>[ 10.0, 10.0 ]
48+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
5349
*/
5450
( N: number, alpha: Complex64, x: Complex64Array, strideX: number ): Complex64Array;
5551

@@ -64,19 +60,15 @@ interface Routine {
6460
* @returns input array
6561
*
6662
* @example
67-
* var Float32Array = require( '@stdlib/array/float32' );
6863
* var Complex64Array = require( '@stdlib/array/complex64' );
6964
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
7065
*
71-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
72-
* var x = new Complex64Array( arr );
66+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
7367
*
7468
* var alpha = new Complex64( 10.0, 10.0 );
7569
*
76-
* cfill( x.length, alpha, x, 1, 0 );
77-
*
78-
* var y = x.get( 0 );
79-
* // returns <Complex64>[ 10.0, 10.0 ]
70+
* cfill.ndarray( x.length, alpha, x, 1, 0 );
71+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
8072
*/
8173
ndarray( N: number, alpha: Complex64, x: Complex64Array, strideX: number, offsetX: number ): Complex64Array;
8274
}
@@ -91,19 +83,26 @@ interface Routine {
9183
* @returns input array
9284
*
9385
* @example
94-
* var Float32Array = require( '@stdlib/array/float32' );
9586
* var Complex64Array = require( '@stdlib/array/complex64' );
9687
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
9788
*
98-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
99-
* var x = new Complex64Array( arr );
89+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
10090
*
10191
* var alpha = new Complex64( 10.0, 10.0 );
10292
*
10393
* cfill( x.length, alpha, x, 1 );
94+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
95+
*
96+
* @example
97+
* var Complex64Array = require( '@stdlib/array/complex64' );
98+
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
99+
*
100+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
101+
*
102+
* var alpha = new Complex64( 10.0, 10.0 );
104103
*
105-
* var y = x.get( 0 );
106-
* // returns <Complex64>[ 10.0, 10.0 ]
104+
* cfill.ndarray( x.length, alpha, x, 1, 0 );
105+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
107106
*/
108107
declare var cfill: Routine;
109108

lib/node_modules/@stdlib/blas/ext/base/cfill/lib/cfill.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ var ndarray = require( './ndarray.js' );
3636
* @returns {Complex64Array} input array
3737
*
3838
* @example
39-
* var Float32Array = require( '@stdlib/array/float32' );
4039
* var Complex64Array = require( '@stdlib/array/complex64' );
4140
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
4241
*
43-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
44-
* var x = new Complex64Array( arr );
42+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
4543
*
4644
* var alpha = new Complex64( 10.0, 10.0 );
4745
*
4846
* cfill( x.length, alpha, x, 1 );
49-
*
50-
* var y = x.get( 0 );
51-
* // returns <Complex64>[ 10.0, 10.0 ]
47+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
5248
*/
5349
function cfill( N, alpha, x, strideX ) {
5450
return ndarray( N, alpha, x, strideX, stride2offset( N, strideX ) );

lib/node_modules/@stdlib/blas/ext/base/cfill/lib/cfill.native.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ var addon = require( './../src/addon.node' );
3636
* @returns {Complex64Array} input array
3737
*
3838
* @example
39-
* var Float32Array = require( '@stdlib/array/float32' );
4039
* var Complex64Array = require( '@stdlib/array/complex64' );
4140
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
4241
*
43-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
44-
* var x = new Complex64Array( arr );
42+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
4543
*
4644
* var alpha = new Complex64( 10.0, 10.0 );
4745
*
4846
* cfill( x.length, alpha, x, 1 );
49-
*
50-
* var y = x.get( 0 );
51-
* // returns <Complex64>[ 10.0, 10.0 ]
47+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
5248
*/
5349
function cfill( N, alpha, x, strideX ) {
5450
var view = reinterpret( x, 0 );

lib/node_modules/@stdlib/blas/ext/base/cfill/lib/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@
2424
* @module @stdlib/blas/ext/base/cfill
2525
*
2626
* @example
27-
* var Float32Array = require( '@stdlib/array/float32' );
2827
* var Complex64Array = require( '@stdlib/array/complex64' );
2928
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
3029
* var cfill = require( '@stdlib/blas/ext/base/cfill' );
3130
*
32-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
33-
* var x = new Complex64Array( arr );
31+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
3432
*
3533
* var alpha = new Complex64( 10.0, 10.0 );
3634
*
3735
* cfill( x.length, alpha, x, 1 );
38-
*
39-
* var y = x.get( 0 );
40-
* // returns <Complex64>[ 10.0, 10.0 ]
36+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
4137
*/
4238

4339
// MODULES //

lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,15 @@ var M = 8;
4343
* @returns {Complex64Array} input array
4444
*
4545
* @example
46-
* var Float32Array = require( '@stdlib/array/float32' );
4746
* var Complex64Array = require( '@stdlib/array/complex64' );
4847
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
4948
*
50-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
51-
* var x = new Complex64Array( arr );
49+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
5250
*
5351
* var alpha = new Complex64( 10.0, 10.0 );
5452
*
5553
* cfill( x.length, alpha, x, 1, 0 );
56-
*
57-
* var y = x.get( 0 );
58-
* // returns <Complex64>[ 10.0, 10.0 ]
54+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
5955
*/
6056
function cfill( N, alpha, x, strideX, offsetX ) {
6157
var view;

lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.native.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,15 @@ var addon = require( './../src/addon.node' );
3737
* @returns {Complex64Array} input array
3838
*
3939
* @example
40-
* var Float32Array = require( '@stdlib/array/float32' );
4140
* var Complex64Array = require( '@stdlib/array/complex64' );
4241
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
4342
*
44-
* var arr = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
45-
* var x = new Complex64Array( arr );
43+
* var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
4644
*
4745
* var alpha = new Complex64( 10.0, 10.0 );
4846
*
4947
* cfill( x.length, alpha, x, 1, 0 );
50-
*
51-
* var y = x.get( 0 );
52-
* // returns <Complex64>[ 10.0, 10.0 ]
48+
* // x => <Complex64Array>[ 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 ]
5349
*/
5450
function cfill( N, alpha, x, strideX, offsetX ) {
5551
var view = reinterpret( x, 0 );

0 commit comments

Comments
 (0)