Skip to content

Commit 2a06c82

Browse files
committed
chore: update implementation
1 parent ff192a2 commit 2a06c82

File tree

11 files changed

+282
-196
lines changed

11 files changed

+282
-196
lines changed

lib/node_modules/@stdlib/blas/base/cdotc/README.md

Lines changed: 13 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# cdotc
2222

23-
> Calculate the dot product of two single-precision complex vectors.
23+
> Calculate the dot product `x^H * y` of `x` and `y`.
2424
2525
<section class="intro">
2626

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

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

43-
Calculates the dot product of complex vectors `x` and `y`.
43+
Calculates the dot product `x^H * y` of `x` and `y`.
4444

4545
```javascript
4646
var Complex64Array = require( '@stdlib/array/complex64' );
4747
var Complex64 = require( '@stdlib/complex/float32/ctor' );
48-
var realf = require( '@stdlib/complex/float32/real' );
49-
var imagf = require( '@stdlib/complex/float32/imag' );
5048

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

5452
var out = cdotc( x.length, x, 1, y, 1 );
55-
// returns <Complex64>
56-
57-
var re = realf( out );
58-
// returns 54
59-
60-
var im = imagf( out );
61-
// returns -80
53+
// returns <Complex64>[ 54.0, -80.0 ]
6254
```
6355

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

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

8373
var out = cdotc( x.length, x, 1, y, -1 );
84-
// returns <Complex64>
85-
86-
var re = realf( out );
87-
// returns -75
88-
89-
var im = imagf( out );
90-
// returns -99
74+
// returns <Complex64>[ -75.0, -99.0 ]
9175
```
9276

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

95-
Calculates the dot product of `x` and `y` using alternative indexing semantics.
79+
Calculates the dot product `x^H * y` of `x` and `y` using alternative indexing semantics.
9680

9781
```javascript
9882
var Complex64Array = require( '@stdlib/array/complex64' );
9983
var Complex64 = require( '@stdlib/complex/float32/ctor' );
100-
var realf = require( '@stdlib/complex/float32/real' );
101-
var imagf = require( '@stdlib/complex/float32/imag' );
10284

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

10688
var out = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 );
107-
// returns <Complex64>
108-
109-
var re = realf( out );
110-
// returns 54
111-
112-
var im = imagf( out );
113-
// returns -80
89+
// returns <Complex64>[ 54.0, -80.0 ]
11490
```
11591

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

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

132106
var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 );
133-
// returns <Complex64>
134-
135-
var re = realf( out );
136-
// returns -55
137-
138-
var im = imagf( out );
139-
// returns 23
107+
// returns <Complex64>[ -55.0, 23.0 ]
140108
```
141109

142110
</section>
@@ -170,14 +138,14 @@ function rand() {
170138
return new Complex64( discreteUniform( 0, 10 ), discreteUniform( 1, 5 ) );
171139
}
172140

173-
var cx = filledarrayBy( 10, 'complex64', rand );
174-
console.log( cx.toString() );
141+
var x = filledarrayBy( 10, 'complex64', rand );
142+
console.log( x.toString() );
175143

176-
var cy = filledarrayBy( 10, 'complex64', rand );
177-
console.log( cy.toString() );
144+
var y = filledarrayBy( 10, 'complex64', rand );
145+
console.log( y.toString() );
178146

