Skip to content

Commit 0747b68

Browse files
committed
Require complex number instances
1 parent 185fcaf commit 0747b68

File tree

46 files changed

+86
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+86
-96
lines changed

lib/node_modules/@stdlib/math/base/ops/cadd/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex128 } from '@stdlib/types/object';
2424

2525
/**
2626
* Adds two double-precision complex floating-point numbers.
@@ -46,7 +46,7 @@ import { ComplexLike } from '@stdlib/types/object';
4646
* var im = imag( out );
4747
* // returns 6.0
4848
*/
49-
declare function cadd( z1: ComplexLike, z2: ComplexLike ): ComplexLike;
49+
declare function cadd( z1: Complex128, z2: Complex128 ): Complex128;
5050

5151

5252
// EXPORTS //

lib/node_modules/@stdlib/math/base/ops/cadd/docs/types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import cadd = require( './index' );
2626
{
2727
const z = new Complex128( 1.0, 1.0 );
2828

29-
cadd( z, z ); // $ExpectType ComplexLike
29+
cadd( z, z ); // $ExpectType Complex128
3030
}
3131

3232
// The compiler throws an error if the function is provided a first argument which is not a complex number...

lib/node_modules/@stdlib/math/base/ops/cadd/lib/main.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var Complex128 = require( '@stdlib/complex/float64' );
2423
var real = require( '@stdlib/complex/real' );
2524
var imag = require( '@stdlib/complex/imag' );
2625

@@ -30,8 +29,8 @@ var imag = require( '@stdlib/complex/imag' );
3029
/**
3130
* Adds two double-precision complex floating-point numbers.
3231
*
33-
* @param {ComplexLike} z1 - complex number
34-
* @param {ComplexLike} z2 - complex number
32+
* @param {Complex128} z1 - complex number
33+
* @param {Complex128} z2 - complex number
3534
* @returns {Complex128} result
3635
*
3736
* @example
@@ -54,7 +53,7 @@ var imag = require( '@stdlib/complex/imag' );
5453
function cadd( z1, z2 ) {
5554
var re = real( z1 ) + real( z2 );
5655
var im = imag( z1 ) + imag( z2 );
57-
return new Complex128( re, im );
56+
return new z1.constructor( re, im );
5857
}
5958

6059

lib/node_modules/@stdlib/math/base/ops/caddf/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex64 } from '@stdlib/types/object';
2424

2525
/**
2626
* Adds two single-precision complex floating-point numbers.
@@ -46,7 +46,7 @@ import { ComplexLike } from '@stdlib/types/object';
4646
* var im = imag( out );
4747
* // returns 6.0
4848
*/
49-
declare function caddf( z1: ComplexLike, z2: ComplexLike ): ComplexLike;
49+
declare function caddf( z1: Complex64, z2: Complex64 ): Complex64;
5050

5151

5252
// EXPORTS //

lib/node_modules/@stdlib/math/base/ops/caddf/docs/types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import caddf = require( './index' );
2626
{
2727
const z = new Complex64( 1.0, 1.0 );
2828

29-
caddf( z, z ); // $ExpectType ComplexLike
29+
caddf( z, z ); // $ExpectType Complex64
3030
}
3131

3232
// The compiler throws an error if the function is provided a first argument which is not a complex number...

lib/node_modules/@stdlib/math/base/ops/caddf/lib/main.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var Complex64 = require( '@stdlib/complex/float32' );
2423
var real = require( '@stdlib/complex/real' );
2524
var imag = require( '@stdlib/complex/imag' );
2625

@@ -30,8 +29,8 @@ var imag = require( '@stdlib/complex/imag' );
3029
/**
3130
* Adds two single-precision complex floating-point numbers.
3231
*
33-
* @param {ComplexLike} z1 - complex number
34-
* @param {ComplexLike} z2 - complex number
32+
* @param {Complex64} z1 - complex number
33+
* @param {Complex64} z2 - complex number
3534
* @returns {Complex64} result
3635
*
3736
* @example
@@ -54,7 +53,7 @@ var imag = require( '@stdlib/complex/imag' );
5453
function caddf( z1, z2 ) {
5554
var re = real( z1 ) + real( z2 );
5655
var im = imag( z1 ) + imag( z2 );
57-
return new Complex64( re, im );
56+
return new z1.constructor( re, im );
5857
}
5958

6059

lib/node_modules/@stdlib/math/base/ops/cmul/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex128 } from '@stdlib/types/object';
2424

2525
/**
2626
* Multiplies two double-precision complex floating-point numbers.
@@ -49,7 +49,7 @@ import { ComplexLike } from '@stdlib/types/object';
4949
* var im = imag( out );
5050
* // returns -1.0
5151
*/
52-
declare function cmul( z1: ComplexLike, z2: ComplexLike ): ComplexLike;
52+
declare function cmul( z1: Complex128, z2: Complex128 ): Complex128;
5353

5454

5555
// EXPORTS //

