Skip to content
Draft
Prev Previous commit
Next Next commit
chore: update implementation
  • Loading branch information
ShabiShett07 committed Jun 13, 2025
commit 2a06c82f170a8c5d3298194426ac47b5ea7a621f
77 changes: 13 additions & 64 deletions lib/node_modules/@stdlib/blas/base/cdotc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

# cdotc

> Calculate the dot product of two single-precision complex vectors.
> Calculate the dot product `x^H * y` of `x` and `y`.

<section class="intro">

Expand All @@ -40,25 +40,17 @@ var cdotc = require( '@stdlib/blas/base/cdotc' );

#### cdotc( N, x, strideX, y, strideY )

Calculates the dot product of complex vectors `x` and `y`.
Calculates the dot product `x^H * y` of `x` and `y`.

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );

var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] );
var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] );

var out = cdotc( x.length, x, 1, y, 1 );
// returns <Complex64>

var re = realf( out );
// returns 54

var im = imagf( out );
// returns -80
// returns <Complex64>[ 54.0, -80.0 ]
```

The function has the following parameters:
Expand All @@ -74,43 +66,27 @@ The `N` and stride parameters determine which elements in the strided arrays are
```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );

var x = new Complex64Array( [ -1.0, -9.0, 2.0, -8.0 ] );
var y = new Complex64Array( [ -5.0, 1.0, -6.0, 7.0 ] );

var out = cdotc( x.length, x, 1, y, -1 );
// returns <Complex64>

var re = realf( out );
// returns -75

var im = imagf( out );
// returns -99
// returns <Complex64>[ -75.0, -99.0 ]
```

#### cdotc.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )

Calculates the dot product of `x` and `y` using alternative indexing semantics.
Calculates the dot product `x^H * y` of `x` and `y` using alternative indexing semantics.

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );

var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] );
var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] );

var out = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 );
// returns <Complex64>

var re = realf( out );
// returns 54

var im = imagf( out );
// returns -80
// returns <Complex64>[ 54.0, -80.0 ]
```

The function has the following additional parameters:
Expand All @@ -123,20 +99,12 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the
```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );

var x = new Complex64Array( [ 7.0, -8.0, -1.0, -9.0 ] );
var y = new Complex64Array( [ 6.0, -6.0, -9.0, 5.0 ] );

var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 );
// returns <Complex64>

var re = realf( out );
// returns -55

var im = imagf( out );
// returns 23
// returns <Complex64>[ -55.0, 23.0 ]
```

</section>
Expand Down Expand Up @@ -170,14 +138,14 @@ function rand() {
return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) );
}

var cx = filledarrayBy( 10, 'complex64', rand );
console.log( cx.toString() );
var x = filledarrayBy( 10, 'complex64', rand );
console.log( x.toString() );

var cy = filledarrayBy( 10, 'complex64', rand );
console.log( cy.toString() );
var y = filledarrayBy( 10, 'complex64', rand );
console.log( y.toString() );

