@@ -20,7 +20,7 @@ limitations under the License.
2020
2121# zdrot
2222
23- > Applies a plane rotation.
23+ > Apply a plane rotation.
2424
2525<section class =" usage " >
2626
@@ -30,40 +30,40 @@ limitations under the License.
3030var zdrot = require ( ' @stdlib/blas/base/zdrot' );
3131```
3232
33- #### zdrot( N, zx , strideX, zy , strideY, c, s )
33+ #### zdrot( N, x , strideX, y , strideY, c, s )
3434
3535Applies a plane rotation.
3636
3737``` javascript
3838var Complex128Array = require ( ' @stdlib/array/complex128' );
3939
40- var zx = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
41- var zy = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
40+ var x = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
41+ var y = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
4242
43- zdrot ( zx .length , zx , 1 , zy , 1 , 0.8 , 0.6 );
44- // zx => <Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8, ~5.6, ~6.4 ]
45- // zy => <Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6, ~-4.2, ~-4.8 ]
43+ zdrot ( x .length , x , 1 , y , 1 , 0.8 , 0.6 );
44+ // x => <Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8, ~5.6, ~6.4 ]
45+ // y => <Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6, ~-4.2, ~-4.8 ]
4646```
4747
4848The function has the following parameters:
4949
5050- ** N** : number of indexed elements.
51- - ** zx ** : first input [ ` Complex128Array ` ] [ @stdlib/array/complex128 ] .
52- - ** strideX** : index increment for ` zx ` .
53- - ** zy ** : second input [ ` Complex128Array ` ] [ @stdlib/array/complex128 ] .
54- - ** strideY** : index increment for ` zy ` .
51+ - ** x ** : first input [ ` Complex128Array ` ] [ @stdlib/array/complex128 ] .
52+ - ** strideX** : index increment for ` x ` .
53+ - ** y ** : second input [ ` Complex128Array ` ] [ @stdlib/array/complex128 ] .
54+ - ** strideY** : index increment for ` y ` .
5555
56- The ` N ` and stride parameters determine how values from ` zx ` and ` zy ` are accessed at runtime. For example, to apply a plane rotation to every other element,
56+ The ` N ` and stride parameters determine how values from ` x ` and ` y ` are accessed at runtime. For example, to apply a plane rotation to every other element,
5757
5858``` javascript
5959var Complex128Array = require ( ' @stdlib/array/complex128' );
6060
61- var zx = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
62- var zy = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
61+ var x = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
62+ var y = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
6363
64- zdrot ( 2 , zx , 2 , zy , 2 , 0.8 , 0.6 );
65- // zx => <Complex128Array>[ ~0.8, ~1.6, 3.0, 4.0, 4.0, ~4.8, 7.0, 8.0 ]
66- // zy => <Complex128Array>[ ~-0.6, ~-1.2, 0.0, 0.0, -3.0, ~-3.6, 0.0, 0.0 ]
64+ zdrot ( 2 , x , 2 , y , 2 , 0.8 , 0.6 );
65+ // x => <Complex128Array>[ ~0.8, ~1.6, 3.0, 4.0, 4.0, ~4.8, 7.0, 8.0 ]
66+ // y => <Complex128Array>[ ~-0.6, ~-1.2, 0.0, 0.0, -3.0, ~-3.6, 0.0, 0.0 ]
6767```
6868
6969Note that indexing is relative to the first index. To introduce an offset, use [ ` typed array ` ] [ mdn-typed-array ] views.
@@ -74,49 +74,49 @@ Note that indexing is relative to the first index. To introduce an offset, use [
7474var Complex128Array = require ( ' @stdlib/array/complex128' );
7575
7676// Initial arrays...
77- var zx0 = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
78- var zy0 = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
77+ var x0 = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
78+ var y0 = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
7979
8080// Create offset views...
81- var zx1 = new Complex128Array ( zx0 .buffer , zx0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
82- var zy1 = new Complex128Array ( zy0 .buffer , zy0 .BYTES_PER_ELEMENT * 2 ); // start at 3rd element
81+ var x1 = new Complex128Array ( x0 .buffer , x0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
82+ var y1 = new Complex128Array ( y0 .buffer , y0 .BYTES_PER_ELEMENT * 2 ); // start at 3rd element
8383
84- zdrot ( 2 , zx1 , - 2 , zy1 , 1 , 0.8 , 0.6 );
85- // zx0 => <Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
86- // zy0 => <Complex128Array>[ 0.0, 0.0, 0.0, 0.0, ~-4.2, ~-4.8, ~-1.8, ~-2.4 ]
84+ zdrot ( 2 , x1 , - 2 , y1 , 1 , 0.8 , 0.6 );
85+ // x0 => <Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
86+ // y0 => <Complex128Array>[ 0.0, 0.0, 0.0, 0.0, ~-4.2, ~-4.8, ~-1.8, ~-2.4 ]
8787```
8888
89- #### zdrot.ndarray( N, zx , strideX, offsetX, zy , strideY, offsetY, c, s )
89+ #### zdrot.ndarray( N, x , strideX, offsetX, y , strideY, offsetY, c, s )
9090
9191Applies a plane rotation using alternative indexing semantics.
9292
9393``` javascript
9494var Complex128Array = require ( ' @stdlib/array/complex128' );
9595
96- var zx = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
97- var zy = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
96+ var x = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
97+ var y = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
9898
99- zdrot .ndarray ( zx .length , zx , 1 , 0 , zy , 1 , 0 , 0.8 , 0.6 );
100- // zx => <Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8 ]
101- // zy => <Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6 ]
99+ zdrot .ndarray ( x .length , x , 1 , 0 , y , 1 , 0 , 0.8 , 0.6 );
100+ // x => <Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8 ]
101+ // y => <Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6 ]
102102```
103103
104104The function has the following additional parameters:
105105
106- - ** offsetX** : starting index for ` zx ` .
107- - ** offsetY** : starting index for ` zy ` .
106+ - ** offsetX** : starting index for ` x ` .
107+ - ** offsetY** : starting index for ` y ` .
108108
109109While [ ` typed array ` ] [ mdn-typed-array ] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to apply a plane rotation to every other element starting from the second element,
110110
111111``` javascript
112112var Complex128Array = require ( ' @stdlib/array/complex128' );
113113
114- var zx = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
115- var zy = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
114+ var x = new Complex128Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
115+ var y = new Complex128Array ( [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] );
116116
117- zdrot .ndarray ( 2 , zx , 2 , 1 , zy , 2 , 1 , 0.8 , 0.6 );
118- // zx => <Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
119- // zy => <Complex128Array>[ 0.0, 0.0, ~-1.8, ~-2.4, 0.0, 0.0, ~-4.2, ~-4.8 ]
117+ zdrot .ndarray ( 2 , x , 2 , 1 , y , 2 , 1 , 0.8 , 0.6 );
118+ // x => <Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
119+ // y => <Complex128Array>[ 0.0, 0.0, ~-1.8, ~-2.4, 0.0, 0.0, ~-4.2, ~-4.8 ]
120120```
121121
122122</section >
@@ -127,7 +127,7 @@ zdrot.ndarray( 2, zx, 2, 1, zy, 2, 1, 0.8, 0.6 );
127127
128128## Notes
129129
130- - If ` N <= 0 ` , both functions leave ` zx ` and ` zy ` unchanged.
130+ - If ` N <= 0 ` , both functions leave ` x ` and ` y ` unchanged.
131131- ` zdrot() ` corresponds to the [ BLAS] [ blas ] level 1 function [ ` zdrot ` ] [ zdrot ] .
132132
133133</section >
@@ -154,17 +154,17 @@ function rand() {
154154}
155155
156156// Generate random input arrays:
157- var zx = filledarrayBy ( 10 , ' complex128' , rand );
158- var zxc = zcopy ( zx .length , zx , 1 , zeros ( zx .length , ' complex128' ), 1 );
157+ var x = filledarrayBy ( 10 , ' complex128' , rand );
158+ var xc = zcopy ( x .length , x , 1 , zeros ( x .length , ' complex128' ), 1 );
159159
160- var zy = filledarrayBy ( 10 , ' complex128' , rand );
161- var zyc = zcopy ( zy .length , zy , 1 , zeros ( zy .length , ' complex128' ), 1 );
160+ var y = filledarrayBy ( 10 , ' complex128' , rand );
161+ var yc = zcopy ( y .length , y , 1 , zeros ( y .length , ' complex128' ), 1 );
162162
163163// Apply a plane rotation:
164- zdrot ( zx .length , zx , 1 , zy , 1 , 0.8 , 0.6 );
164+ zdrot ( x .length , x , 1 , y , 1 , 0.8 , 0.6 );
165165
166166// Print the results:
167- logEach ( ' (%s,%s) => (%s,%s)' , zxc, zyc, zx, zy );
167+ logEach ( ' (%s,%s) => (%s,%s)' , xc, yc, x, y );
168168```
169169
170170</section >
@@ -211,10 +211,10 @@ c_zdrot( 2, (void *)x, 1, (void *)y, 1, 0.8, 0.6 );
211211The function accepts the following arguments:
212212
213213- **N**: `[in] CBLAS_INT` number of indexed elements.
214- - **zx **: `[inout] void*` first input array.
215- - **strideX**: `[in] CBLAS_INT` index increment for `zx `.
216- - **zy **: `[inout] void*` second input array.
217- - **strideY**: `[in] CBLAS_INT` index increment for `zy `.
214+ - **X **: `[inout] void*` first input array.
215+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
216+ - **Y **: `[inout] void*` second input array.
217+ - **strideY**: `[in] CBLAS_INT` index increment for `Y `.
218218- **c**: `[in] double` cosine of the angle of rotation.
219219- **s**: `[in] double` sine of the angle of rotation.
220220
@@ -236,12 +236,12 @@ c_zdrot_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0, 0.8, 0.6 );
236236The function accepts the following arguments:
237237
238238- **N**: `[in] CBLAS_INT` number of indexed elements.
239- - **zx **: `[inout] void*` first input array.
240- - **strideX**: `[in] CBLAS_INT` index increment for `zx `.
241- - **offsetX**: `[in] CBLAS_INT` starting index for `zx `.
242- - **zy **: `[inout] void*` second input array.
243- - **strideY**: `[in] CBLAS_INT` index increment for `zy `.
244- - **offsetY**: `[in] CBLAS_INT` starting index for `zy `.
239+ - **X **: `[inout] void*` first input array.
240+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
241+ - **offsetX**: `[in] CBLAS_INT` starting index for `X `.
242+ - **Y **: `[inout] void*` second input array.
243+ - **strideY**: `[in] CBLAS_INT` index increment for `Y `.
244+ - **offsetY**: `[in] CBLAS_INT` starting index for `Y `.
245245- **c**: `[in] double` cosine of the angle of rotation.
246246- **s**: `[in] double` sine of the angle of rotation.
247247
@@ -273,8 +273,8 @@ void c_zdrot_ndarray( const CBLAS_INT N, void *X, const CBLAS_INT strideX, const
273273
274274int main ( void ) {
275275 // Create strided arrays:
276- double zx [ ] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
277- double zy [ ] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
276+ double x [ ] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
277+ double y [ ] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
278278
279279 // Specify the number of elements:
280280 const int N = 4;
@@ -284,12 +284,12 @@ int main( void ) {
284284 const int strideY = -1;
285285
286286 // Copy elements:
287- c_zdrot( N, (void *)zx , strideX, (void *)zy , strideY, 0.8, 0.6 );
287+ c_zdrot( N, (void *)x , strideX, (void *)y , strideY, 0.8, 0.6 );
288288
289289 // Print the result:
290290 for ( int i = 0; i < N; i++ ) {
291- printf( "zx [ %i ] = %lf + %lfj\n", i, zx [ i*2 ], zx [ (i*2)+1 ] );
292- printf( "zy [ %i ] = %lf + %lfj\n", i, zy [ i*2 ], zy [ (i*2)+1 ] );
291+ printf( "x [ %i ] = %lf + %lfj\n", i, x [ i*2 ], x [ (i*2)+1 ] );
292+ printf( "y [ %i ] = %lf + %lfj\n", i, y [ i*2 ], y [ (i*2)+1 ] );
293293 }
294294}
295295```
0 commit comments