@@ -30,39 +30,39 @@ limitations under the License.
30
30
var cscal = require ( ' @stdlib/blas/base/cscal' );
31
31
```
32
32
33
- #### cscal( N, ca, cx , strideX )
33
+ #### cscal( N, alpha, x , strideX )
34
34
35
- Scales values from ` cx ` by ` ca ` .
35
+ Scales values from ` x ` by ` alpha ` .
36
36
37
37
``` javascript
38
38
var Complex64Array = require ( ' @stdlib/array/complex64' );
39
39
var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
40
40
41
- var cx = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
42
- var ca = new Complex64 ( 2.0 , 0.0 );
41
+ var x = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
42
+ var alpha = new Complex64 ( 2.0 , 0.0 );
43
43
44
- cscal ( 3 , ca, cx , 1 );
45
- // cx => <Complex64Array>[ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 ]
44
+ cscal ( 3 , alpha, x , 1 );
45
+ // x => <Complex64Array>[ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 ]
46
46
```
47
47
48
48
The function has the following parameters:
49
49
50
50
- ** N** : number of indexed elements.
51
- - ** ca ** : scalar [ ` Complex64 ` ] [ @stdlib/complex/float32/ctor ] constant.
52
- - ** cx ** : input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
53
- - ** strideX** : index increment for ` cx ` .
51
+ - ** alpha ** : scalar [ ` Complex64 ` ] [ @stdlib/complex/float32/ctor ] constant.
52
+ - ** x ** : input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
53
+ - ** strideX** : index increment for ` x ` .
54
54
55
- The ` N ` and stride parameters determine how values from ` cx ` are scaled by ` ca ` . For example, to scale every other value in ` cx ` by ` ca ` ,
55
+ The ` N ` and stride parameters determine how values from ` x ` are scaled by ` alpha ` . For example, to scale every other value in ` x ` by ` alpha ` ,
56
56
57
57
``` javascript
58
58
var Complex64Array = require ( ' @stdlib/array/complex64' );
59
59
var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
60
60
61
- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
62
- var ca = new Complex64 ( 2.0 , 0.0 );
61
+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
62
+ var alpha = new Complex64 ( 2.0 , 0.0 );
63
63
64
- cscal ( 2 , ca, cx , 2 );
65
- // cx => <Complex64Array>[ 2.0, 4.0, 3.0, 4.0, 10.0, 12.0, 7.0, 8.0 ]
64
+ cscal ( 2 , alpha, x , 2 );
65
+ // x => <Complex64Array>[ 2.0, 4.0, 3.0, 4.0, 10.0, 12.0, 7.0, 8.0 ]
66
66
```
67
67
68
68
Note that indexing is relative to the first index. To introduce an offset, use [ ` typed array ` ] [ mdn-typed-array ] views.
@@ -74,49 +74,49 @@ var Complex64Array = require( '@stdlib/array/complex64' );
74
74
var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
75
75
76
76
// Initial array:
77
- var cx0 = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
77
+ var x0 = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
78
78
79
79
// Define a scalar constant:
80
- var ca = new Complex64 ( 2.0 , 2.0 );
80
+ var alpha = new Complex64 ( 2.0 , 2.0 );
81
81
82
82
// Create an offset view:
83
- var cx1 = new Complex64Array ( cx0 .buffer , cx0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
83
+ var x1 = new Complex64Array ( x0 .buffer , x0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
84
84
85
- // Scales every other value from `cx1 ` by `ca `...
86
- cscal ( 3 , ca, cx1 , 1 );
87
- // cx0 => <Complex64Array>[ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0 ]
85
+ // Scales every other value from `x1 ` by `alpha `...
86
+ cscal ( 3 , alpha, x1 , 1 );
87
+ // x0 => <Complex64Array>[ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0 ]
88
88
```
89
89
90
- #### cscal.ndarray( N, ca, cx , strideX, offsetX )
90
+ #### cscal.ndarray( N, alpha, x , strideX, offsetX )
91
91
92
- Scales values from ` cx ` by ` ca ` using alternative indexing semantics.
92
+ Scales values from ` x ` by ` alpha ` using alternative indexing semantics.
93
93
94
94
``` javascript
95
95
var Complex64Array = require ( ' @stdlib/array/complex64' );
96
96
var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
97
97
98
- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
99
- var ca = new Complex64 ( 2.0 , 2.0 );
98
+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
99
+ var alpha = new Complex64 ( 2.0 , 2.0 );
100
100
101
- cscal .ndarray ( 3 , ca, cx , 1 , 0 );
102
- // cx => <Complex64Array>[ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ]
101
+ cscal .ndarray ( 3 , alpha, x , 1 , 0 );
102
+ // x => <Complex64Array>[ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ]
103
103
```
104
104
105
105
The function has the following additional parameters:
106
106
107
- - ** offsetX** : starting index for ` cx ` .
107
+ - ** offsetX** : starting index for ` x ` .
108
108
109
109
While [ ` typed array ` ] [ mdn-typed-array ] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to scale every other value in the input strided array starting from the second element,
110
110
111
111
``` javascript
112
112
var Complex64Array = require ( ' @stdlib/array/complex64' );
113
113
var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
114
114
115
- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
116
- var ca = new Complex64 ( 2.0 , 2.0 );
115
+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
116
+ var alpha = new Complex64 ( 2.0 , 2.0 );
117
117
118
- cscal .ndarray ( 2 , ca, cx , 2 , 1 );
119
- // cx => <Complex64Array>[ 1.0, 2.0, -2.0, 14.0, 5.0, 6.0, -2.0, 30.0 ]
118
+ cscal .ndarray ( 2 , alpha, x , 2 , 1 );
119
+ // x => <Complex64Array>[ 1.0, 2.0, -2.0, 14.0, 5.0, 6.0, -2.0, 30.0 ]
120
120
```
121
121
122
122
</section >
@@ -127,7 +127,7 @@ cscal.ndarray( 2, ca, cx, 2, 1 );
127
127
128
128
## Notes
129
129
130
- - If ` N <= 0 ` or ` strideX <= 0 ` , both functions return ` cx ` unchanged.
130
+ - If ` N <= 0 ` or ` strideX <= 0 ` , both functions return ` x ` unchanged.
131
131
- ` cscal() ` corresponds to the [ BLAS] [ blas ] level 1 function [ ` cscal ` ] [ cscal ] .
132
132
133
133
</section >
@@ -150,15 +150,15 @@ function rand() {
150
150
return new Complex64 ( discreteUniform ( 0 , 10 ), discreteUniform ( - 5 , 5 ) );
151
151
}
152
152
153
- var cx = filledarrayBy ( 10 , ' complex64' , rand );
154
- console .log ( cx .toString () );
153
+ var x = filledarrayBy ( 10 , ' complex64' , rand );
154
+ console .log ( x .toString () );
155
155
156
- var ca = new Complex64 ( 2.0 , 2.0 );
157
- console .log ( ca .toString () );
156
+ var alpha = new Complex64 ( 2.0 , 2.0 );
157
+ console .log ( alpha .toString () );
158
158
159
- // Scale elements from `cx ` by `ca `:
160
- cscal ( cx .length , ca, cx , 1 );
161
- console .log ( cx .get ( cx .length - 1 ).toString () );
159
+ // Scale elements from `x ` by `alpha `:
160
+ cscal ( x .length , alpha, x , 1 );
161
+ console .log ( x .get ( x .length - 1 ).toString () );
162
162
```
163
163
164
164
</section >
@@ -191,53 +191,53 @@ console.log( cx.get( cx.length-1 ).toString() );
191
191
#include " stdlib/blas/base/cscal.h"
192
192
```
193
193
194
- #### c_cscal( N, ca , \* CX , strideX )
194
+ #### c_cscal( N, alpha , \* X , strideX )
195
195
196
- Scales values from ` CX ` by ` ca ` .
196
+ Scales values from ` X ` by ` alpha ` .
197
197
198
198
``` c
199
199
#include " stdlib/complex/float32/ctor.h"
200
200
201
- float cx [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
202
- const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f );
201
+ float x [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
202
+ const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f );
203
203
204
- c_cscal ( 4, ca , (void * )cx , 1 );
204
+ c_cscal ( 4, alpha , (void * )x , 1 );
205
205
```
206
206
207
207
The function accepts the following arguments:
208
208
209
209
- **N**: `[in] CBLAS_INT` number of indexed elements.
210
- - **ca **: `[in] stdlib_complex64_t` scalar constant.
211
- - **CX **: `[inout] void*` input array.
212
- - **strideX**: `[in] CBLAS_INT` index increment for `CX `.
210
+ - **alpha **: `[in] stdlib_complex64_t` scalar constant.
211
+ - **X **: `[inout] void*` input array.
212
+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
213
213
214
214
```c
215
- void c_cscal( const CBLAS_INT N, const stdlib_complex64_t ca , void *CX , const CBLAS_INT strideX );
215
+ void c_cscal( const CBLAS_INT N, const stdlib_complex64_t alpha , void *X , const CBLAS_INT strideX );
216
216
```
217
217
218
- #### c_cscal_ndarray( N, ca , \* CX , strideX, offsetX )
218
+ #### c_cscal_ndarray( N, alpha , \* X , strideX, offsetX )
219
219
220
- Scales values from ` CX ` by ` ca ` using alternative indexing semantics.
220
+ Scales values from ` X ` by ` alpha ` using alternative indexing semantics.
221
221
222
222
``` c
223
223
#include " stdlib/complex/float32/ctor.h"
224
224
225
- float cx [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
226
- const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f );
225
+ float x [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
226
+ const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f );
227
227
228
- c_cscal ( 4, ca , (void * )cx , 1, 0 );
228
+ c_cscal ( 4, alpha , (void * )x , 1, 0 );
229
229
```
230
230
231
231
The function accepts the following arguments:
232
232
233
233
- **N**: `[in] CBLAS_INT` number of indexed elements.
234
- - **ca **: `[in] stdlib_complex64_t` scalar constant.
235
- - **CX **: `[inout] void*` input array.
236
- - **strideX**: `[in] CBLAS_INT` index increment for `CX `.
237
- - **offsetX**: `[in] CBLAS_INT` starting index for `CX `.
234
+ - **alpha **: `[in] stdlib_complex64_t` scalar constant.
235
+ - **X **: `[inout] void*` input array.
236
+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
237
+ - **offsetX**: `[in] CBLAS_INT` starting index for `X `.
238
238
239
239
```c
240
- void c_cscal_ndarray( const CBLAS_INT N, const stdlib_complex64_t ca , void *CX , const CBLAS_INT strideX, const CBLAS_INT offsetX );
240
+ void c_cscal_ndarray( const CBLAS_INT N, const stdlib_complex64_t alpha , void *X , const CBLAS_INT strideX, const CBLAS_INT offsetX );
241
241
```
242
242
243
243
</section >
@@ -265,10 +265,10 @@ void c_cscal_ndarray( const CBLAS_INT N, const stdlib_complex64_t ca, void *CX,
265
265
266
266
int main ( void ) {
267
267
// Create a strided array of interleaved real and imaginary components:
268
- float cx [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
268
+ float x [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
269
269
270
270
// Create a complex scalar:
271
- const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f );
271
+ const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f );
272
272
273
273
// Specify the number of elements:
274
274
const int N = 4;
@@ -277,19 +277,19 @@ int main( void ) {
277
277
const int strideX = 1;
278
278
279
279
// Scale the elements of the array:
280
- c_cscal( N, ca , (void *)cx , strideX );
280
+ c_cscal( N, alpha , (void *)x , strideX );
281
281
282
282
// Print the result:
283
283
for ( int i = 0; i < N; i++ ) {
284
- printf( "cx [ %i ] = %f + %fj\n", i, cx [ i*2 ], cx [ (i*2)+1 ] );
284
+ printf( "x [ %i ] = %f + %fj\n", i, x [ i*2 ], x [ (i*2)+1 ] );
285
285
}
286
286
287
287
// Scale the elements of the array:
288
- c_cscal_ndarray( N, ca , (void *)cx , -strideX, 3 );
288
+ c_cscal_ndarray( N, alpha , (void *)x , -strideX, 3 );
289
289
290
290
// Print the result:
291
291
for ( int i = 0; i < N; i++ ) {
292
- printf( "cx [ %i ] = %f + %fj\n", i, cx [ i*2 ], cx [ (i*2)+1 ] );
292
+ printf( "x [ %i ] = %f + %fj\n", i, x [ i*2 ], x [ (i*2)+1 ] );
293
293
}
294
294
}
295
295
```
0 commit comments