@@ -30,43 +30,43 @@ limitations under the License.
3030var caxpy = require ( ' @stdlib/blas/base/caxpy' );
3131```
3232
33- #### caxpy( N, ca, cx , strideX, cy , strideY )
33+ #### caxpy( N, alpha, x , strideX, y , strideY )
3434
35- Scales values from ` cx ` by ` ca ` and adds the result to ` cy ` .
35+ Scales values from ` x ` by ` alpha ` and adds the result to ` y ` .
3636
3737``` javascript
3838var Complex64Array = require ( ' @stdlib/array/complex64' );
3939var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
4040
41- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
42- var cy = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
43- var ca = new Complex64 ( 2.0 , 2.0 );
41+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
42+ var y = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
43+ var alpha = new Complex64 ( 2.0 , 2.0 );
4444
45- caxpy ( 3 , ca, cx , 1 , cy , 1 );
46- // cy => <Complex64Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
45+ caxpy ( 3 , alpha, x , 1 , y , 1 );
46+ // y => <Complex64Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
4747```
4848
4949The function has the following parameters:
5050
5151- ** N** : number of indexed elements.
52- - ** ca ** : scalar [ ` Complex64 ` ] [ @stdlib/complex/float32/ctor ] constant.
53- - ** cx ** : first input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
54- - ** strideX** : index increment for ` cx ` .
55- - ** cy ** : second input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
56- - ** strideY** : index increment for ` cy ` .
52+ - ** alpha ** : scalar [ ` Complex64 ` ] [ @stdlib/complex/float32/ctor ] constant.
53+ - ** x ** : first input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
54+ - ** strideX** : index increment for ` x ` .
55+ - ** y ** : second input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
56+ - ** strideY** : index increment for ` y ` .
5757
58- The ` N ` and stride parameters determine how values from ` cx ` are scaled by ` ca ` and added to ` cy ` . For example, to scale every other value in ` cx ` by ` ca ` and add the result to every other value of ` cy ` ,
58+ The ` N ` and stride parameters determine how values from ` x ` are scaled by ` alpha ` and added to ` y ` . For example, to scale every other value in ` x ` by ` alpha ` and add the result to every other value of ` y ` ,
5959
6060``` javascript
6161var Complex64Array = require ( ' @stdlib/array/complex64' );
6262var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
6363
64- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
65- var cy = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
66- var ca = new Complex64 ( 2.0 , 2.0 );
64+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
65+ var y = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
66+ var alpha = new Complex64 ( 2.0 , 2.0 );
6767
68- caxpy ( 2 , ca, cx , 2 , cy , 2 );
69- // cy => <Complex64Array>[ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0 ]
68+ caxpy ( 2 , alpha, x , 2 , y , 2 );
69+ // y => <Complex64Array>[ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0 ]
7070```
7171
7272Note that indexing is relative to the first index. To introduce an offset, use [ ` typed array ` ] [ mdn-typed-array ] views.
@@ -78,54 +78,54 @@ var Complex64Array = require( '@stdlib/array/complex64' );
7878var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
7979
8080// Initial arrays...
81- var cx0 = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
82- var cy0 = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
81+ var x0 = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
82+ var y0 = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
8383
8484// Define a scalar constant:
85- var ca = new Complex64 ( 2.0 , 2.0 );
85+ var alpha = new Complex64 ( 2.0 , 2.0 );
8686
8787// Create offset views...
88- var cx1 = new Complex64Array ( cx0 .buffer , cx0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
89- var cy1 = new Complex64Array ( cy0 .buffer , cy0 .BYTES_PER_ELEMENT * 2 ); // start at 3rd element
88+ var x1 = new Complex64Array ( x0 .buffer , x0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
89+ var y1 = new Complex64Array ( y0 .buffer , y0 .BYTES_PER_ELEMENT * 2 ); // start at 3rd element
9090
91- // Scales values of `cx0 ` by `ca ` starting from second index and add the result to `cy0 ` starting from third index...
92- caxpy ( 2 , ca, cx1 , 1 , cy1 , 1 );
93- // cy0 => <Complex64Array>[ 1.0, 1.0, 1.0, 1.0, -1.0, 15.0, -1.0, 23.0 ]
91+ // Scales values of `x0 ` by `alpha ` starting from second index and add the result to `y0 ` starting from third index...
92+ caxpy ( 2 , alpha, x1 , 1 , y1 , 1 );
93+ // y0 => <Complex64Array>[ 1.0, 1.0, 1.0, 1.0, -1.0, 15.0, -1.0, 23.0 ]
9494```
9595
96- #### caxpy.ndarray( N, ca, cx , strideX, offsetX, cy , strideY, offsetY )
96+ #### caxpy.ndarray( N, alpha, x , strideX, offsetX, y , strideY, offsetY )
9797
98- Scales values from ` cx ` by ` ca ` and adds the result to ` cy ` using alternative indexing semantics.
98+ Scales values from ` x ` by ` alpha ` and adds the result to ` y ` using alternative indexing semantics.
9999
100100``` javascript
101101var Complex64Array = require ( ' @stdlib/array/complex64' );
102102var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
103103
104- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
105- var cy = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
106- var ca = new Complex64 ( 2.0 , 2.0 );
104+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ] );
105+ var y = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
106+ var alpha = new Complex64 ( 2.0 , 2.0 );
107107
108- caxpy .ndarray ( 3 , ca, cx , 1 , 0 , cy , 1 , 0 );
109- // cy => <Complex64Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
108+ caxpy .ndarray ( 3 , alpha, x , 1 , 0 , y , 1 , 0 );
109+ // y => <Complex64Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
110110```
111111
112112The function has the following additional parameters:
113113
114- - ** offsetX** : starting index for ` cx ` .
115- - ** offsetY** : starting index for ` cy ` .
114+ - ** offsetX** : starting index for ` x ` .
115+ - ** offsetY** : starting index for ` y ` .
116116
117117While [ ` 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 scale values in the first input strided array starting from the second element and add the result to the second input array starting from the second element,
118118
119119``` javascript
120120var Complex64Array = require ( ' @stdlib/array/complex64' );
121121var Complex64 = require ( ' @stdlib/complex/float32/ctor' );
122122
123- var cx = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
124- var cy = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
125- var ca = new Complex64 ( 2.0 , 2.0 );
123+ var x = new Complex64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 ] );
124+ var y = new Complex64Array ( [ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ] );
125+ var alpha = new Complex64 ( 2.0 , 2.0 );
126126
127- caxpy .ndarray ( 3 , ca, cx , 1 , 1 , cy , 1 , 1 );
128- // cy => <Complex64Array>[ 1.0, 1.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0 ]
127+ caxpy .ndarray ( 3 , alpha, x , 1 , 1 , y , 1 , 1 );
128+ // y => <Complex64Array>[ 1.0, 1.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0 ]
129129```
130130
131131</section >
@@ -136,7 +136,7 @@ caxpy.ndarray( 3, ca, cx, 1, 1, cy, 1, 1 );
136136
137137## Notes
138138
139- - If ` N <= 0 ` , both functions return ` cy ` unchanged.
139+ - If ` N <= 0 ` , both functions return ` y ` unchanged.
140140- ` caxpy() ` corresponds to the [ BLAS] [ blas ] level 1 function [ ` caxpy ` ] [ caxpy ] .
141141
142142</section >
@@ -162,17 +162,17 @@ function rand() {
162162 return new Complex64 ( discreteUniform ( 0 , 10 ), discreteUniform ( - 5 , 5 ) );
163163}
164164
165- var cx = filledarrayBy ( 10 , ' complex64' , rand );
166- var cy = filledarrayBy ( 10 , ' complex64' , rand );
167- var cyc = ccopy ( cy .length , cy , 1 , zeros ( cy .length , ' complex64' ), 1 );
165+ var x = filledarrayBy ( 10 , ' complex64' , rand );
166+ var y = filledarrayBy ( 10 , ' complex64' , rand );
167+ var yc = ccopy ( y .length , y , 1 , zeros ( y .length , ' complex64' ), 1 );
168168
169- var ca = new Complex64 ( 2.0 , 2.0 );
169+ var alpha = new Complex64 ( 2.0 , 2.0 );
170170
171- // Scale values from `cx ` by `ca ` and add the result to `cy `:
172- caxpy ( cx .length , ca, cx , 1 , cy , 1 );
171+ // Scale values from `x ` by `alpha ` and add the result to `y `:
172+ caxpy ( x .length , alpha, x , 1 , y , 1 );
173173
174174// Print the results:
175- logEach ( ' (%s)*(%s) + (%s) = %s' , ca, cx, cyc, cy );
175+ logEach ( ' (%s)*(%s) + (%s) = %s' , alpha, x, yc, y );
176176```
177177
178178</section >
@@ -205,51 +205,51 @@ logEach( '(%s)*(%s) + (%s) = %s', ca, cx, cyc, cy );
205205#include " stdlib/blas/base/caxpy.h"
206206```
207207
208- #### c_caxpy( N, ca , \* CX, strideX, \* CY, strideY )
208+ #### c_caxpy( N, alpha , \* CX, strideX, \* CY, strideY )
209209
210- Scales values from ` cx ` by ` ca ` and adds the result to ` cy ` .
210+ Scales values from ` x ` by ` alpha ` and adds the result to ` y ` .
211211
212212``` c
213213#include " stdlib/complex/float32/ctor.h"
214214
215- float cx [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
216- float cy [ ] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f };
217- const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f );
215+ float x [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
216+ float y [ ] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f };
217+ const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f );
218218
219- c_caxpy ( 4, ca , (void * )cx , 1, (void * )cy , 1 );
219+ c_caxpy ( 4, alpha , (void * )x , 1, (void * )y , 1 );
220220```
221221
222222The function accepts the following arguments:
223223
224224- **N**: `[in] CBLAS_INT` number of indexed elements.
225- - **ca **: `[in] stdlib_complex64_t` scalar constant.
225+ - **alpha **: `[in] stdlib_complex64_t` scalar constant.
226226- **CX**: `[in] void*` input array.
227227- **strideX**: `[in] CBLAS_INT` index increment for `CX`.
228228- **CY**: `[inout] void*` output array.
229229- **strideY**: `[in] CBLAS_INT` index increment for `CY`.
230230
231231```c
232- void c_caxpy( const CBLAS_INT N, const stdlib_complex64_t ca , const void *CX, const CBLAS_INT strideX, void *CY, const CBLAS_INT strideY );
232+ void c_caxpy( const CBLAS_INT N, const stdlib_complex64_t alpha , const void *CX, const CBLAS_INT strideX, void *CY, const CBLAS_INT strideY );
233233```
234234
235- #### c_caxpy_ndarray( N, ca , \* CX, strideX, offsetX, \* CY, strideY, offsetY )
235+ #### c_caxpy_ndarray( N, alpha , \* CX, strideX, offsetX, \* CY, strideY, offsetY )
236236
237- Scales values from ` cx ` by ` ca ` and adds the result to ` cy ` using alternative indexing semantics.
237+ Scales values from ` x ` by ` alpha ` and adds the result to ` y ` using alternative indexing semantics.
238238
239239``` c
240240#include " stdlib/complex/float32/ctor.h"
241241
242- float cx [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
243- float cy [ ] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f }
244- const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f );
242+ float x [] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
243+ float y [ ] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f }
244+ const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f );
245245
246- c_caxpy_ndarray ( 4, ca , (void * )cx , 1, 0, (void * )cy , 1, 0 );
246+ c_caxpy_ndarray ( 4, alpha , (void * )x , 1, 0, (void * )y , 1, 0 );
247247```
248248
249249The function accepts the following arguments:
250250
251251- **N**: `[in] CBLAS_INT` number of indexed elements.
252- - **ca **: `[in] stdlib_complex64_t` scalar constant.
252+ - **alpha **: `[in] stdlib_complex64_t` scalar constant.
253253- **CX**: `[in] void*` input array.
254254- **strideX**: `[in] CBLAS_INT` index increment for `CX`.
255255- **offsetX**: `[in] CBLAS_INT` starting index for `CX`.
@@ -258,7 +258,7 @@ The function accepts the following arguments:
258258- **offsetY**: `[in] CBLAS_INT` starting index for `CY`.
259259
260260```c
261- void c_caxpy_ndarray( const CBLAS_INT N, const stdlib_complex64_t ca , const void *CX, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *CY, const CBLAS_INT strideY, const CBLAS_INT offsetY );
261+ void c_caxpy_ndarray( const CBLAS_INT N, const stdlib_complex64_t alpha , const void *CX, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *CY, const CBLAS_INT strideY, const CBLAS_INT offsetY );
262262```
263263
264264</section >
@@ -286,11 +286,11 @@ void c_caxpy_ndarray( const CBLAS_INT N, const stdlib_complex64_t ca, const void
286286
287287int main ( void ) {
288288 // Create strided arrays of interleaved real and imaginary components...
289- float cx [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
290- float cy [ ] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f };
289+ float x [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
290+ float y [ ] = { -1.0f, -2.0f, -3.0f, -4.0f, -5.0f, -6.0f, -7.0f, -8.0f };
291291
292292 // Create a complex scalar:
293- const stdlib_complex64_t ca = stdlib_complex64( 2.0f, 2.0f );
293+ const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f );
294294
295295 // Specify the number of elements:
296296 const int N = 4;
@@ -299,20 +299,20 @@ int main( void ) {
299299 const int strideX = 1;
300300 const int strideY = 1;
301301
302- // Scale values from `cx ` by `ca ` and adds the result to `cy `:
303- c_caxpy( N, ca , (void *)cx , strideX, (void *)cy , strideY );
302+ // Scale values from `x ` by `alpha ` and adds the result to `y `:
303+ c_caxpy( N, alpha , (void *)x , strideX, (void *)y , strideY );
304304
305305 // Print the result:
306306 for ( int i = 0; i < N; i++ ) {
307- printf( "cy [ %i ] = %f + %fj\n", i, cy [ i*2 ], cy [ (i*2)+1 ] );
307+ printf( "y [ %i ] = %f + %fj\n", i, y [ i*2 ], y [ (i*2)+1 ] );
308308 }
309309
310- // Scales values from `cx ` by `ca ` and adds the result to `cy ` using alternative indexing semantics:
311- c_caxpy_ndarray( N, ca , (void *)cx , -strideX, 3, (void *)cy , -strideY, 3 );
310+ // Scales values from `x ` by `alpha ` and adds the result to `y ` using alternative indexing semantics:
311+ c_caxpy_ndarray( N, alpha , (void *)x , -strideX, 3, (void *)y , -strideY, 3 );
312312
313313 // Print the result:
314314 for ( int i = 0; i < N; i++ ) {
315- printf( "cy [ %i ] = %f + %fj\n", i, cy [ i*2 ], cy [ (i*2)+1 ] );
315+ printf( "y [ %i ] = %f + %fj\n", i, y [ i*2 ], y [ (i*2)+1 ] );
316316 }
317317}
318318```
0 commit comments