Skip to content

docs: change variable naming in blas/base/zdscal #6790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions lib/node_modules/@stdlib/blas/base/zdscal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,35 @@ limitations under the License.
var zdscal = require( '@stdlib/blas/base/zdscal' );
```

#### zdscal( N, da, zx, strideZX )
#### zdscal( N, alpha, x, strideX )

Scales a double-precision complex floating-point vector by a double-precision floating-point constant.

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );

var zx = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
var x = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );

zdscal( 3, 2.0, zx, 1 );
// zx => <Complex128Array>[ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 ]
zdscal( 3, 2.0, x, 1 );
// x => <Complex128Array>[ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 ]
```

The function has the following parameters:

- **N**: number of indexed elements.
- **da**: scalar constant.
- **zx**: input [`Complex128Array`][@stdlib/array/complex128].
- **strideZX**: stride length for `zx`.
- **alpha**: scalar constant.
- **x**: input [`Complex128Array`][@stdlib/array/complex128].
- **strideX**: stride length for `x`.

The `N` and stride parameters determine which elements in `zx` are scaled by `da`. For example, to scale every other element in `zx` by `da`,
The `N` and stride parameters determine which elements in `x` are scaled by `alpha`. For example, to scale every other element in `x` by `alpha`,

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );

var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );

zdscal( 2, 2.0, zx, 2 );
// zx => <Complex128Array>[ 2.0, 4.0, 3.0, 4.0, 10.0, 12.0, 7.0, 8.0 ]
zdscal( 2, 2.0, x, 2 );
// x => <Complex128Array>[ 2.0, 4.0, 3.0, 4.0, 10.0, 12.0, 7.0, 8.0 ]
```

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
Expand All @@ -69,42 +69,42 @@ Note that indexing is relative to the first index. To introduce an offset, use [
var Complex128Array = require( '@stdlib/array/complex128' );

// Initial array:
var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );

// Create an offset view:
var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

// Scale every element in `zx1`:
zdscal( 3, 2.0, zx1, 1 );
// zx0 => <Complex128Array>[ 1.0, 2.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0 ]
// Scale every element in `x1`:
zdscal( 3, 2.0, x1, 1 );
// x0 => <Complex128Array>[ 1.0, 2.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0 ]
```

#### zdscal.ndarray( N, da, zx, strideZX, offsetZX )
#### zdscal.ndarray( N, alpha, x, strideX, offsetX )

Scales a double-precision complex floating-point vector by a double-precision floating-point constant using alternative indexing semantics.

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );

var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );

zdscal.ndarray( 3, 2.0, zx, 1, 0 );
// zx => <Complex128Array>[ 2.0, 4.0, 6.0, 8.0, 10.0, 12.0 ]
zdscal.ndarray( 3, 2.0, x, 1, 0 );
// x => <Complex128Array>[ 2.0, 4.0, 6.0, 8.0, 10.0, 12.0 ]
```

The function has the following additional parameters:

- **offsetZX**: starting index for `zx`.
- **offsetX**: starting index for `x`.

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 element in the input strided array starting from the second element,

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );

var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );

zdscal.ndarray( 2, 2.0, zx, 2, 1 );
// zx => <Complex128Array>[ 1.0, 2.0, 6.0, 8.0, 5.0, 6.0, 14.0, 16.0 ]
zdscal.ndarray( 2, 2.0, x, 2, 1 );
// x => <Complex128Array>[ 1.0, 2.0, 6.0, 8.0, 5.0, 6.0, 14.0, 16.0 ]
```

</section>
Expand All @@ -115,7 +115,7 @@ zdscal.ndarray( 2, 2.0, zx, 2, 1 );

## Notes

- If `N <= 0`, both functions return `zx` unchanged.
- If `N <= 0`, both functions return `x` unchanged.
- `zdscal()` corresponds to the [BLAS][blas] level 1 function [`zdscal`][zdscal].

</section>
Expand All @@ -138,11 +138,11 @@ function rand() {
return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) );
}

var zx = filledarrayBy( 10, 'complex128', rand );
console.log( zx.toString() );
var x = filledarrayBy( 10, 'complex128', rand );
console.log( x.toString() );

