Skip to content

docs: change variable naming in blas/base/zaxpy #6815

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
96 changes: 48 additions & 48 deletions lib/node_modules/@stdlib/blas/base/zaxpy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,43 @@ limitations under the License.
var zaxpy = require( '@stdlib/blas/base/zaxpy' );
```

#### zaxpy( N, za, zx, strideX, zy, strideY )
#### zaxpy( N, alpha, x, strideX, y, strideY )

Scales values from `zx` by `za` and adds the result to `zy`.
Scales values from `x` by `alpha` and adds the result to `y`.

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
var za = new Complex128( 2.0, 2.0 );
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
var alpha = new Complex128( 2.0, 2.0 );

zaxpy( 3, za, zx, 1, zy, 1 );
// zy => <Complex128Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
zaxpy( 3, alpha, x, 1, y, 1 );
// y => <Complex128Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
```

The function has the following parameters:

- **N**: number of indexed elements.
- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant.
- **zx**: first input [`Complex128Array`][@stdlib/array/complex128].
- **strideX**: index increment for `zx`.
- **zy**: second input [`Complex128Array`][@stdlib/array/complex128].
- **strideY**: index increment for `zy`.
- **alpha**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant.
- **x**: first input [`Complex128Array`][@stdlib/array/complex128].
- **strideX**: index increment for `x`.
- **y**: second input [`Complex128Array`][@stdlib/array/complex128].
- **strideY**: index increment for `y`.

The `N` and stride parameters determine how values from `zx` are scaled by `za` and added to `zy`. For example, to scale every other value in `zx` by `za` and add the result to every other value of `zy`,
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`,

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

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

zaxpy( 2, za, zx, 2, zy, 2 );
// zy => <Complex128Array>[ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0 ]
zaxpy( 2, alpha, x, 2, y, 2 );
// y => <Complex128Array>[ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0 ]
```

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

// Initial arrays...
var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var zy0 = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var y0 = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );

// Define a scalar constant:
var za = new Complex128( 2.0, 2.0 );
var alpha = new Complex128( 2.0, 2.0 );

// Create offset views...
var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var zy1 = new Complex128Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // start at 3rd element
var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element

// Scales values of `zx0` by `za` starting from second index and add the result to `zy0` starting from third index...
zaxpy( 2, za, zx1, 1, zy1, 1 );
// zy0 => <Complex128Array>[ 1.0, 1.0, 1.0, 1.0, -1.0, 15.0, -1.0, 23.0 ]
// Scales values of `x0` by `alpha` starting from second index and add the result to `y0` starting from third index...
zaxpy( 2, alpha, x1, 1, y1, 1 );
// y0 => <Complex128Array>[ 1.0, 1.0, 1.0, 1.0, -1.0, 15.0, -1.0, 23.0 ]
```

#### zaxpy.ndarray( N, za, zx, strideX, offsetX, zy, strideY, offsetY )
#### zaxpy.ndarray( N, alpha, x, strideX, offsetX, y, strideY, offsetY )

Scales values from `zx` by `za` and adds the result to `zy` using alternative indexing semantics.
Scales values from `x` by `alpha` and adds the result to `y` using alternative indexing semantics.

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
var za = new Complex128( 2.0, 2.0 );
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
var alpha = new Complex128( 2.0, 2.0 );

zaxpy.ndarray( 3, za, zx, 1, 0, zy, 1, 0 );
// zy => <Complex128Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
zaxpy.ndarray( 3, alpha, x, 1, 0, y, 1, 0 );
// y => <Complex128Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
```

The function has the following additional parameters:

- **offsetX**: starting index for `zx`.
- **offsetY**: starting index for `zy`.
- **offsetX**: starting index for `x`.
- **offsetY**: starting index for `y`.

