forked from stdlib-js/stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
|
||
{{alias}}( N, cx, strideX, cy, strideY, c, s ) | ||
Applies a plane rotation. | ||
|
||
The `N` and stride parameters determine how values from `cx` and `cy` are | ||
rotated. | ||
|
||
Indexing is relative to the first index. To introduce an offset, use typed | ||
array views. | ||
|
||
If `N` is less than or equal to `0`, the vectors are unchanged. | ||
|
||
Parameters | ||
---------- | ||
N: integer | ||
Number of indexed elements. | ||
|
||
cx: Complex64Array | ||
First input array. | ||
|
||
strideX: integer | ||
Index increment for `cx`. | ||
|
||
cy: Complex64Array | ||
Second input array. | ||
|
||
strideY: integer | ||
Index increment for `cy`. | ||
|
||
c: number | ||
Cosine of the angle of rotation. | ||
|
||
s: number | ||
Sine of the angle of rotation. | ||
|
||
Returns | ||
------- | ||
cy: Complex64Array | ||
Input array `cy`. | ||
|
||
Examples | ||
-------- | ||
// Standard usage: | ||
> var cx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); | ||
> var cy = new {{alias:@stdlib/array/complex64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); | ||
> {{alias}}( cx.length, cx, 1, cy, 1, 0.8, 0.6 ); | ||
> var z = cy.get( 0 ); | ||
> var re = {{alias:@stdlib/complex/realf}}( z ) | ||
~-0.6 | ||
> var im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~-1.2 | ||
> z = cx.get( 0 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~0.8 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~1.6 | ||
|
||
// Advanced indexing: | ||
> cx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); | ||
> cy = new {{alias:@stdlib/array/complex64}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); | ||
> {{alias}}( 2, cx, -2, cy, 1, 0.8, 0.6 ); | ||
> z = cy.get( 0 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~-3.0 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~-3.6 | ||
> z = cx.get( 2 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~4.0 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~4.8 | ||
|
||
// Using typed array views: | ||
> var cx0 = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); | ||
> var cy0 = new {{alias:@stdlib/array/complex64}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); | ||
> var cx1 = new {{alias:@stdlib/array/complex64}}( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); | ||
> var cy1 = new {{alias:@stdlib/array/complex64}}( cy0.buffer, cy0.BYTES_PER_ELEMENT*2 ); | ||
> {{alias}}( 1, cx1, 1, cy1, 1, 0.8, 0.6 ); | ||
> z = cy0.get( 2 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~-1.8 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~-2.4 | ||
> z = cx0.get( 1 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~2.4 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~3.2 | ||
|
||
|
||
{{alias}}.ndarray( N, cx, strideX, offsetX, cy, strideY, offsetY, c, s ) | ||
Applies a plane rotation 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. | ||
|
||
cx: Complex64Array | ||
First input array. | ||
|
||
strideX: integer | ||
Index increment for `cx`. | ||
|
||
offsetX: integer | ||
Starting index for `cx`. | ||
|
||
cy: Complex64Array | ||
Second input array. | ||
|
||
strideY: integer | ||
Index increment for `cy`. | ||
|
||
offsetY: integer | ||
Starting index for `cy`. | ||
|
||
c: number | ||
Cosine of the angle of rotation. | ||
|
||
s: number | ||
Sine of the angle of rotation. | ||
|
||
Returns | ||
------- | ||
cy: Complex64Array | ||
Input array `cy`. | ||
|
||
Examples | ||
-------- | ||
// Standard usage: | ||
> var cx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); | ||
> var cy = new {{alias:@stdlib/array/complex64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); | ||
> {{alias}}.ndarray( cx.length, cx, 1, 0, cy, 1, 0, 0.8, 0.6 ); | ||
> var z = cy.get( 0 ); | ||
> var re = {{alias:@stdlib/complex/realf}}( z ) | ||
~-0.6 | ||
> var im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~-1.2 | ||
> z = cx.get( 0 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~0.8 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~1.6 | ||
|
||
// Advanced indexing: | ||
> cx = new {{alias:@stdlib/array/complex64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); | ||
> cy = new {{alias:@stdlib/array/complex64}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); | ||
> {{alias}}.ndarray( 1, cx, 2, 1, cy, 2, 1, 0.8, 0.6 ); | ||
> z = cy.get( 1 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~-1.8 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~-2.4 | ||
> z = cx.get( 1 ); | ||
> re = {{alias:@stdlib/complex/realf}}( z ) | ||
~2.4 | ||
> im = {{alias:@stdlib/complex/imagf}}( z ) | ||
~3.2 | ||
|
||
See Also | ||
-------- | ||
|