Skip to content

docs: change variable naming in blas/base/csrot #6822

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

#### csrot( N, cx, strideX, cy, strideY, c, s )
#### csrot( N, x, strideX, y, strideY, c, s )

Applies a plane rotation.

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );

var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var cy = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

csrot( cx.length, cx, 1, cy, 1, 0.8, 0.6 );
// cx => <Complex64Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8, ~5.6, ~6.4 ]
// cy => <Complex64Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6, ~-4.2, ~-4.8 ]
csrot( x.length, x, 1, y, 1, 0.8, 0.6 );
// x => <Complex64Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8, ~5.6, ~6.4 ]
// y => <Complex64Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6, ~-4.2, ~-4.8 ]
```

The function has the following parameters:

- **N**: number of indexed elements.
- **cx**: first input [`Complex64Array`][@stdlib/array/complex64].
- **strideX**: index increment for `cx`.
- **cy**: second input [`Complex64Array`][@stdlib/array/complex64].
- **strideY**: index increment for `cy`.
- **x**: first input [`Complex64Array`][@stdlib/array/complex64].
- **strideX**: index increment for `x`.
- **y**: second input [`Complex64Array`][@stdlib/array/complex64].
- **strideY**: index increment for `y`.

The `N` and stride parameters determine how values from `cx` and `cy` are accessed at runtime. For example, to apply a plane rotation to every other element,
The `N` and stride parameters determine how values from `x` and `y` are accessed at runtime. For example, to apply a plane rotation to every other element,

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );

var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var cy = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

csrot( 2, cx, 2, cy, 2, 0.8, 0.6 );
// cx => <Complex64Array>[ ~0.8, ~1.6, 3.0, 4.0, 4.0, ~4.8, 7.0, 8.0 ]
// cy => <Complex64Array>[ ~-0.6, ~-1.2, 0.0, 0.0, -3.0, ~-3.6, 0.0, 0.0 ]
csrot( 2, x, 2, y, 2, 0.8, 0.6 );
// x => <Complex64Array>[ ~0.8, ~1.6, 3.0, 4.0, 4.0, ~4.8, 7.0, 8.0 ]
// y => <Complex64Array>[ ~-0.6, ~-1.2, 0.0, 0.0, -3.0, ~-3.6, 0.0, 0.0 ]
```

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

// Initial arrays...
var cx0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var cy0 = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var x0 = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var y0 = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

// Create offset views...
var cx1 = new Complex64Array( cx0.buffer, cx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var cy1 = new Complex64Array( cy0.buffer, cy0.BYTES_PER_ELEMENT*2 ); // start at 3rd element
var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element

csrot( 2, cx1, -2, cy1, 1, 0.8, 0.6 );
// cx0 => <Complex64Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
// cy0 => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, ~-4.2, ~-4.8, ~-1.8, ~-2.4 ]
csrot( 2, x1, -2, y1, 1, 0.8, 0.6 );
// x0 => <Complex64Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
// y0 => <Complex64Array>[ 0.0, 0.0, 0.0, 0.0, ~-4.2, ~-4.8, ~-1.8, ~-2.4 ]
```

#### csrot.ndarray( N, cx, strideX, offsetX, cy, strideY, offsetY, c, s )
#### csrot.ndarray( N, x, strideX, offsetX, y, strideY, offsetY, c, s )

Applies a plane rotation using alternative indexing semantics.

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );

var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var cy = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

csrot.ndarray( cx.length, cx, 1, 0, cy, 1, 0, 0.8, 0.6 );
// cx => <Complex64Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8 ]
// cy => <Complex64Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6 ]
csrot.ndarray( x.length, x, 1, 0, y, 1, 0, 0.8, 0.6 );
// x => <Complex64Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8 ]
// y => <Complex64Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6 ]
```

The function has the following additional parameters:

- **offsetX**: starting index for `cx`.
- **offsetY**: starting index for `cy`.
- **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 apply a plane rotation to every other element starting from the second element,

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );

var cx = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var cy = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
var y = new Complex64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );

csrot.ndarray( 2, cx, 2, 1, cy, 2, 1, 0.8, 0.6 );
// cx => <Complex64Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
// cy => <Complex64Array>[ 0.0, 0.0, ~-1.8, ~-2.4, 0.0, 0.0, ~-4.2, ~-4.8 ]
csrot.ndarray( 2, x, 2, 1, y, 2, 1, 0.8, 0.6 );
// x => <Complex64Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
// y => <Complex64Array>[ 0.0, 0.0, ~-1.8, ~-2.4, 0.0, 0.0, ~-4.2, ~-4.8 ]
```

</section>
Expand All @@ -127,7 +127,7 @@ csrot.ndarray( 2, cx, 2, 1, cy, 2, 1, 0.8, 0.6 );

## Notes

- If `N <= 0`, both functions leave `cx` and `cy` unchanged.
- If `N <= 0`, both functions leave `x` and `y` unchanged.
- `csrot()` corresponds to the [BLAS][blas] level 1 function [`csrot`][csrot].

</section>
Expand All @@ -154,17 +154,17 @@ function rand() {
}

// Generate random input arrays:
var cx = filledarrayBy( 10, 'complex64', rand );
var cxc = ccopy( cx.length, cx, 1, zeros( cx.length, 'complex64' ), 1 );
var x = filledarrayBy( 10, 'complex64', rand );
var xc = ccopy( x.length, x, 1, zeros( x.length, 'complex64' ), 1 );

var cy = filledarrayBy( 10, 'complex64', rand );
var cyc = ccopy( cy.length, cy, 1, zeros( cy.length, 'complex64' ), 1 );
var y = filledarrayBy( 10, 'complex64', rand );
var yc = ccopy( y.length, y, 1, zeros( y.length, 'complex64' ), 1 );

// Apply a plane rotation:
csrot( cx.length, cx, 1, cy, 1, 0.8, 0.6 );
csrot( x.length, x, 1, y, 1, 0.8, 0.6 );

// Print the results:
logEach( '(%s,%s) => (%s,%s)', cxc, cyc, cx, cy );
logEach( '(%s,%s) => (%s,%s)', xc, yc, x, y );
```

