Skip to content

Commit e64ea31

Browse files
docs: improve doctests for complex number typed arrays in ndarray/base/broadcast-scalar
PR-URL: stdlib-js#12048 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com> Ref: stdlib-js/metr-issue-tracker#523 Ref: stdlib-js#4833
1 parent 20df517 commit e64ea31

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

  • lib/node_modules/@stdlib/ndarray/base/broadcast-scalar/docs/types

lib/node_modules/@stdlib/ndarray/base/broadcast-scalar/docs/types/index.d.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ declare function broadcastScalar( value: number, dtype: 'float32', shape: Shape,
9393
* @example
9494
* var getShape = require( '@stdlib/ndarray/shape' );
9595
* var getDType = require( '@stdlib/ndarray/dtype' );
96+
* var getData = require( '@stdlib/ndarray/data-buffer' );
9697
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
9798
*
9899
* var v = new Complex128( 1.0, 2.0 );
@@ -106,8 +107,8 @@ declare function broadcastScalar( value: number, dtype: 'float32', shape: Shape,
106107
* var dt = String( getDType( x ) );
107108
* // returns 'complex128'
108109
*
109-
* var v = x.get( 0, 1 );
110-
* // returns <Complex128>[ 1.0, 2.0 ]
110+
* var buf = getData( x );
111+
* // returns <Complex128Array>[ 1.0, 2.0 ]
111112
*/
112113
declare function broadcastScalar( value: number | ComplexLike, dtype: 'complex128', shape: Shape, order: Order ): complex128ndarray;
113114

@@ -127,9 +128,8 @@ declare function broadcastScalar( value: number | ComplexLike, dtype: 'complex12
127128
* @example
128129
* var getShape = require( '@stdlib/ndarray/shape' );
129130
* var getDType = require( '@stdlib/ndarray/dtype' );
131+
* var getData = require( '@stdlib/ndarray/data-buffer' );
130132
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
131-
* var realf = require( '@stdlib/complex/float32/real' );
132-
* var imagf = require( '@stdlib/complex/float32/imag' );
133133
*
134134
* var v = new Complex64( 1.0, 2.0 );
135135
*
@@ -142,14 +142,8 @@ declare function broadcastScalar( value: number | ComplexLike, dtype: 'complex12
142142
* var dt = String( getDType( x ) );
143143
* // returns 'complex64'
144144
*
145-
* var v = x.get( 0, 1 );
146-
* // returns <Complex64>
147-
*
148-
* var re = realf( v );
149-
* // returns 1.0
150-
*
151-
* var im = imagf( v );
152-
* // returns 2.0
145+
* var buf = getData( x );
146+
* // returns <Complex64Array>[ 1.0, 2.0 ]
153147
*/
154148
declare function broadcastScalar( value: number | ComplexLike, dtype: 'complex64', shape: Shape, order: Order ): complex64ndarray;
155149

0 commit comments

Comments
 (0)