-
Notifications
You must be signed in to change notification settings - Fork 0
math.MutableComplex.Class.MutableComplex
dsp-collection / math/MutableComplex / MutableComplex
Defined in: math/MutableComplex.ts:17
A mutable complex number.
This class implementation for storing complex numbers is optimized for high performance computation. Immutability is sacrificed in favor of fast in-place operations.
When mutability is no longer needed, a MutableComplex can be type cast into an immutable Complex.
new MutableComplex(re?, im?): MutableComplex;Defined in: math/MutableComplex.ts:37
Constructs a MutableComplex.
number = 0
The real part. Optional. Default is 0.
number = 0
The imaginary part. Optional. Default is 0.
MutableComplex
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|---|
im
|
public |
number |
Mutable imaginary part of the complex number. |
Complex.im
|
- | math/MutableComplex.ts:25 |
re
|
public |
number |
Mutable real part of the complex number. |
Complex.re
|
- | math/MutableComplex.ts:22 |
I
|
readonly |
Complex |
The imaginary unit i. | - |
Complex.I
|
math/Complex.ts:19 |
INFINITY
|
readonly |
Complex |
A Complex representing "+Infinity + Infinity i" |
- |
Complex.INFINITY
|
math/Complex.ts:34 |
NaN
|
readonly |
Complex |
A Complex representing "NaN + NaN i" |
- |
Complex.NaN
|
math/Complex.ts:31 |
ONE
|
readonly |
Complex |
A Complex representing 1. |
- |
Complex.ONE
|
math/Complex.ts:25 |
TWO
|
readonly |
Complex |
A Complex representing 2. |
- |
Complex.TWO
|
math/Complex.ts:28 |
ZERO
|
readonly |
Complex |
A Complex representing 0. |
- |
Complex.ZERO
|
math/Complex.ts:22 |
abs(): number;Defined in: math/Complex.ts:128
Returns the absolute value (magnitude, vector length, radius).
number
add(x): Complex;Defined in: math/Complex.ts:201
Returns this + x;
addReal(x): Complex;Defined in: math/Complex.ts:195
Returns this + x;
number
addRealTo(x): void;Defined in: math/MutableComplex.ts:97
Mutates this MutableComplex by adding a real number.
number
void
addTo(x): void;Defined in: math/MutableComplex.ts:103
Mutates this MutableComplex by adding a Complex.
void
arg(): number;Defined in: math/Complex.ts:134
Returns the argument (angle).
number
conj(): Complex;Defined in: math/Complex.ts:140
Returns the conjugate.
div(x): Complex;Defined in: math/Complex.ts:243
Returns this / x;
divBy(x): void;Defined in: math/MutableComplex.ts:143
Mutates this MutableComplex by dividing by a Complex.
void
divByReal(x): void;Defined in: math/MutableComplex.ts:136
Mutates this MutableComplex by dividing by a real number.
number
void
divReal(x): Complex;Defined in: math/Complex.ts:237
Returns this / x;
number
equals(x): boolean;Defined in: math/Complex.ts:99
Returns true if this complex number is exactly equal to another.
boolean
exp(): Complex;Defined in: math/Complex.ts:166
Returns the exponential function. (The Euler's number e raised to the power of this complex number).
fuzzyEquals(x, eps): boolean;Defined in: math/Complex.ts:106
Returns true if the real and imaginary parts of the two numbers
do not differ more than eps.
number
boolean
isFinite(): boolean;Defined in: math/Complex.ts:93
Returns true if the real and imaginary parts are both finite.
boolean
isInfinite(): boolean;Defined in: math/Complex.ts:87
Returns true if the real or the imaginary part is infinite (positive or negative).
boolean
isNaN(): boolean;Defined in: math/Complex.ts:81
Returns true if the real part or the imaginary part is NaN.
boolean
log(): Complex;Defined in: math/Complex.ts:172
Returns the natural logarithm (base e).
mul(x): Complex;Defined in: math/Complex.ts:231
Returns this * x;
mulBy(x): void;Defined in: math/MutableComplex.ts:130
Mutates this MutableComplex by multiplying a Complex.
void
mulByReal(x): void;Defined in: math/MutableComplex.ts:123
Mutates this MutableComplex by multiplying a real number.
number
void
mulReal(x): Complex;Defined in: math/Complex.ts:225
Returns this * x;
number
neg(): Complex;Defined in: math/Complex.ts:146
Returns the negation (-this).
pow(x): Complex;Defined in: math/Complex.ts:271
Returns this raised to the power of x.
powInt(x): Complex;Defined in: math/Complex.ts:257
Returns this raised to the power of x.
number
powReal(x): Complex;Defined in: math/Complex.ts:265
Returns this raised to the power of x.
number
reciprocal(): Complex;Defined in: math/Complex.ts:152
Returns the reciprocal (1 / this, multiplicative inverse).
set(x): void;Defined in: math/MutableComplex.ts:67
Sets this MutableComplex to the value of another Complex.
void
setDiv(
re1,
im1,
re2,
im2): void;Defined in: math/MutableComplex.ts:158
Sets this MutableComplex to (re1, im1) / (re2, im2).
number
number
number
number
void
setExpj(arg): void;Defined in: math/MutableComplex.ts:81
Sets this MutableComplex to e^(j * arg) (length 1 and argument arg).
number
void
setMul(
re1,
im1,
re2,
im2): void;Defined in: math/MutableComplex.ts:151
Sets this MutableComplex to (re1, im1) * (re2, im2).
number
number
number
number
void
setPolar(abs, arg): void;Defined in: math/MutableComplex.ts:88
Sets this MutableComplex using polar coordinates.
number
number
void
setReIm(re, im?): void;Defined in: math/MutableComplex.ts:74
Sets this MutableComplex to (re, im).
number
number = 0
void
sqr(): Complex;Defined in: math/Complex.ts:178
Returns the square.
sqrt(): Complex;Defined in: math/Complex.ts:184
Returns one of the two square roots.
sub(x): Complex;Defined in: math/Complex.ts:219
Returns this - x;
subFrom(x): void;Defined in: math/MutableComplex.ts:116
Mutates this MutableComplex by subtracting a Complex.
void
subReal(x): Complex;Defined in: math/Complex.ts:207
Returns this - x;
number
subRealFrom(x): void;Defined in: math/MutableComplex.ts:110
Mutates this MutableComplex by substracting a real number.
number
void
toNumber(eps): number;Defined in: math/Complex.ts:72
Returns the real part.
Verifies that abs(im) <= eps or abs(im) <= abs(re) * eps.
number
number
toString(): string;Defined in: math/Complex.ts:65
Returns a string representing the complex number.
string
static divFromReal(x, y): Complex;Defined in: math/Complex.ts:250
Returns x / y;
number
static expj(arg): MutableComplex;Defined in: math/MutableComplex.ts:52
Creates a MutableComplex of length 1 and argument arg.
number
MutableComplex
static fromComplex(x): MutableComplex;Defined in: math/MutableComplex.ts:45
Creates a MutableComplex from a Complex.
MutableComplex
static fromPolar(abs, arg): MutableComplex;Defined in: math/MutableComplex.ts:59
Creates a MutableComplex from polar coordinates.
number
number
MutableComplex
static subFromReal(x, y): Complex;Defined in: math/Complex.ts:213
Returns x - y;
number