Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 5 additions & 35 deletions lib/node_modules/@stdlib/strided/base/zmap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,7 @@ var y = new Complex128Array( x.length );
zmap( x.length, x, 1, y, 1, cceil );

var v = y.get( 0 );
// returns <Complex128>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prajjwalbajpai You also need to remove any applicable import statements above and below in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there way to rewrite scale function without using real and imag function or should I leave it as it is?

* @example
* var Complex128Array = require( '@stdlib/array/complex128' );
* var real = require( '@stdlib/complex/float64/real' );
* var imag = require( '@stdlib/complex/float64/imag' );
* var Complex128 = require( '@stdlib/complex/float64/ctor' );
*
* function scale( x ) {
*     var re = real( x );
*     var im = imag( x );
*     return new Complex128( re*10.0, im*10.0 );
* }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should leave as is.


var re = real( v );
// returns -2.0

var im = imag( v );
// returns 2.0
// returns <Complex128>[ -2.0, 2.0 ]
```

The function accepts the following arguments:
Expand All @@ -84,13 +78,7 @@ var y = new Complex128Array( x.length );
zmap( 2, x, 2, y, -1, cceil );

var v = y.get( 0 );
// returns <Complex128>

var re = real( v );
// returns 5.0

var im = imag( v );
// returns 0.0
// returns <Complex128>[ 5.0, 0.0 ]
```

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][@stdlib/array/complex128] views.
Expand All @@ -112,13 +100,7 @@ var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3
zmap( 2, x1, -2, y1, 1, cceil );

var v = y0.get( 2 );
// returns <Complex128>

var re = real( v );
// returns -1.0

var im = imag( v );
// returns 4.0
// returns <Complex128>[ -1.0, 4.0 ]
```

#### zmap.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, fcn )
Expand All @@ -137,13 +119,7 @@ var y = new Complex128Array( x.length );
zmap.ndarray( x.length, x, 1, 0, y, 1, 0, cceil );

var v = y.get( 0 );
// returns <Complex128>

var re = real( v );
// returns -2.0

var im = imag( v );
// returns 2.0
// returns <Complex128>[ -2.0, 2.0 ]
```

The function accepts the following additional arguments:
Expand All @@ -165,13 +141,7 @@ var y = new Complex128Array( x.length );
zmap.ndarray( 2, x, 2, 1, y, -1, y.length-1, cceil );

var v = y.get( y.length-1 );
// returns <Complex128>

var re = real( v );
// returns 4.0

