Skip to content

Commit 294bab1

Browse files
ShabiShett07kgryte
andauthored
docs: change variable naming in blas/base/cscal
PR-URL: #6881 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent 8082b9b commit 294bab1

29 files changed

+622
-622
lines changed

lib/node_modules/@stdlib/blas/base/cscal/README.md

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,39 @@ limitations under the License.
3030
var cscal = require( '@stdlib/blas/base/cscal' );
3131
```
3232

33-
#### cscal( N, ca, cx, strideX )
33+
#### cscal( N, alpha, x, strideX )
3434

35-
Scales values from `cx` by `ca`.
35+
Scales values from `x` by `alpha`.
3636

3737
```javascript
3838
var Complex64Array = require( '@stdlib/array/complex64' );
3939
var Complex64 = require( '@stdlib/complex/float32/ctor' );
4040

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 );
4343

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 ]
4646
```
4747

4848
The function has the following parameters:
4949

5050
- **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`.
5454

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`,
5656

5757
```javascript
5858
var Complex64Array = require( '@stdlib/array/complex64' );
5959
var Complex64 = require( '@stdlib/complex/float32/ctor' );
6060

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 );
6363

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 ]
6666
```
6767

6868
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' );
7474
var Complex64 = require( '@stdlib/complex/float32/ctor' );
7575

7676
// 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 ] );
7878

7979
// Define a scalar constant:
80-
var ca = new Complex64( 2.0, 2.0 );
80+
var alpha = new Complex64( 2.0, 2.0 );
8181

8282
// 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
8484

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 ]
8888
```
8989

90-
#### cscal.ndarray( N, ca, cx, strideX, offsetX )
90+
#### cscal.ndarray( N, alpha, x, strideX, offsetX )
9191

92-
Scales values from `cx` by `ca` using alternative indexing semantics.
92+
Scales values from `x` by `alpha` using alternative indexing semantics.
9393

9494
```javascript
9595
var Complex64Array = require( '@stdlib/array/complex64' );
9696
var Complex64 = require( '@stdlib/complex/float32/ctor' );
9797

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 );
100100

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 ]
103103
```
104104

105105
The function has the following additional parameters:
106106

107-
- **offsetX**: starting index for `cx`.
107+
- **offsetX**: starting index for `x`.
108108

109109
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,
110110

111111
```javascript
112112
var Complex64Array = require( '@stdlib/array/complex64' );
113113
var Complex64 = require( '@stdlib/complex/float32/ctor' );
114114

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 );
117117

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 ]
120120
```
121121

122122
</section>
@@ -127,7 +127,7 @@ cscal.ndarray( 2, ca, cx, 2, 1 );
127127

128128
## Notes
129129

130-
- If `N <= 0` or `strideX <= 0`, both functions return `cx` unchanged.
130+
- If `N <= 0` or `strideX <= 0`, both functions return `x` unchanged.
131131
- `cscal()` corresponds to the [BLAS][blas] level 1 function [`cscal`][cscal].
132132

133133
</section>
@@ -150,15 +150,15 @@ function rand() {
150150
return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) );
151151
}
152152

153-
var cx = filledarrayBy( 10, 'complex64', rand );
154-
console.log( cx.toString() );
153+
var x = filledarrayBy( 10, 'complex64', rand );
154+
console.log( x.toString() );
155155

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() );
158158

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() );
162162
```
163163

164164
</section>
@@ -191,53 +191,53 @@ console.log( cx.get( cx.length-1 ).toString() );
191191
#include "stdlib/blas/base/cscal.h"
192192
```
193193

194-
#### c_cscal( N, ca, \*CX, strideX )
194+
#### c_cscal( N, alpha, \*X, strideX )
195195

196-
Scales values from `CX` by `ca`.
196+
Scales values from `X` by `alpha`.
197197

198198
```c
199199
#include "stdlib/complex/float32/ctor.h"
200200

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 );
203203

204-
c_cscal( 4, ca, (void *)cx, 1 );
204+
c_cscal( 4, alpha, (void *)x, 1 );
205205
```
206206
207207
The function accepts the following arguments:
208208
209209
- **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`.
213213
214214
```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 );
216216
```
217217

218-
#### c_cscal_ndarray( N, ca, \*CX, strideX, offsetX )
218+
#### c_cscal_ndarray( N, alpha, \*X, strideX, offsetX )
219219

220-
Scales values from `CX` by `ca` using alternative indexing semantics.
220+
Scales values from `X` by `alpha` using alternative indexing semantics.
221221

222222
```c
223223
#include "stdlib/complex/float32/ctor.h"
224224

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 );
227227

228-
c_cscal( 4, ca, (void *)cx, 1, 0 );
228+
c_cscal( 4, alpha, (void *)x, 1, 0 );
229229
```
230230
231231
The function accepts the following arguments:
232232
233233
- **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`.
238238
239239
```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 );
241241
```
242242

