Interchange two one-dimensional complex double-precision floating-point ndarrays.
var zswap = require( '@stdlib/blas/base/ndarray/zswap' );Interchanges two one-dimensional complex double-precision floating-point ndarrays.
var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
var x = new Complex128Vector( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var y = new Complex128Vector( [ 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
var z = zswap( [ x, y ] );
// x => <ndarray>[ <Complex128>[ 7.0, 8.0 ], <Complex128>[ 9.0, 10.0 ], <Complex128>[ 11.0, 12.0 ] ]
// y => <ndarray>[ <Complex128>[ 1.0, 2.0 ], <Complex128>[ 3.0, 4.0 ], <Complex128>[ 5.0, 6.0 ] ]
var bool = ( z === y );
// returns trueThe function has the following parameters:
-
arrays: array-like object containing the following ndarrays:
- first one-dimensional input ndarray.
- second one-dimensional input ndarray.
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var Complex128Vector = require( '@stdlib/ndarray/vector/complex128' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var zswap = require( '@stdlib/blas/base/ndarray/zswap' );
var opts = {
'dtype': 'float64'
};
var x = new Complex128Vector( discreteUniform( 10, 0, 100, opts ) );
console.log( ndarray2array( x ) );
var y = new Complex128Vector( discreteUniform( 10, 0, 100, opts ) );
console.log( ndarray2array( y ) );
var out = zswap( [ x, y ] );
console.log( ndarray2array( x ) );
console.log( ndarray2array( out ) );