var im = imag( v );
// returns -5.0
// returns <Complex128>[ 4.0, -5.0 ]
```

</section>
Expand Down
30 changes: 5 additions & 25 deletions lib/node_modules/@stdlib/strided/base/zmap/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,13 @@
> var y = new {{alias:@stdlib/array/complex128}}( x.length );
> {{alias}}( x.length, x, 1, y, 1, {{alias:@stdlib/complex/float64/base/identity}} );
> var v = y.get( 0 )
<Complex128>
> var re = {{alias:@stdlib/complex/float64/real}}( v )
1.0
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
2.0
<Complex128>[ 1.0, 2.0 ]

// Using `N` and stride parameters:
> y = new {{alias:@stdlib/array/complex128}}( x.length );
> {{alias}}( 2, x, 2, y, -1, {{alias:@stdlib/complex/float64/base/identity}} );
> v = y.get( 0 )
<Complex128>
> re = {{alias:@stdlib/complex/float64/real}}( v )
5.0
> im = {{alias:@stdlib/complex/float64/imag}}( v )
6.0
<Complex128>[ 5.0, 6.0 ]

// Using view offsets:
> var x0 = new {{alias:@stdlib/array/complex128}}( xbuf );
Expand All @@ -66,11 +58,7 @@
> var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
> {{alias}}( 2, x1, -2, y1, 1, {{alias:@stdlib/complex/float64/base/identity}} );
> v = y1.get( 0 )
<Complex128>
> re = {{alias:@stdlib/complex/float64/real}}( v )
7.0
> im = {{alias:@stdlib/complex/float64/imag}}( v )
8.0
<Complex128>[ 7.0, 8.0 ]


{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, fcn )
Expand Down Expand Up @@ -121,22 +109,14 @@
> var y = new {{alias:@stdlib/array/complex128}}( x.length );
> {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0, {{alias:@stdlib/complex/float64/base/identity}} );
> var v = y.get( 0 )
<Complex128>
> var re = {{alias:@stdlib/complex/float64/real}}( v )
1.0
> var im = {{alias:@stdlib/complex/float64/imag}}( v )
2.0
<Complex128>[ 1.0, 2.0 ]

// Advanced indexing:
> x = new {{alias:@stdlib/array/complex128}}( xbuf );
> y = new {{alias:@stdlib/array/complex128}}( x.length );
> {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1, {{alias:@stdlib/complex/float64/base/identity}} );
> v = y.get( y.length-1 )
<Complex128>
> re = {{alias:@stdlib/complex/float64/real}}( v )
3.0
> im = {{alias:@stdlib/complex/float64/imag}}( v )
4.0
<Complex128>[ 3.0, 4.0 ]

See Also
--------
Expand Down
32 changes: 4 additions & 28 deletions lib/node_modules/@stdlib/strided/base/zmap/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ interface Routine {
* zmap( x.length, x, 1, y, 1, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prajjwalbajpai You need to remove any applicable import statements in this and other examples in this file.

*/
( N: number, x: Complex128Array, strideX: number, y: Complex128Array, strideY: number, fcn: Unary ): Complex128Array;

Expand Down Expand Up @@ -105,13 +99,7 @@ interface Routine {
* zmap.ndarray( x.length, x, 1, 0, y, 1, 0, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
*/
ndarray( N: number, x: Complex128Array, strideX: number, offsetX: number, y: Complex128Array, strideY: number, offsetY: number, fcn: Unary ): Complex128Array;
}
Expand Down Expand Up @@ -145,13 +133,7 @@ interface Routine {
* zmap( x.length, x, 1, y, 1, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
*
* @example
* var Complex128Array = require( '@stdlib/array/complex128' );
Expand All @@ -171,13 +153,7 @@ interface Routine {
* zmap.ndarray( x.length, x, 1, 0, y, 1, 0, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
*/
declare var zmap: Routine;

Expand Down
16 changes: 2 additions & 14 deletions lib/node_modules/@stdlib/strided/base/zmap/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,7 @@
* zmap( x.length, x, 1, y, 1, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prajjwalbajpai You need to remove any applicable import statements in this and other examples in this file.

*
* @example
* var Complex128Array = require( '@stdlib/array/complex128' );
Expand All @@ -69,13 +63,7 @@
* zmap.ndarray( x.length, x, 1, 0, y, 1, 0, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
*/

// MODULES //
Expand Down
8 changes: 1 addition & 7 deletions lib/node_modules/@stdlib/strided/base/zmap/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ var ndarray = require( './ndarray.js' );
* zmap( x.length, x, 1, y, 1, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prajjwalbajpai You need to remove any applicable import statements in this and other examples in this file.

*/
function zmap( N, x, strideX, y, strideY, fcn ) {
return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ), fcn ); // eslint-disable-line max-len
Expand Down
8 changes: 1 addition & 7 deletions lib/node_modules/@stdlib/strided/base/zmap/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@
* zmap( x.length, x, 1, 0, y, 1, 0, scale );
*
* var v = y.get( 0 );
* // returns <Complex128>
*
* var re = real( v );
* // returns 10.0
*
* var im = imag( v );
* // returns 10.0
* // returns <Complex128>[ 10.0, 10.0 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prajjwalbajpai You need to remove any applicable import statements in this and other examples in this file.

*/
function zmap( N, x, strideX, offsetX, y, strideY, offsetY, fcn ) {
var ix;
Expand Down