</section>
Expand Down Expand Up @@ -211,15 +211,15 @@ c_csrot( 2, (void *)x, 1, (void *)y, 1, 0.8f, 0.6f );
The function accepts the following arguments:

- **N**: `[in] CBLAS_INT` number of indexed elements.
- **CX**: `[inout] void*` first input array.
- **strideX**: `[in] CBLAS_INT` index increment for `CX`.
- **CY**: `[inout] void*` second input array.
- **strideY**: `[in] CBLAS_INT` index increment for `CY`.
- **X**: `[inout] void*` first input array.
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
- **Y**: `[inout] void*` second input array.
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
- **c**: `[in] float` cosine of the angle of rotation.
- **s**: `[in] float` sine of the angle of rotation.

```c
void c_csrot( const CBLAS_INT N, void *CX, const CBLAS_INT strideX, void *CY, const CBLAS_INT strideY, const float c, const float s );
void c_csrot( const CBLAS_INT N, void *X, const CBLAS_INT strideX, void *Y, const CBLAS_INT strideY, const float c, const float s );
```

#### c_csrot_ndarray( N, \*X, strideX, offsetX, \*Y, strideY, offsetY, c, s )
Expand All @@ -236,17 +236,17 @@ c_csrot_ndarray( 2, (void *)x, 1, 0, (void *)y, 1, 0, 0.8f, 0.6f );
The function accepts the following arguments:

- **N**: `[in] CBLAS_INT` number of indexed elements.
- **CX**: `[inout] void*` first input array.
- **strideX**: `[in] CBLAS_INT` index increment for `CX`.
- **offsetX**: `[in] CBLAS_INT` starting index for `CX`.
- **CY**: `[inout] void*` second input array.
- **strideY**: `[in] CBLAS_INT` index increment for `CY`.
- **offsetY**: `[in] CBLAS_INT` starting index for `CY`.
- **X**: `[inout] void*` first input array.
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
- **Y**: `[inout] void*` second input array.
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
- **c**: `[in] float` cosine of the angle of rotation.
- **s**: `[in] float` sine of the angle of rotation.

```c
void c_csrot_ndarray( const CBLAS_INT N, void *CX, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *CY, const CBLAS_INT strideY, const CBLAS_INT offsetY, const float c, const float s );
void c_csrot_ndarray( const CBLAS_INT N, void *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY, const float c, const float s );
```

</section>
Expand Down
12 changes: 6 additions & 6 deletions lib/node_modules/@stdlib/blas/base/csrot/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var cx;
var cy;
var x;
var y;

cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );

return benchmark;

Expand All @@ -65,10 +65,10 @@ function createBenchmark( len ) {
var viewX;
var i;

viewX = reinterpret( cx, 0 );
viewX = reinterpret( x, 0 );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
csrot( cx.length, cx, 1, cy, 1, 0.8, 0.6 );
csrot( x.length, x, 1, y, 1, 0.8, 0.6 );
if ( isnanf( viewX[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var cx;
var cy;
var x;
var y;

cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );

return benchmark;

Expand All @@ -70,10 +70,10 @@ function createBenchmark( len ) {
var viewX;
var i;

viewX = reinterpret( cx, 0 );
viewX = reinterpret( x, 0 );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
csrot( cx.length, cx, 1, cy, 1, 0.8, 0.6 );
csrot( x.length, x, 1, y, 1, 0.8, 0.6 );
if ( isnanf( viewX[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var cx;
var cy;
var x;
var y;

cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );

return benchmark;

Expand All @@ -65,10 +65,10 @@ function createBenchmark( len ) {
var viewX;
var i;

viewX = reinterpret( cx, 0 );
viewX = reinterpret( x, 0 );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
csrot( cx.length, cx, 1, 0, cy, 1, 0, 0.8, 0.6 );
csrot( x.length, x, 1, 0, y, 1, 0, 0.8, 0.6 );
if ( isnanf( viewX[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var cx;
var cy;
var x;
var y;

cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );

return benchmark;

Expand All @@ -70,10 +70,10 @@ function createBenchmark( len ) {
var viewX;
var i;

viewX = reinterpret( cx, 0 );
viewX = reinterpret( x, 0 );
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
csrot( cx.length, cx, 1, 0, cy, 1, 0, 0.8, 0.6 );
csrot( x.length, x, 1, 0, y, 1, 0, 0.8, 0.6 );
if ( isnanf( viewX[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ double precision function benchmark( iterations, len )
! ..
! External functions:
interface
subroutine csrot( N, cx, strideX, cy, strideY, c, s )
complex :: cx(*), cy(*)
subroutine csrot( N, x, strideX, y, strideY, c, s )
complex :: x(*), y(*)
integer :: strideX, strideY, N
real :: c, s
end subroutine csrot
Expand Down Expand Up @@ -208,4 +208,4 @@ subroutine main()
end do
call print_summary( count, count )
end subroutine main
end program bench
end program bench
Loading