lib/node_modules/@stdlib/math/base/ops/cmul/docs/types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import cmul = require( './index' );
2626
{
2727
const z = new Complex128( 1.0, 1.0 );
2828

29-
cmul( z, z ); // $ExpectType ComplexLike
29+
cmul( z, z ); // $ExpectType Complex128
3030
}
3131

3232
// The compiler throws an error if the function is provided a first argument which is not a complex number...

lib/node_modules/@stdlib/math/base/ops/cmul/lib/main.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var Complex128 = require( '@stdlib/complex/float64' );
2423
var real = require( '@stdlib/complex/real' );
2524
var imag = require( '@stdlib/complex/imag' );
2625

@@ -30,8 +29,8 @@ var imag = require( '@stdlib/complex/imag' );
3029
/**
3130
* Multiplies two double-precision complex floating-point numbers.
3231
*
33-
* @param {ComplexLike} z1 - complex number
34-
* @param {ComplexLike} z2 - complex number
32+
* @param {Complex128} z1 - complex number
33+
* @param {Complex128} z2 - complex number
3534
* @returns {Complex128} result
3635
*
3736
* @example
@@ -61,7 +60,7 @@ function cmul( z1, z2 ) {
6160
var im2 = imag( z2 );
6261
var re = (re1*re2) - (im1*im2);
6362
var im = (re1*im2) + (im1*re2);
64-
return new Complex128( re, im );
63+
return new z1.constructor( re, im );
6564
}
6665

6766

lib/node_modules/@stdlib/math/base/ops/cmulf/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex64 } from '@stdlib/types/object';
2424

2525
/**
2626
* Multiplies two single-precision complex floating-point numbers.
@@ -49,7 +49,7 @@ import { ComplexLike } from '@stdlib/types/object';
4949
* var im = imag( out );
5050
* // returns -1.0
5151
*/
52-
declare function cmulf( z1: ComplexLike, z2: ComplexLike ): ComplexLike;
52+
declare function cmulf( z1: Complex64, z2: Complex64 ): Complex64;
5353

5454

5555
// EXPORTS //

lib/node_modules/@stdlib/math/base/ops/cmulf/docs/types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import cmulf = require( './index' );
2626
{
2727
const z = new Complex64( 1.0, 1.0 );
2828

29-
cmulf( z, z ); // $ExpectType ComplexLike
29+
cmulf( z, z ); // $ExpectType Complex64
3030
}
3131

3232
// The compiler throws an error if the function is provided a first argument which is not a complex number...

lib/node_modules/@stdlib/math/base/ops/cmulf/lib/main.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// MODULES //
2222

2323
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
24-
var Complex64 = require( '@stdlib/complex/float32' );
2524
var real = require( '@stdlib/complex/real' );
2625
var imag = require( '@stdlib/complex/imag' );
2726

@@ -31,8 +30,8 @@ var imag = require( '@stdlib/complex/imag' );
3130
/**
3231
* Multiplies two single-precision complex floating-point numbers.
3332
*
34-
* @param {ComplexLike} z1 - complex number
35-
* @param {ComplexLike} z2 - complex number
33+
* @param {Complex64} z1 - complex number
34+
* @param {Complex64} z2 - complex number
3635
* @returns {Complex64} result
3736
*
3837
* @example
@@ -62,7 +61,7 @@ function cmulf( z1, z2 ) {
6261
var im2 = imag( z2 );
6362
var re = float64ToFloat32(re1*re2) - float64ToFloat32(im1*im2);
6463
var im = float64ToFloat32(re1*im2) + float64ToFloat32(im1*re2);
65-
return new Complex64( float64ToFloat32( re ), float64ToFloat32( im ) );
64+
return new z1.constructor( float64ToFloat32( re ), float64ToFloat32( im ) );
6665
}
6766

6867

lib/node_modules/@stdlib/math/base/ops/csub/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex128 } from '@stdlib/types/object';
2424

2525
/**
2626
* Subtracts two double-precision complex floating-point numbers.
@@ -49,7 +49,7 @@ import { ComplexLike } from '@stdlib/types/object';
4949
* var im = imag( out );
5050
* // returns 2.0
5151
*/
52-
declare function csub( z1: ComplexLike, z2: ComplexLike ): ComplexLike;
52+
declare function csub( z1: Complex128, z2: Complex128 ): Complex128;
5353

5454

5555
// EXPORTS //

lib/node_modules/@stdlib/math/base/ops/csub/docs/types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import csub = require( './index' );
2626
{
2727
const z = new Complex128( 1.0, 1.0 );
2828

29-
csub( z, z ); // $ExpectType ComplexLike
29+
csub( z, z ); // $ExpectType Complex128
3030
}
3131

3232
// The compiler throws an error if the function is provided a first argument which is not a complex number...

lib/node_modules/@stdlib/math/base/ops/csub/lib/main.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var Complex128 = require( '@stdlib/complex/float64' );
2423
var real = require( '@stdlib/complex/real' );
2524
var imag = require( '@stdlib/complex/imag' );
2625