243243
</section>
@@ -265,10 +265,10 @@ void c_cscal_ndarray( const CBLAS_INT N, const stdlib_complex64_t ca, void *CX,
265265

266266
int main( void ) {
267267
// 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 };
269269

270270
// 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 );
272272

273273
// Specify the number of elements:
274274
const int N = 4;
@@ -277,19 +277,19 @@ int main( void ) {
277277
const int strideX = 1;
278278

279279
// Scale the elements of the array:
280-
c_cscal( N, ca, (void *)cx, strideX );
280+
c_cscal( N, alpha, (void *)x, strideX );
281281

282282
// Print the result:
283283
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 ] );
285285
}
286286

287287
// 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 );
289289

290290
// Print the result:
291291
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 ] );
293293
}
294294
}
295295
```

lib/node_modules/@stdlib/blas/base/cscal/benchmark/benchmark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ var options = {
4747
* @returns {Function} benchmark function
4848
*/
4949
function createBenchmark( len ) {
50+
var alpha;
5051
var xbuf;
51-
var z;
5252
var x;
5353

5454
xbuf = uniform( len*2, -100.0, 100.0, options );
5555
x = new Complex64Array( xbuf.buffer );
5656

57-
z = new Complex64( 1.0, 0.0 );
57+
alpha = new Complex64( 1.0, 0.0 );
5858

5959
return benchmark;
6060

@@ -69,7 +69,7 @@ function createBenchmark( len ) {
6969

7070
b.tic();
7171
for ( i = 0; i < b.iterations; i++ ) {
72-
cscal( x.length, z, x, 1 );
72+
cscal( x.length, alpha, x, 1 );
7373
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
7474
b.fail( 'should not return NaN' );
7575
}

lib/node_modules/@stdlib/blas/base/cscal/benchmark/benchmark.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ var options = {
5252
* @returns {Function} benchmark function
5353
*/
5454
function createBenchmark( len ) {
55+
var alpha;
5556
var xbuf;
56-
var z;
5757
var x;
5858

5959
xbuf = uniform( len*2, -100.0, 100.0, options );
6060
x = new Complex64Array( xbuf.buffer );
6161

62-
z = new Complex64( 1.0, 0.0 );
62+
alpha = new Complex64( 1.0, 0.0 );
6363

6464
return benchmark;
6565

@@ -74,7 +74,7 @@ function createBenchmark( len ) {
7474

7575
b.tic();
7676
for ( i = 0; i < b.iterations; i++ ) {
77-
cscal( x.length, z, x, 1 );
77+
cscal( x.length, alpha, x, 1 );
7878
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
7979
b.fail( 'should not return NaN' );
8080
}

lib/node_modules/@stdlib/blas/base/cscal/benchmark/benchmark.ndarray.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ var options = {
4747
* @returns {Function} benchmark function
4848
*/
4949
function createBenchmark( len ) {
50+
var alpha;
5051
var xbuf;
51-
var z;
5252
var x;
5353

5454
xbuf = uniform( len*2, -100.0, 100.0, options );
5555
x = new Complex64Array( xbuf.buffer );
5656

57-
z = new Complex64( 1.0, 0.0 );
57+
alpha = new Complex64( 1.0, 0.0 );
5858

5959
return benchmark;
6060

@@ -69,7 +69,7 @@ function createBenchmark( len ) {
6969

7070
b.tic();
7171
for ( i = 0; i < b.iterations; i++ ) {
72-
cscal( x.length, z, x, 1, 0 );
72+
cscal( x.length, alpha, x, 1, 0 );
7373
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
7474
b.fail( 'should not return NaN' );
7575
}

lib/node_modules/@stdlib/blas/base/cscal/benchmark/benchmark.ndarray.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ var options = {
5252
* @returns {Function} benchmark function
5353
*/
5454
function createBenchmark( len ) {
55+
var alpha;
5556
var xbuf;
56-
var z;
5757
var x;
5858

5959
xbuf = uniform( len*2, -100.0, 100.0, options );
6060
x = new Complex64Array( xbuf.buffer );
6161

62-
z = new Complex64( 1.0, 0.0 );
62+
alpha = new Complex64( 1.0, 0.0 );
6363

6464
return benchmark;
6565

@@ -74,7 +74,7 @@ function createBenchmark( len ) {
7474

7575
b.tic();
7676
for ( i = 0; i < b.iterations; i++ ) {
77-
cscal( x.length, z, x, 1, 0 );
77+
cscal( x.length, alpha, x, 1, 0 );
7878
if ( isnanf( xbuf[ i%(len*2) ] ) ) {
7979
b.fail( 'should not return NaN' );
8080
}

0 commit comments

Comments
 (0)