179-
// Perform dot product of cx and cy
180-
var out = cdotc.ndarray( cx.length, cx, 1, 0, cy, -1, cy.length-1 );
147+
// Perform dot product of x and y
148+
var out = cdotc.ndarray( x.length, x, 1, 0, y, -1, y.length-1 );
181149
console.log( out );
182150
```
183151

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

190158
<section class="related">
191159

192-
* * *
193-
194-
## See Also
195-
196-
- <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>
197-
- <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>
198-
- <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>
199-
- <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>
200-
201160
</section>
202161

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

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

219-
<!-- <related-links> -->
220-
221-
[@stdlib/blas/base/zdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotc
222-
223-
[@stdlib/blas/base/cdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/cdotu
224-
225-
[@stdlib/blas/base/zdotu]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/zdotu
226-
227-
[@stdlib/blas/cdotc]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/cdotc
228-
229178
<!-- </related-links> -->
230179

231180
</section>

lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var pow = require( '@stdlib/math/base/special/pow' );
2626
var Complex64Array = require( '@stdlib/array/complex64' );
2727
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2828
var realf = require( '@stdlib/complex/float32/real' );
29-
var imagf = require( '@stdlib/complex/float32/imag' );
3029
var pkg = require( './../package.json' ).name;
3130
var cdotc = require( './../lib/cdotc.js' );
3231

@@ -48,11 +47,11 @@ var options = {
4847
* @returns {Function} benchmark function
4948
*/
5049
function createBenchmark( len ) {
51-
var cx;
52-
var cy;
50+
var x;
51+
var y;
5352

54-
cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
55-
cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
53+
x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
54+
y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
5655

5756
return benchmark;
5857

@@ -68,13 +67,13 @@ function createBenchmark( len ) {
6867

6968
b.tic();
7069
for ( i = 0; i < b.iterations; i++ ) {
71-
out = cdotc( cx.length, cx, 1, cy, 1 );
72-
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
70+
out = cdotc( x.length, x, 1, y, 1 );
71+
if ( isnanf( realf( out ) ) ) {
7372
b.fail( 'should not return NaN' );
7473
}
7574
}
7675
b.toc();
77-
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
76+
if ( isnanf( realf( out ) ) ) {
7877
b.fail( 'should not return NaN' );
7978
}
8079
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/blas/base/cdotc/benchmark/benchmark.ndarray.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var pow = require( '@stdlib/math/base/special/pow' );
2626
var Complex64Array = require( '@stdlib/array/complex64' );
2727
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2828
var realf = require( '@stdlib/complex/float32/real' );
29-
var imagf = require( '@stdlib/complex/float32/imag' );
3029
var pkg = require( './../package.json' ).name;
3130
var cdotc = require( './../lib/ndarray.js' );
3231

@@ -48,11 +47,11 @@ var options = {
4847
* @returns {Function} benchmark function
4948
*/
5049
function createBenchmark( len ) {
51-
var cx;
52-
var cy;
50+
var x;
51+
var y;
5352

54-
cx = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
55-
cy = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
53+
x = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
54+
y = new Complex64Array( uniform( len*2, -100.0, 100.0, options ) );
5655

5756
return benchmark;
5857

@@ -68,13 +67,13 @@ function createBenchmark( len ) {
6867

6968
b.tic();
7069
for ( i = 0; i < b.iterations; i++ ) {
71-
out = cdotc( cx.length, cx, 1, 0, cy, 1, 0 );
72-
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
70+
out = cdotc( x.length, x, 1, 0, y, 1, 0 );
71+
if ( isnanf( realf( out ) ) ) {
7372
b.fail( 'should not return NaN' );
7473
}
7574
}
7675
b.toc();
77-
if ( isnanf( realf( out ) ) || isnanf( imagf( out ) )) {
76+
if ( isnanf( realf( out ) ) ) {
7877
b.fail( 'should not return NaN' );
7978
}
8079
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/blas/base/cdotc/docs/repl.txt

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,22 @@
2929

3030
Returns
3131
-------
32-
out: Complex64
32+
z: Complex64
3333
The dot product.
3434

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

4643
// Strides:
4744
> x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -4.0, -7.0, -1.0, -9.0 ] );
4845
> y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0, 7.0, -6.0 ] );
49-
> out = {{alias}}( 2, x, 2, y, 1 );
50-
> var re = {{alias:@stdlib/complex/float32/real}}( out )
51-
54
52-
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
53-
-80
46+
> z = {{alias}}( 2, x, 2, y, 1 );
47+
<Complex128>[ 54.0, -80.0 ]
5448

5549

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

8680
Returns
8781
-------
88-
out: Complex64
82+
z: Complex64
8983
The dot product.
9084

9185
Examples
9286
--------
9387
// Standard usage:
9488
> var x = new {{alias:@stdlib/array/complex64}}( [ 7.0, -8.0, -1.0, -9.0 ] );
9589
> var y = new {{alias:@stdlib/array/complex64}}( [ 6.0, -6.0, -9.0, 5.0 ] );
96-
> var out = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 );
97-
> var re = {{alias:@stdlib/complex/float32/real}}( out )
98-
54
99-
> var im = {{alias:@stdlib/complex/float32/imag}}( out )
100-
-80
90+
> var z = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 );
91+
<Complex128>[ 54.0, -80.0 ]
10192

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

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

120105
See Also
121106
--------

lib/node_modules/@stdlib/blas/base/cdotc/docs/types/index.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import { Complex64Array } from '@stdlib/types/array';
2525
/**
2626
* Interface describing `cdotc`.
2727
*/
28-
interface Routine {
28+
interface Rzine {
2929
/**
30-
* Computes the dot product of two single-precision complex vectors.
30+
* Computes the dot product `x^H * y` of `x` and `y`.
3131
*
3232
* @param N - number of indexed elements
3333
* @param x - first input complex array
@@ -43,12 +43,12 @@ interface Routine {
4343
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
4444
*
4545
* var z = cdotc( x.length, x, 1, y, 1 );
46-
* // returns <Complex64>
46+
* // returns <Complex64>[ 54.0, -80.0 ]
4747
*/
4848
( N: number, x: Complex64Array, strideX: number, y: Complex64Array, strideY: number ): Complex64;
4949

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

7474
/**
75-
* Computes the dot product of `x` and `y`.
75+
* Computes the dot product `x^H * y` of `x` and `y`.
7676
*
7777
* @param N - number of indexed elements
7878
* @param x - first input array
@@ -88,7 +88,7 @@ interface Routine {
8888
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
8989
*
9090
* var z = cdotc( x.length, x, 1, y, 1 );
91-
* // returns <Complex64>
91+
* // returns <Complex64>[ 54.0, -80.0 ]
9292
*
9393
* @example
9494
* var Complex64Array = require( '@stdlib/array/complex64' );
@@ -97,9 +97,9 @@ interface Routine {
9797
* var y = new Complex64Array( [ 6, -6, -9, 5 ] );
9898
*
9999
* var z = cdotc.ndarray( x.length, x, 1, 0, y, 1, 0 );
100-
* // returns <Complex64>
100+
* // returns <Complex64>[ 54.0, -80.0 ]
101101
*/
102-
declare var cdotc: Routine;
102+
declare var cdotc: Rzine;
103103

104104

105105
// EXPORTS //

0 commit comments

Comments
 (0)