@@ -30,8 +29,8 @@ var imag = require( '@stdlib/complex/imag' );
3029
/**
3130
* Subtracts two double-precision complex floating-point numbers.
3231
*
33-
* @param {ComplexLike} z1 - complex number
34-
* @param {ComplexLike} z2 - complex number
32+
* @param {Complex128} z1 - complex number
33+
* @param {Complex128} z2 - complex number
3534
* @returns {Complex128} result
3635
*
3736
* @example
@@ -57,7 +56,7 @@ var imag = require( '@stdlib/complex/imag' );
5756
function csub( z1, z2 ) {
5857
var re = real( z1 ) - real( z2 );
5958
var im = imag( z1 ) - imag( z2 );
60-
return new Complex128( re, im );
59+
return new z1.constructor( re, im );
6160
}
6261

6362

lib/node_modules/@stdlib/math/base/ops/csubf/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex64 } from '@stdlib/types/object';
2424

2525
/**
2626
* Subtracts two single-precision complex floating-point numbers.
@@ -49,7 +49,7 @@ import { ComplexLike } from '@stdlib/types/object';
4949
* var im = imag( out );
5050
* // returns 2.0
5151
*/
52-
declare function csubf( z1: ComplexLike, z2: ComplexLike ): ComplexLike;
52+
declare function csubf( z1: Complex64, z2: Complex64 ): Complex64;
5353

5454

5555
// EXPORTS //

lib/node_modules/@stdlib/math/base/ops/csubf/docs/types/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import csubf = require( './index' );
2626
{
2727
const z = new Complex64( 1.0, 1.0 );
2828

29-
csubf( z, z ); // $ExpectType ComplexLike
29+
csubf( z, z ); // $ExpectType Complex64
3030
}
3131

3232
// The compiler throws an error if the function is provided a first argument which is not a complex number...

lib/node_modules/@stdlib/math/base/ops/csubf/lib/main.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
// MODULES //
2222

23-
var Complex64 = require( '@stdlib/complex/float32' );
2423
var real = require( '@stdlib/complex/real' );
2524
var imag = require( '@stdlib/complex/imag' );
2625

@@ -30,8 +29,8 @@ var imag = require( '@stdlib/complex/imag' );
3029
/**
3130
* Subtracts two single-precision complex floating-point numbers.
3231
*
33-
* @param {ComplexLike} z1 - complex number
34-
* @param {ComplexLike} z2 - complex number
32+
* @param {Complex64} z1 - complex number
33+
* @param {Complex64} z2 - complex number
3534
* @returns {Complex64} result
3635
*
3736
* @example
@@ -57,7 +56,7 @@ var imag = require( '@stdlib/complex/imag' );
5756
function csubf( z1, z2 ) {
5857
var re = real( z1 ) - real( z2 );
5958
var im = imag( z1 ) - imag( z2 );
60-
return new Complex64( re, im );
59+
return new z1.constructor( re, im );
6160
}
6261

6362

lib/node_modules/@stdlib/math/base/special/cabs/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex128 } from '@stdlib/types/object';
2424

2525
/**
2626
* Computes the absolute value of a double-precision complex floating-point number.
@@ -38,7 +38,7 @@ import { ComplexLike } from '@stdlib/types/object';
3838
* var v = cabs( new Complex128( 5.0, 3.0 ) );
3939
* // returns ~5.83
4040
*/
41-
declare function cabs( z: ComplexLike ): number;
41+
declare function cabs( z: Complex128 ): number;
4242

4343

4444
// EXPORTS //

lib/node_modules/@stdlib/math/base/special/cabs/lib/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var imag = require( '@stdlib/complex/imag' );
3030
/**
3131
* Computes the absolute value of a double-precision complex floating-point number.
3232
*
33-
* @param {ComplexLike} z - complex number
33+
* @param {Complex128} z - complex number
3434
* @returns {number} absolute value
3535
*
3636
* @example

lib/node_modules/@stdlib/math/base/special/cabs2/docs/types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { ComplexLike } from '@stdlib/types/object';
23+
import { Complex128 } from '@stdlib/types/object';
2424

2525
/**
2626
* Computes the squared absolute value of a double-precision complex floating-point number.
@@ -38,7 +38,7 @@ import { ComplexLike } from '@stdlib/types/object';
3838
* var v = cabs2( new Complex128( 5.0, 3.0 ) );
3939
* // returns 34.0
4040
*/
41-
declare function cabs2( z: ComplexLike ): number;
41+
declare function cabs2( z: Complex128 ): number;
4242

4343

4444
// EXPORTS //

lib/node_modules/@stdlib/math/base/special/cabs2/lib/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var imag = require( '@stdlib/complex/imag' );
3333
*
3434
* - Be careful of overflow and underflow.
3535
*
36-
* @param {ComplexLike} z - complex number
36+
* @param {Complex128} z - complex number
3737
* @returns {number} squared absolute value
3838
*
3939
* @example

0 commit comments

Comments
 (0)