Skip to content
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

docs: update examples for blas/base/wasm/zdrot #5805

Merged
merged 1 commit into from
Mar 10, 2025
Merged
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: 10 additions & 100 deletions lib/node_modules/@stdlib/blas/base/wasm/zdrot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,13 @@ Applies a plane rotation.

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

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

zdrot.main( zx.length, zx, 1, zy, 1, 0.8, 0.6 );

var z = zy.get( 0 );
// returns <Complex128>

var re = real( z );
// returns ~-0.6

var im = imag( z );
// returns ~-1.2

z = zx.get( 0 );
// returns <Complex128>

re = real( z );
// returns ~0.8

im = imag( z );
// returns ~1.6
// zx => <Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8, ~5.6, ~6.4 ]
// zy => <Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6, ~-4.2, ~-4.8 ]
```

The function has the following parameters:
Expand All @@ -77,31 +59,13 @@ The `N` and stride parameters determine how values in the strided arrays are acc

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

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

zdrot.main( 2, zx, 2, zy, 2, 0.8, 0.6 );

var z = zy.get( 0 );
// returns <Complex128>

var re = real( z );
// returns ~-0.6

var im = imag( z );
// returns ~-1.2

z = zx.get( 0 );
// returns <Complex128>

re = real( z );
// returns ~0.8

im = imag( z );
// returns ~1.6
// zx => <Complex128Array>[ ~0.8, ~1.6, 3.0, 4.0, 4.0, ~4.8, 7.0, 8.0 ]
// zy => <Complex128Array>[ ~-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 @@ -110,8 +74,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [

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

// Initial arrays...
var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
Expand All @@ -122,24 +84,8 @@ var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start a
var zy1 = new Complex128Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // start at 3rd element

zdrot.main( 2, zx1, -2, zy1, 1, 0.8, 0.6 );

var z = zy0.get( 2 );
// returns <Complex128>

var re = real( z );
// returns ~-4.2

var im = imag( z );
// returns ~-4.8

z = zx0.get( 3 );
// returns <Complex128>

re = real( z );
// returns ~5.6

im = imag( z );
// returns ~6.4
// zx0 => <Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
// zy0 => <Complex128Array>[ 0.0, 0.0, 0.0, 0.0, ~-4.2, ~-4.8, ~-1.8, ~-2.4 ]
```

#### zdrot.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY, c, s )
Expand All @@ -148,31 +94,13 @@ Applies a plane rotation using alternative indexing semantics.

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

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

zdrot.ndarray( zx.length, zx, 1, 0, zy, 1, 0, 0.8, 0.6 );

var z = zy.get( 0 );
// returns <Complex128>

var re = real( z );
// returns ~-0.6

var im = imag( z );
// returns ~-1.2

z = zx.get( 0 );
// returns <Complex128>

re = real( z );
// returns ~0.8

im = imag( z );
// returns ~1.6
// zx => <Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2, 4.0, ~4.8 ]
// zy => <Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4, -3.0, ~-3.6 ]
```

The function has the following additional parameters:
Expand All @@ -184,31 +112,13 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the

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

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

zdrot.ndarray( 2, zx, 2, 1, zy, 2, 1, 0.8, 0.6 );

var z = zy.get( 3 );
// returns <Complex128>

var re = real( z );
// returns ~-4.2

var im = imag( z );
// returns ~-4.8

z = zx.get( 1 );
// returns <Complex128>

re = real( z );
// returns ~2.4

im = imag( z );
// returns ~3.2
// zx => <Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0, ~5.6, ~6.4 ]
// zy => <Complex128Array>[ 0.0, 0.0, ~-1.8, ~-2.4, 0.0, 0.0, ~-4.2, ~-4.8 ]
```

* * *
Expand Down
70 changes: 20 additions & 50 deletions lib/node_modules/@stdlib/blas/base/wasm/zdrot/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,48 +44,30 @@
> var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var zy = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] );
> {{alias}}.main( zx.length, zx, 1, zy, 1, 0.8, 0.6 );
> var z = zy.get( 0 );
> var re = {{alias:@stdlib/complex/float64/real}}( z )
~-0.6
> var im = {{alias:@stdlib/complex/float64/imag}}( z )
~-1.2
> z = zx.get( 0 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~0.8
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~1.6
> zx
<Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2 ]
> zy
<Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4 ]

// Advanced indexing:
> zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
> zy = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
> {{alias}}.main( 2, zx, -2, zy, 1, 0.8, 0.6 );
> z = zy.get( 0 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~-3.0
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~-3.6
> z = zx.get( 2 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~4.0
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~4.8
> zx
<Complex128Array>[ ~0.8, ~1.6, 3.0, 4.0, 4.0, ~4.8, 7.0, 8.0 ]
> zy
<Complex128Array>[ -3.0, ~-3.6, ~-0.6, ~-1.2, 0.0, 0.0, 0.0, 0.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 zy0 = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.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*2 );
> {{alias}}.main( 1, zx1, 1, zy1, 1, 0.8, 0.6 );
> z = zy0.get( 2 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~-1.8
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~-2.4
> z = zx0.get( 1 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~2.4
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~3.2
> zx0
<Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0 ]
> zy0
<Complex128Array>[ 0.0, 0.0, 0.0, 0.0, ~-1.8, ~-2.4 ]


{{alias}}.ndarray( N, zx, strideX, offsetX, zy, strideY, offsetY, c, s )
Expand Down Expand Up @@ -135,31 +117,19 @@
> var zx = new {{alias:@stdlib/array/complex128}}( [ 1.0, 2.0, 3.0, 4.0 ] );
> var zy = new {{alias:@stdlib/array/complex128}}( [ 0.0, 0.0, 0.0, 0.0 ] );
> {{alias}}.ndarray( zx.length, zx, 1, 0, zy, 1, 0, 0.8, 0.6 );
> var z = zy.get( 0 );
> var re = {{alias:@stdlib/complex/float64/real}}( z )
~-0.6
> var im = {{alias:@stdlib/complex/float64/imag}}( z )
~-1.2
> z = zx.get( 0 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~0.8
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~1.6
> zx
<Complex128Array>[ ~0.8, ~1.6, ~2.4, ~3.2 ]
> zy
<Complex128Array>[ ~-0.6, ~-1.2, ~-1.8, ~-2.4 ]

// 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}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
> {{alias}}.ndarray( 1, zx, 2, 1, zy, 2, 1, 0.8, 0.6 );
> z = zy.get( 1 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~-1.8
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~-2.4
> z = zx.get( 1 );
> re = {{alias:@stdlib/complex/float64/real}}( z )
~2.4
> im = {{alias:@stdlib/complex/float64/imag}}( z )
~3.2
> zx
<Complex128Array>[ 1.0, 2.0, ~2.4, ~3.2, 5.0, 6.0 ]
> zy
<Complex128Array>[ 0.0, 0.0, ~-1.8, ~-2.4, 0.0, 0.0 ]


{{alias}}.Module( memory )
Expand Down
Loading