@stdlib/strided
Version:
Strided.
144 lines (114 loc) • 4.24 kB
Plain Text
{{alias}}( N, x, strideX, y, strideY, fcn )
Applies a unary function to a single-precision complex floating-point
strided input array and assigns results to a single-precision complex
floating-point strided output array.
The `N` and stride parameters determine which elements in the strided arrays
are accessed at runtime.
Indexing is relative to the first index. To introduce an offset, use typed
array views.
Parameters
----------
N: integer
Number of indexed elements.
x: Complex64Array
Input array.
strideX: integer
Index increment for `x`.
y: Complex64Array
Destination array.
strideY: integer
Index increment for `y`.
fcn: Function
Unary function to apply.
Returns
-------
y: Complex64Array
Input array `y`.
Examples
--------
// Standard usage:
> var xbuf = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ];
> var x = new {{alias:/array/complex64}}( xbuf );
> var y = new {{alias:/array/complex64}}( x.length );
> {{alias}}( x.length, x, 1, y, 1, {{alias:/math/base/special/cidentityf}} );
> var v = y.get( 0 )
<Complex64>
> var re = {{alias:/complex/float64/real}}( v )
1.0
> var im = {{alias:/complex/float64/imag}}( v )
2.0
// Using `N` and stride parameters:
> y = new {{alias:/array/complex64}}( x.length );
> {{alias}}( 2, x, 2, y, -1, {{alias:/math/base/special/cidentityf}} );
> v = y.get( 0 )
<Complex64>
> re = {{alias:/complex/float64/real}}( v )
5.0
> im = {{alias:/complex/float64/imag}}( v )
6.0
// Using view offsets:
> var x0 = new {{alias:/array/complex64}}( xbuf );
> var y0 = new {{alias:/array/complex64}}( x0.length );
> var x1 = new {{alias:/array/complex64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
> var y1 = new {{alias:/array/complex64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
> {{alias}}( 2, x1, -2, y1, 1, {{alias:/math/base/special/cidentityf}} );
> v = y1.get( 0 )
<Complex64>
> re = {{alias:/complex/float64/real}}( v )
7.0
> im = {{alias:/complex/float64/imag}}( v )
8.0
{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, fcn )
Applies a unary function to a single-precision complex floating-point
strided input array and assigns results to a single-precision complex
floating-point strided output array using alternative indexing semantics.
While typed array views mandate a view offset based on the underlying
buffer, the offset parameters support indexing semantics based on starting
indices.
Parameters
----------
N: integer
Number of indexed elements.
x: Complex64Array
Input array.
strideX: integer
Index increment for `x`.
offsetX: integer
Starting index for `x`.
y: Complex64Array
Destination array.
strideY: integer
Index increment for `y`.
offsetY: integer
Starting index for `y`.
fcn: Function
Unary function to apply.
Returns
-------
y: Complex64Array
Input array `y`.
Examples
--------
// Standard usage:
> var xbuf = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ];
> var x = new {{alias:/array/complex64}}( xbuf );
> var y = new {{alias:/array/complex64}}( x.length );
> {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0, {{alias:/math/base/special/cidentityf}} );
> var v = y.get( 0 )
<Complex64>
> var re = {{alias:/complex/float64/real}}( v )
1.0
> var im = {{alias:/complex/float64/imag}}( v )
2.0
// Advanced indexing:
> x = new {{alias:/array/complex64}}( xbuf );
> y = new {{alias:/array/complex64}}( x.length );
> {{alias}}.ndarray( 2, x, 2, 1, y, -1, y.length-1, {{alias:/math/base/special/cidentityf}} );
> v = y.get( y.length-1 )
<Complex64>
> re = {{alias:/complex/float64/real}}( v )
3.0
> im = {{alias:/complex/float64/imag}}( v )
4.0
See Also
--------