// Perform dot product of cx and cy
var out = cdotc.ndarray( cx.length, cx, 1, 0, cy, -1, cy.length-1 );
// Perform dot product of x and y
var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 );
console.log( out );
```

Expand All @@ -189,15 +157,6 @@ console.log( out );

<section class="related">

* * *

## See Also

- <span class="package-name">[`@stdlib/blas/base/zdotc`][@stdlib/blas/base/zdotc]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two double-precision complex vectors.</span>
- <span class="package-name">[`@stdlib/blas/base/cdotu`][@stdlib/blas/base/cdotu]</span><span class="delimiter">: </span><span class="description">calculate the dot product without conjugate of x of two single-precision complex vectors.</span>
- <span class="package-name">[`@stdlib/blas/base/zdotu`][@stdlib/blas/base/zdotu]</span><span class="delimiter">: </span><span class="description">calculate the dot product without conjugate of x of two double-precision complex vectors.</span>
- <span class="package-name">[`@stdlib/blas/cdotc`][@stdlib/blas/cdotc]</span><span class="delimiter">: </span><span class="description">calculate the dot product of two single-precision comple vectors.</span>

</section>

<!-- /.related -->
Expand All @@ -216,16 +175,6 @@ console.log( out );

[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray

<!-- <related-links> -->

[@stdlib/blas/base/zdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotc

[@stdlib/blas/base/cdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/cdotu

[@stdlib/blas/base/zdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotu

[@stdlib/blas/cdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/cdotc

<!-- </related-links> -->

</section>
Expand Down
15 changes: 7 additions & 8 deletions lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var pow = require( '@stdlib/math/base/special/pow' );
var Complex64Array = require( '@stdlib/array/complex64' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );
var pkg = require( './../package.json' ).name;
var cdotc = require( './../lib/cdotc.js' );

Expand All @@ -48,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 @@ -68,13 +67,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = cdotc( cx.length, cx, 1, cy, 1 );
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
out = cdotc( x.length, x, 1, y, 1 );
if ( isnanf( realf( out ) ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
if ( isnanf( realf( out ) ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var pow = require( '@stdlib/math/base/special/pow' );
var Complex64Array = require( '@stdlib/array/complex64' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );
var pkg = require( './../package.json' ).name;
var cdotc = require( './../lib/ndarray.js' );

Expand All @@ -48,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 @@ -68,13 +67,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
out = cdotc( cx.length, cx, 1, 0, cy, 1, 0 );
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
out = cdotc( x.length, x, 1, 0, y, 1, 0 );
if ( isnanf( realf( out ) ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
if ( isnanf( realf( out ) ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
39 changes: 12 additions & 27 deletions lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,22 @@

Returns
-------
out: Complex64
z: Complex64
The dot product.

Examples
--------
// Standard usage:
> var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] );
> var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] );
> var out = {{alias}}( x.length, x, 1, y, 1 );
> var re = {{alias:@stdlib/complex/float32/real}}( out )
54
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
-80
> var z = {{alias}}( x.length, x, 1, y, 1 );
<Complex128>[ 54.0, -80.0 ]

// Strides:
> x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] );
> y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] );
> out = {{alias}}( 2, x, 2, y, 1 );
> var re = {{alias:@stdlib/complex/float32/real}}( out )
54
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
-80
> z = {{alias}}( 2, x, 2, y, 1 );
<Complex128>[ 54.0, -80.0 ]


{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY )
Expand Down Expand Up @@ -85,37 +79,28 @@

Returns
-------
out: Complex64
z: Complex64
The dot product.

Examples
--------
// Standard usage:
> var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] );
> var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] );
> var out = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 );
> var re = {{alias:@stdlib/complex/float32/real}}( out )
54
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
-80
> var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 );
<Complex128>[ 54.0, -80.0 ]

// Strides:
> x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] );
> y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] );
> out = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 );
> var re = {{alias:@stdlib/complex/float32/real}}( out )
54
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
-80
> z = {{alias}}.ndarray( 2, x, 2, 0, y, 1, 0 );
<Complex128>[ 54.0, -80.0 ]

// Using offset indices:
> x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] );
> y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] );
> out = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 );
> var re = {{alias:@stdlib/complex/float32/real}}( out )
61
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
-72
> z = {{alias}}.ndarray( 2, x, -2, x.length-1, y, 1, 1 );
<Complex128>[ 54.0, -80.0 ]

See Also
--------
Expand Down
18 changes: 9 additions & 9 deletions lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import { Complex64Array } from '@stdlib/types/array';
/**
* Interface describing `cdotc`.
*/
interface Routine {
interface Rzine {
/**
* Computes the dot product of two single-precision complex vectors.
* Computes the dot product `x^H * y` of `x` and `y`.
*
* @param N - number of indexed elements
* @param x - first input complex array
Expand All @@ -43,12 +43,12 @@ interface Routine {
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
*
* var z = cdotc( x.length, x, 1, y, 1 );
* // returns <Complex64>
* // returns <Complex64>[ 54.0, -80.0 ]
*/
( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64;

/**
* Computes the dot product of `x` and `y` using alternative indexing semantics.
* Computes the dot product `x^H * y` of `x` and `y` using alternative indexing semantics.
*
* @param N - number of indexed elements
* @param x - first input array
Expand All @@ -66,13 +66,13 @@ interface Routine {
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
*
* var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 );
* // returns <Complex64>
* // returns <Complex64>[ 54.0, -80.0 ]
*/
ndarray( N: number, x: Complex64Array, strideX: number, offsetX: number, y: Complex64Array, strideY: number, offsetY: number ): Complex64;
}

/**
* Computes the dot product of `x` and `y`.
* Computes the dot product `x^H * y` of `x` and `y`.
*
* @param N - number of indexed elements
* @param x - first input array
Expand All @@ -88,7 +88,7 @@ interface Routine {
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
*
* var z = cdotc( x.length, x, 1, y, 1 );
* // returns <Complex64>
* // returns <Complex64>[ 54.0, -80.0 ]
*
* @example
* var Complex64Array = require( '@stdlib/array/complex64' );
Expand All @@ -97,9 +97,9 @@ interface Routine {
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
*
* var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 );
* // returns <Complex64>
* // returns <Complex64>[ 54.0, -80.0 ]
*/
declare var cdotc: Routine;
declare var cdotc: Rzine;


// EXPORTS //
Expand Down
Loading
Loading