zdscal( zx.length, 2.0, zx, 1 );
console.log( zx.toString() );
zdscal( x.length, 2.0, x, 1 );
console.log( x.toString() );
```

</section>
Expand Down
14 changes: 7 additions & 7 deletions lib/node_modules/@stdlib/blas/base/zdscal/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var zxbuf;
var zx;
var xbuf;
var x;

zxbuf = uniform( len*2, -100.0, 100.0, options );
zx = new Complex128Array( zxbuf.buffer );
xbuf = uniform( len*2, -100.0, 100.0, options );
x = new Complex128Array( xbuf.buffer );

return benchmark;

Expand All @@ -65,13 +65,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zdscal( zx.length, 2.0, zx, 1 );
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
zdscal( x.length, 2.0, x, 1 );
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var zxbuf;
var zx;
var xbuf;
var x;

zxbuf = uniform( len*2, -100.0, 100.0, options );
zx = new Complex128Array( zxbuf.buffer );
xbuf = uniform( len*2, -100.0, 100.0, options );
x = new Complex128Array( xbuf.buffer );

return benchmark;

Expand All @@ -65,13 +65,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zdscal( zx.length, 2.0, zx, 1, 0 );
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
zdscal( x.length, 2.0, x, 1, 0 );
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
58 changes: 29 additions & 29 deletions lib/node_modules/@stdlib/blas/base/zdscal/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@

{{alias}}( N, da, zx, strideZX )
{{alias}}( N, alpha, x, strideX )
Scales a double-precision complex floating-point vector by a double-
precision floating-point constant.

The `N` and stride parameters determine which elements in `zx` are scaled by
`da`.
The `N` and stride parameters determine which elements in `x` are scaled by
`alpha`.

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 function returns `zx` unchanged.
If `N` is less than or equal to `0`, the function returns `x` unchanged.


Parameters
----------
N: integer
Number of indexed elements.

da: double
alpha: double
Scalar constant.

zx: Complex128Array
x: Complex128Array
Input array.

strideZX: integer
Stride length for `zx`.
strideX: integer
Stride length for `x`.

Returns
-------
zx: Complex128Array
x: Complex128Array
Input array.

Examples
--------
// Standard usage:
> var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> {{alias}}( 2, 2.0, zx, 1 )
> var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> {{alias}}( 2, 2.0, x, 1 )
<Complex128Array>[ 2.0, 4.0, 6.0, 8.0 ]

// N and stride parameters:
> zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> {{alias}}( 2, 2.0, zx, 2 )
> x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> {{alias}}( 2, 2.0, x, 2 )
<Complex128Array>[ 2.0, 4.0, 3.0, 4.0, 10.0, 12.0 ]

// Using typed array views:
> var zx0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> var zx1 = new {{alias:@stdlib/array/complex128}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 );
> {{alias}}( 2, 2.0, zx1, 1 )
> var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
> {{alias}}( 2, 2.0, x1, 1 )
<Complex128Array>[ 6.0, 8.0, 10.0, 12.0 ]
> zx0
> x0
<Complex128Array>[ 1.0, 2.0, 6.0, 8.0, 10.0, 12.0 ]


{{alias}}.ndarray( N, da, zx, strideZX, offsetZX )
{{alias}}.ndarray( N, alpha, x, strideX, offsetX )
Scales a double-precision complex floating-point vector by a double-
precision floating-point constant using alternative indexing semantics.

Expand All @@ -65,33 +65,33 @@
N: integer
Number of indexed elements.

da: number
alpha: number
Scalar constant.

zx: Complex128Array
x: Complex128Array
Input array.

strideZX: integer
Stride length for `zx`.
strideX: integer
Stride length for `x`.

offsetZX: integer
Starting index for `zx`.
offsetX: integer
Starting index for `x`.

Returns
-------
zx: Complex128Array
x: Complex128Array
Input array.

Examples
--------
// Standard usage:
> var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> {{alias}}.ndarray( 2, 2.0, zx, 1, 0 )
> var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> {{alias}}.ndarray( 2, 2.0, x, 1, 0 )
<Complex128Array>[ 2.0, 4.0, 6.0, 8.0 ]

// Advanced indexing:
> zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
> {{alias}}.ndarray( 2, 2.0, zx, 1, 2 )
> x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
> {{alias}}.ndarray( 2, 2.0, x, 1, 2 )
<Complex128Array>[ 1.0, 2.0, 3.0, 4.0, 10.0, 12.0, 14.0, 16.0 ]

See Also
Expand Down
Loading