While [`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,

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

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

zaxpy.ndarray( 3, za, zx, 1, 1, zy, 1, 1 );
// zy => <Complex128Array>[ 1.0, 1.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0 ]
zaxpy.ndarray( 3, alpha, x, 1, 1, y, 1, 1 );
// y => <Complex128Array>[ 1.0, 1.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0 ]
```

</section>
Expand All @@ -136,7 +136,7 @@ zaxpy.ndarray( 3, za, zx, 1, 1, zy, 1, 1 );

## Notes

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

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

var zx = filledarrayBy( 10, 'complex128', rand );
var zy = filledarrayBy( 10, 'complex128', rand );
var zyc = zcopy( zy.length, zy, 1, zeros( zy.length, 'complex128' ), 1 );
var x = filledarrayBy( 10, 'complex128', rand );
var y = filledarrayBy( 10, 'complex128', rand );
var yc = zcopy( y.length, y, 1, zeros( y.length, 'complex128' ), 1 );

var za = new Complex128( 2.0, 2.0 );
var alpha = new Complex128( 2.0, 2.0 );

// Scale values from `zx` by `za` and add the result to `zy`:
zaxpy( zx.length, za, zx, 1, zy, 1 );
// Scale values from `x` by `alpha` and add the result to `y`:
zaxpy( x.length, alpha, x, 1, y, 1 );

// Print the results:
logEach( '(%s)*(%s) + (%s) = %s', za, zx, zyc, zy );
logEach( '(%s)*(%s) + (%s) = %s', alpha, x, yc, y );
```

</section>
Expand Down
16 changes: 8 additions & 8 deletions lib/node_modules/@stdlib/blas/base/zaxpy/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ var options = {
*/
function createBenchmark( len ) {
var viewY;
var za;
var zx;
var zy;
var alpha;
var x;
var y;

zx = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );
zy = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );
x = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );
y = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );

viewY = reinterpret( zy, 0 );
viewY = reinterpret( y, 0 );

za = new Complex128( 1.0, 0.0 );
alpha = new Complex128( 1.0, 0.0 );

return benchmark;

Expand All @@ -73,7 +73,7 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zaxpy( zx.length, za, zx, 1, zy, 1 );
zaxpy( x.length, alpha, x, 1, y, 1 );
if ( isnan( viewY[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ var options = {
*/
function createBenchmark( len ) {
var viewY;
var za;
var zx;
var zy;
var alpha;
var x;
var y;

zx = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );
zy = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );
x = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );
y = new Complex128Array( uniform( len*2, -100.0, 100.0, options ) );

viewY = reinterpret( zy, 0 );
viewY = reinterpret( y, 0 );

za = new Complex128( 1.0, 0.0 );
alpha = new Complex128( 1.0, 0.0 );

return benchmark;

Expand All @@ -73,7 +73,7 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zaxpy( zx.length, za, zx, 1, 0, zy, 1, 0 );
zaxpy( x.length, alpha, x, 1, 0, y, 1, 0 );
if ( isnan( viewY[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
78 changes: 39 additions & 39 deletions lib/node_modules/@stdlib/blas/base/zaxpy/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@

{{alias}}( N, za, zx, strideX, zy, strideY )
{{alias}}( N, alpha, x, strideX, y, strideY )
Scales a double-precision complex floating-point vector by a double-
precision complex floating point constant and adds the result to a double-
precision complex floating-point vector.

The `N` and stride parameters determine how values from `zx` are scaled by
`za` and added to `zy`.
The `N` and stride parameters determine how values from `x` are scaled by
`alpha` and added to `y`.

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

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

za: Complex128
alpha: Complex128
Scalar constant.

zx: Complex128Array
x: Complex128Array
First input array.

strideX: integer
Index increment for `zx`.
Index increment for `x`.

zy: Complex128Array
y: Complex128Array
Second input array.

strideY: integer
Index increment for `zy`.
Index increment for `y`.

Returns
-------
zy: Complex128Array
y: Complex128Array
Second input array.

Examples
--------
// Standard usage:
> var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var zy = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0 ] );
> var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 );
> {{alias}}( 2, za, zx, 1, zy, 1 )
> var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var y = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0 ] );
> var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 );
> {{alias}}( 2, alpha, x, 1, y, 1 )
<Complex128Array>[ -1.0, 7.0, -1.0, 15.0 ]

// Advanced indexing:
> zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> zy = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
> {{alias}}( 2, za, zx, -2, zy, 1 )
> x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> y = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
> {{alias}}( 2, alpha, x, -2, y, 1 )
<Complex128Array>[ -1.0, 23.0, -1.0, 7.0, 1.0, 1.0 ]

// Using typed array views:
> var zx0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var zy0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0 ] );
> var zx1 = new {{alias:@stdlib/array/complex128}}( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 );
> var zy1 = new {{alias:@stdlib/array/complex128}}( zy0.buffer, zy0.BYTES_PER_ELEMENT*1 );
> {{alias}}( 1, za, zx1, 1, zy1, 1 )
> var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var y0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0 ] );
> var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
> var y1 = new {{alias:@stdlib/array/complex128}}( y0.buffer, y0.BYTES_PER_ELEMENT*1 );
> {{alias}}( 1, alpha, x1, 1, y1, 1 )
<Complex128Array>[ -1.0, 15.0 ]
> zy0
> y0
<Complex128Array>[ 1.0, 1.0, -1.0, 15.0 ]


{{alias}}.ndarray( N, za, zx, strideX, offsetX, zy, strideY, offsetY )
{{alias}}.ndarray( N, alpha, x, strideX, offsetX, y, strideY, offsetY )
Scales a double-precision complex floating-point vector by a double-
precision complex floating-point constant and adds the result to a double-
precision complex floating-point vector using alternative indexing
Expand All @@ -78,45 +78,45 @@
N: integer
Number of indexed elements.

za: Complex128
alpha: Complex128
Scalar constant.

zx: Complex128Array
x: Complex128Array
First input array.

strideX: integer
Index increment for `zx`.
Index increment for `x`.

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

zy: Complex128Array
y: Complex128Array
Second input array.

strideY: integer
Index increment for `zy`.
Index increment for `y`.

offsetY: integer
Starting index for `zy`.
Starting index for `y`.

Returns
-------
zy: Complex128Array
y: Complex128Array
Second input array.

Examples
--------
// Standard usage:
> var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var zy = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0 ] );
> var za = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 );
> {{alias}}.ndarray( zx.length, za, zx, 1, 0, zy, 1, 0 )
> var x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var y = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0 ] );
> var alpha = new {{alias:@stdlib/complex/float64/ctor}}( 2.0, 2.0 );
> {{alias}}.ndarray( x.length, alpha, x, 1, 0, y, 1, 0 )
<Complex128Array>[ -1.0, 7.0, -1.0, 15.0 ]

// Advanced indexing:
> zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> zy = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
> {{alias}}.ndarray( 2, za, zx, 1, 1, zy, 1, 1 )
> x = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
> y = new {{alias:@stdlib/array/complex128}}( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
> {{alias}}.ndarray( 2, alpha, x, 1, 1, y, 1, 1 )
<Complex128Array>[ 1.0, 1.0, -1.0, 15.0, -1.0, 23.0 ]

See Also
Expand Down
Loading