@ac-kit/math-complex 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +78 -20
- package/dist/complex/complex-field.d.ts +28 -0
- package/dist/complex/complex-field.d.ts.map +1 -0
- package/dist/complex/complex-field.js +41 -0
- package/dist/complex/complex-field.js.map +1 -0
- package/dist/complex/complex-num.d.ts +28 -10
- package/dist/complex/complex-num.d.ts.map +1 -1
- package/dist/complex/complex-num.js +60 -23
- package/dist/complex/complex-num.js.map +1 -1
- package/dist/complex/complex.d.ts +227 -42
- package/dist/complex/complex.d.ts.map +1 -1
- package/dist/complex/complex.js +548 -74
- package/dist/complex/complex.js.map +1 -1
- package/dist/dual/dual.d.ts +117 -0
- package/dist/dual/dual.d.ts.map +1 -0
- package/dist/dual/dual.js +250 -0
- package/dist/dual/dual.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,97 @@
|
|
|
1
1
|
# @ac-kit/math-complex
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5c203e7: `complexField` is ℂ as `Field<Complex>` evidence, so a `Complex` can be passed
|
|
8
|
+
to `@ac-kit/math-algebra`'s generic algorithms (`power`, or any written against
|
|
9
|
+
`Field<T>`) without assembling the operations by hand. Each operation returns a
|
|
10
|
+
new pair and never writes to its operands; `zero` and `one` are new pairs at
|
|
11
|
+
each read. Exact equality, plain products, Smith's division; the inverse of
|
|
12
|
+
zero has `NaN` parts.
|
|
13
|
+
- 5c203e7: The `Complex` functions move to the quaternions' standard: a branded pair made
|
|
14
|
+
only by its creators, `out` first, alias-safe, no allocation, no throw, and the
|
|
15
|
+
quaternion names. No value-returning alias is kept. `ComplexNum` keeps its value
|
|
16
|
+
API and its results, bit for bit: its quotient stays the compensated Smith one,
|
|
17
|
+
its inverse `conj(z) / |z|²` and its modulus `Math.hypot`'s.
|
|
18
|
+
|
|
19
|
+
- `Complex` is branded, with a `ReadonlyComplex` view: an array literal or a
|
|
20
|
+
`number[]` is no longer one. Make one with `complexCreate()`,
|
|
21
|
+
`complexOf(re, im)`, `complexClone(z)` or, from untyped data,
|
|
22
|
+
`complexFromArray(out, source, offset?)`; write one with `complexSet` or
|
|
23
|
+
`complexCopy`.
|
|
24
|
+
- Every operation writes into its first argument and returns it, which may be
|
|
25
|
+
any input: `complexAdd`, `complexSubtract`, `complexNegate`,
|
|
26
|
+
`complexMultiplyScalar`, `complexMultiply`, `complexMultiplyPrecise`,
|
|
27
|
+
`complexDivide`, `complexConjugate`, `complexInvert`, `complexFromPolar`,
|
|
28
|
+
`complexCis`, `complexExp`, `complexLog`, `complexSqrt` and `complexPowInt`.
|
|
29
|
+
They allocate nothing, inlined or not.
|
|
30
|
+
- `complexMultiply` is the plain product; `complexMultiplyPrecise` keeps the
|
|
31
|
+
compensated rounding of the former `complexMul` (each part to 1.5 ulps).
|
|
32
|
+
- `complexInvert` and `complexDivide` write `NaN` parts for a zero divisor
|
|
33
|
+
instead of throwing, and follow C99 Annex G for infinite operands: a finite
|
|
34
|
+
number over an infinite one is a signed zero (`1 / (∞ + ∞i)` was `NaN`),
|
|
35
|
+
or `NaN` in a part whose Annex G sum `a·c′ ± b·d′` overflows, an
|
|
36
|
+
infinite one over a finite nonzero one infinite.
|
|
37
|
+
- New: `complexEquals` and `complexIsFinite`.
|
|
38
|
+
- `complexLength` is right at every magnitude and `+∞` for an infinite part,
|
|
39
|
+
even beside `NaN`.
|
|
40
|
+
- `ComplexNum.fromTuple` and `toTuple` copy, so a value never changes;
|
|
41
|
+
`inv()` and `div()` throw a `RangeError` on zero, as their documentation
|
|
42
|
+
said.
|
|
43
|
+
|
|
44
|
+
Migration (the old name on the left, `out` any complex number, for instance
|
|
45
|
+
`complexCreate()` once outside a loop):
|
|
46
|
+
|
|
47
|
+
| before | after |
|
|
48
|
+
| -------------------------------------- | ----------------------------------------------------------- |
|
|
49
|
+
| `[re, im]` | `complexOf(re, im)` |
|
|
50
|
+
| `COMPLEX_ZERO`, `COMPLEX_ONE`, `COMPLEX_I` | `complexCreate()`, `complexOf(1, 0)`, `complexOf(0, 1)` |
|
|
51
|
+
| `complexAdd(a, b)` | `complexAdd(out, a, b)` |
|
|
52
|
+
| `complexSub(a, b)` | `complexSubtract(out, a, b)` |
|
|
53
|
+
| `complexMul(a, b)` | `complexMultiplyPrecise(out, a, b)` (or the faster `complexMultiply`) |
|
|
54
|
+
| `complexDiv(a, b)` | `complexDivide(out, a, b)` |
|
|
55
|
+
| `complexNeg(a)` | `complexNegate(out, a)` |
|
|
56
|
+
| `complexConjugate(a)` | `complexConjugate(out, a)` |
|
|
57
|
+
| `complexInverse(a)` | `complexInvert(out, a)` (`NaN` parts for zero, no throw) |
|
|
58
|
+
| `complexModulus(a)`, `complexModulusSq(a)` | `complexLength(a)`, `complexLengthSquared(a)` |
|
|
59
|
+
| `complexFromPolar(r, θ)`, `complexCis(θ)` | `complexFromPolar(out, r, θ)`, `complexCis(out, θ)` |
|
|
60
|
+
| `complexExp(a)`, `complexLog(a)` | `complexExp(out, a)`, `complexLog(out, a)` |
|
|
61
|
+
| `complexSqrt(a)`, `complexPowInt(a, n)` | `complexSqrt(out, a)`, `complexPowInt(out, a, n)` |
|
|
62
|
+
|
|
63
|
+
- 5c203e7: - `complexSqrt(out, z)` is the principal square root, free of cancellation
|
|
64
|
+
(Kahan), finite across the whole binary64 range and with C99 Annex G special
|
|
65
|
+
values.
|
|
66
|
+
- `complexPowInt(out, z, n)` raises to an integer power by binary
|
|
67
|
+
exponentiation on the compensated product, exact on Gaussian integers; a
|
|
68
|
+
negative `n` is the reciprocal power, and an `n` that is not a safe integer
|
|
69
|
+
writes `NaN` parts.
|
|
70
|
+
- `complexIsClose(a, b, { relTol, absTol })` compares by the modulus of the
|
|
71
|
+
difference, as Python's `cmath.isclose`.
|
|
72
|
+
- `Dual` and `ReadonlyDual`: dual numbers `a + bε` for forward-mode automatic
|
|
73
|
+
differentiation, on the quaternions' standard (branded pair, creators,
|
|
74
|
+
`out` first, alias-safe, no allocation): `dualCreate`, `dualOf`,
|
|
75
|
+
`dualVariable`, `dualClone`, `dualSet`, `dualCopy`, `dualAdd`,
|
|
76
|
+
`dualSubtract`, `dualNegate`, `dualMultiplyScalar`, `dualMultiply`,
|
|
77
|
+
`dualDivide`, `dualInvert`, `dualPow`, `dualSqrt`, `dualExp`, `dualLog`,
|
|
78
|
+
`dualSin`, `dualCos`, `dualTan`, `dualAtan`, `dualTanh`, `dualAbs` and
|
|
79
|
+
`dualIsFinite`.
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [5c203e7]
|
|
84
|
+
- Updated dependencies [5c203e7]
|
|
85
|
+
- Updated dependencies [5c203e7]
|
|
86
|
+
- Updated dependencies [5c203e7]
|
|
87
|
+
- Updated dependencies [5c203e7]
|
|
88
|
+
- Updated dependencies [5c203e7]
|
|
89
|
+
- Updated dependencies [5c203e7]
|
|
90
|
+
- Updated dependencies [5c203e7]
|
|
91
|
+
- @ac-kit/core@0.14.0
|
|
92
|
+
- @ac-kit/math-algebra@0.2.0
|
|
93
|
+
- @ac-kit/math-scalar@0.5.0
|
|
94
|
+
|
|
3
95
|
## 0.2.1
|
|
4
96
|
|
|
5
97
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -24,14 +24,23 @@ rotation matrices, slerp — lives there.
|
|
|
24
24
|
|
|
25
25
|
| Symbol | Description |
|
|
26
26
|
| ----------------------------------------------------------------------- | -------------------------------------- |
|
|
27
|
-
| `Complex`
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
27
|
+
| `Complex`, `ReadonlyComplex` | `[re, im]` branded pair, and its read-only view |
|
|
28
|
+
| `complexCreate`, `complexOf`, `complexClone`, `complexFromArray` | The only ways to make one; `FromArray` for untyped data |
|
|
29
|
+
| `complexSet`, `complexCopy`, `complexFromPolar`, `complexCis` | Write into an `out`: parts, a copy, the polar form and Euler's formula |
|
|
30
|
+
| `complexAdd`, `complexSubtract`, `complexNegate`, `complexMultiplyScalar`, `complexMultiply`, `complexDivide` | Field operations, `out` first; Smith's division |
|
|
31
|
+
| `complexMultiplyPrecise` | The product with each part to 1.5 ulp, however its terms cancel |
|
|
32
|
+
| `complexConjugate`, `complexInvert` | `a − bi` and `1 / z` |
|
|
33
|
+
| `complexLength`, `complexLengthSquared` | `\|z\|` without overflow, and `\|z\|²` |
|
|
34
|
+
| `complexArgument` | Principal argument in `[−π, π]` |
|
|
34
35
|
| `complexExp`, `complexLog` | Exponential and principal logarithm |
|
|
36
|
+
| `complexSqrt` | Principal square root, Kahan's cancellation-free form, C99 Annex G special values |
|
|
37
|
+
| `complexPowInt` | `zⁿ` for an integer `n`, binary exponentiation on compensated products |
|
|
38
|
+
| `complexEquals`, `complexIsClose`, `complexIsFinite` | Exact comparison; `\|a − b\| ≤ max(relTol·max(\|a\|, \|b\|), absTol)`, as `cmath.isclose`; the finite check |
|
|
39
|
+
| `complexField` | ℂ as `Field<Complex>` evidence for `@ac-kit/math-algebra`'s generic algorithms; a fresh pair per operation |
|
|
40
|
+
| `Dual`, `ReadonlyDual` | `[value, derivative]` branded pair, `a + bε` with `ε² = 0` |
|
|
41
|
+
| `dualCreate`, `dualOf`, `dualVariable`, `dualClone`, `dualSet`, `dualCopy` | Creators, and writes into an `out` |
|
|
42
|
+
| `dualAdd`, `dualSubtract`, `dualNegate`, `dualMultiplyScalar`, `dualMultiply`, `dualDivide`, `dualInvert` | Arithmetic with the sum, product and quotient rules, `out` first |
|
|
43
|
+
| `dualPow`, `dualSqrt`, `dualExp`, `dualLog`, `dualSin`, `dualCos`, `dualTan`, `dualAtan`, `dualTanh`, `dualAbs`, `dualIsFinite` | Elementary functions with their derivatives |
|
|
35
44
|
| `Quaternion`, `ReadonlyQuaternion` | `[x, y, z, w]` branded tuple, and its read-only view |
|
|
36
45
|
| `quaternionCreate`, `quaternionOf`, `quaternionClone`, `quaternionFromArray` | The only ways to make one; `FromArray` for untyped data |
|
|
37
46
|
| `quaternionSet`, `quaternionCopy`, `quaternionIdentity` | Write into an `out` |
|
|
@@ -42,21 +51,68 @@ rotation matrices, slerp — lives there.
|
|
|
42
51
|
| `quaternionDot`, `quaternionEquals`, `quaternionIsClose`, `quaternionIsFinite` | Inner product, comparison and the finite check |
|
|
43
52
|
| `ComplexNum`, `QuaternionNum` | Boxed field/ring values over ℂ and ℍ |
|
|
44
53
|
|
|
45
|
-
`ComplexNum` and `QuaternionNum` box a value with its own field or ring API
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
`ComplexNum` and `QuaternionNum` box a value with its own field or ring API.
|
|
55
|
+
`QuaternionNum` delegates every operation to the free functions above;
|
|
56
|
+
`ComplexNum` does too, except where that would move its results from its 0.2
|
|
57
|
+
release: its quotient is Smith's with each `x·y ± z·w` compensated, its
|
|
58
|
+
inverse `conj(z) / |z|²` and its modulus `Math.hypot`'s, bit for bit. They are
|
|
59
|
+
deliberately not a genericity mechanism: an algorithm that works
|
|
48
60
|
over an arbitrary field or division ring takes `Field<T>` or `DivisionRing<T>`
|
|
49
61
|
evidence from `@ac-kit/math-algebra`, which costs no virtual dispatch.
|
|
62
|
+
`complexField` is that evidence for `Complex`.
|
|
63
|
+
|
|
64
|
+
## Complex numbers
|
|
65
|
+
|
|
66
|
+
A complex number is a plain array `[re, im]` carrying a type-level brand, on the
|
|
67
|
+
quaternions' standard below: creators only (`complexOf(0, 1)` replaces `[0, 1]`,
|
|
68
|
+
and there are no shared constants), `out` first, alias-safe
|
|
69
|
+
(`complexMultiply(z, z, z)` squares `z` in place), no allocation and no throw —
|
|
70
|
+
dividing by zero or inverting it writes `NaN` parts, a non-integer exponent of
|
|
71
|
+
`complexPowInt` too. The hot functions are gated at 0 B per call, and they keep
|
|
72
|
+
every double inside the arrays they read and write, so they allocate nothing
|
|
73
|
+
whether the engine inlines them or not; the modulus goes through
|
|
74
|
+
`@ac-kit/math-scalar`'s `hypot2InPlace`, because V8 boxes the result of every
|
|
75
|
+
`Math.hypot` call.
|
|
76
|
+
|
|
77
|
+
`complexMultiply` is the plain product, rounded as written, as numpy and C99
|
|
78
|
+
without Annex G do it: within a few roundings relative to `|a|·|b|`, so a part
|
|
79
|
+
that is small next to the modulus can lose its digits where `ac` and `bd`
|
|
80
|
+
cancel. `complexMultiplyPrecise` keeps each part within 1.5 ulps of its exact
|
|
81
|
+
value (Kahan's compensated `ac − bd`) for about five times the cost;
|
|
82
|
+
`complexPowInt` and `ComplexNum.mul` use it.
|
|
50
83
|
|
|
51
84
|
## Division
|
|
52
85
|
|
|
53
|
-
`
|
|
86
|
+
`complexDivide` uses Smith's algorithm rather than the textbook
|
|
54
87
|
`(ac + bd) / (c² + d²)` form. The naive version squares both components of the
|
|
55
88
|
divisor, so it overflows for `|z| > √(MAX_VALUE)` and underflows for very small
|
|
56
89
|
divisors even when the true quotient is perfectly representable. Smith's
|
|
57
90
|
formulation divides by the larger component first, keeping every intermediate
|
|
58
91
|
within range.
|
|
59
92
|
|
|
93
|
+
Infinities follow C99 Annex G's `_Cdivd`: a finite number over an infinite one
|
|
94
|
+
is a signed zero (`NaN` in a part whose Annex G sum `a·c′ ± b·d′` overflows,
|
|
95
|
+
as `_Cdivd` gives), an infinite one over a finite nonzero one infinite, `∞/∞`
|
|
96
|
+
`NaN`. A zero divisor gives `NaN` parts rather than Annex G's infinity.
|
|
97
|
+
|
|
98
|
+
## Dual numbers
|
|
99
|
+
|
|
100
|
+
`Dual` is `a + bε` with `ε² = 0`, the algebra of forward-mode automatic
|
|
101
|
+
differentiation: seed the input with `dualVariable(x)` (derivative 1), run the
|
|
102
|
+
computation through the `dual…` functions, and the second component is the
|
|
103
|
+
derivative — exact up to the rounding of the arithmetic, with no step size to
|
|
104
|
+
choose. It follows the quaternions' standard below: branded pair, creators only,
|
|
105
|
+
`out` first, alias-safe, no allocation and no throw.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { dualCreate, dualMultiply, dualSin, dualVariable } from "@ac-kit/math-complex";
|
|
109
|
+
|
|
110
|
+
// d/dx sin(x²) at x = 2 is 2x·cos(x²) = 4·cos 4.
|
|
111
|
+
const x = dualVariable(2);
|
|
112
|
+
const out = dualCreate();
|
|
113
|
+
dualSin(out, dualMultiply(out, x, x)); // [sin 4, 4·cos 4]
|
|
114
|
+
```
|
|
115
|
+
|
|
60
116
|
## Quaternions
|
|
61
117
|
|
|
62
118
|
A quaternion is a plain array `[x, y, z, w]` — vector part first, scalar part
|
|
@@ -111,23 +167,25 @@ compiler cannot stop them: pass them through `quaternionFromArray`. The
|
|
|
111
167
|
|
|
112
168
|
```ts
|
|
113
169
|
import {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
170
|
+
complexCreate,
|
|
171
|
+
complexLength,
|
|
172
|
+
complexMultiply,
|
|
173
|
+
complexOf,
|
|
117
174
|
quaternionCreate,
|
|
118
175
|
quaternionMultiply,
|
|
119
176
|
quaternionNormalize,
|
|
120
177
|
quaternionOf,
|
|
121
178
|
} from "@ac-kit/math-complex";
|
|
122
179
|
|
|
123
|
-
|
|
124
|
-
|
|
180
|
+
const i = complexOf(0, 1);
|
|
181
|
+
complexMultiply(complexCreate(), i, i); // [-1, 0]
|
|
182
|
+
complexLength(complexOf(3, 4)); // 5
|
|
125
183
|
|
|
126
|
-
const
|
|
127
|
-
const
|
|
184
|
+
const qi = quaternionOf(1, 0, 0, 0);
|
|
185
|
+
const qj = quaternionOf(0, 1, 0, 0);
|
|
128
186
|
const out = quaternionCreate();
|
|
129
|
-
quaternionMultiply(out,
|
|
130
|
-
quaternionMultiply(out,
|
|
187
|
+
quaternionMultiply(out, qi, qj); // [0, 0, 1, 0]: ij = k
|
|
188
|
+
quaternionMultiply(out, qj, qi); // [0, 0, -1, 0]: ji = −k
|
|
131
189
|
quaternionNormalize(out, quaternionOf(0, 0, 0, 4)); // [0, 0, 0, 1]
|
|
132
190
|
```
|
|
133
191
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Field } from "@ac-kit/math-algebra";
|
|
2
|
+
import { type Complex } from "./complex.js";
|
|
3
|
+
/**
|
|
4
|
+
* ℂ as field evidence, for the generic algorithms of `@ac-kit/math-algebra`
|
|
5
|
+
* (`power`, and any algorithm written against `Field<T>`): the out-first
|
|
6
|
+
* functions of this module, each writing into a new {@link Complex}, since
|
|
7
|
+
* evidence returns values.
|
|
8
|
+
*
|
|
9
|
+
* Every operation returns a fresh pair and never writes to its operands, and
|
|
10
|
+
* `zero` and `one` are new pairs at each read, so a result can be used as the
|
|
11
|
+
* `out` of an out-first function without changing anything shared. The
|
|
12
|
+
* arithmetic is the plain one of {@link complexMultiply}, with
|
|
13
|
+
* {@link complexDivide}'s Smith division; `eq` is {@link complexEquals}'s exact
|
|
14
|
+
* equality, so floating-point results only satisfy the field laws to rounding.
|
|
15
|
+
* Zero has no inverse: `inv` and `div` by zero give `NaN` parts.
|
|
16
|
+
*
|
|
17
|
+
* For a loop over many values, the out-first functions with a reused `out`
|
|
18
|
+
* allocate nothing; this evidence allocates one pair per operation.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { power } from "@ac-kit/math-algebra";
|
|
23
|
+
*
|
|
24
|
+
* power(complexOf(0, 1), 3, complexField); // [-0, -1], i³ = −i
|
|
25
|
+
* ```;
|
|
26
|
+
*/
|
|
27
|
+
export declare const complexField: Field<Complex>;
|
|
28
|
+
//# sourceMappingURL=complex-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complex-field.d.ts","sourceRoot":"","sources":["../../src/complex/complex-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EACN,KAAK,OAAO,EAUZ,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,OAAO,CAcvC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { complexAdd, complexCreate, complexDivide, complexEquals, complexInvert, complexMultiply, complexNegate, complexOf, complexSubtract, } from "./complex.js";
|
|
2
|
+
/**
|
|
3
|
+
* ℂ as field evidence, for the generic algorithms of `@ac-kit/math-algebra`
|
|
4
|
+
* (`power`, and any algorithm written against `Field<T>`): the out-first
|
|
5
|
+
* functions of this module, each writing into a new {@link Complex}, since
|
|
6
|
+
* evidence returns values.
|
|
7
|
+
*
|
|
8
|
+
* Every operation returns a fresh pair and never writes to its operands, and
|
|
9
|
+
* `zero` and `one` are new pairs at each read, so a result can be used as the
|
|
10
|
+
* `out` of an out-first function without changing anything shared. The
|
|
11
|
+
* arithmetic is the plain one of {@link complexMultiply}, with
|
|
12
|
+
* {@link complexDivide}'s Smith division; `eq` is {@link complexEquals}'s exact
|
|
13
|
+
* equality, so floating-point results only satisfy the field laws to rounding.
|
|
14
|
+
* Zero has no inverse: `inv` and `div` by zero give `NaN` parts.
|
|
15
|
+
*
|
|
16
|
+
* For a loop over many values, the out-first functions with a reused `out`
|
|
17
|
+
* allocate nothing; this evidence allocates one pair per operation.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { power } from "@ac-kit/math-algebra";
|
|
22
|
+
*
|
|
23
|
+
* power(complexOf(0, 1), 3, complexField); // [-0, -1], i³ = −i
|
|
24
|
+
* ```;
|
|
25
|
+
*/
|
|
26
|
+
export const complexField = {
|
|
27
|
+
get zero() {
|
|
28
|
+
return complexCreate();
|
|
29
|
+
},
|
|
30
|
+
get one() {
|
|
31
|
+
return complexOf(1, 0);
|
|
32
|
+
},
|
|
33
|
+
add: (a, b) => complexAdd(complexCreate(), a, b),
|
|
34
|
+
sub: (a, b) => complexSubtract(complexCreate(), a, b),
|
|
35
|
+
neg: (a) => complexNegate(complexCreate(), a),
|
|
36
|
+
mul: (a, b) => complexMultiply(complexCreate(), a, b),
|
|
37
|
+
eq: complexEquals,
|
|
38
|
+
inv: (a) => complexInvert(complexCreate(), a),
|
|
39
|
+
div: (a, b) => complexDivide(complexCreate(), a, b),
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=complex-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complex-field.js","sourceRoot":"","sources":["../../src/complex/complex-field.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,UAAU,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,GACf,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC3C,IAAI,IAAI;QACP,OAAO,aAAa,EAAE,CAAC;IACxB,CAAC;IACD,IAAI,GAAG;QACN,OAAO,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IAChD,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACrD,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC7C,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACrD,EAAE,EAAE,aAAa;IACjB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC7C,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;CACnD,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { IField } from "@ac-kit/math-algebra";
|
|
2
|
-
import { Complex } from "./complex.js";
|
|
2
|
+
import { type Complex, type ReadonlyComplex } from "./complex.js";
|
|
3
3
|
/**
|
|
4
4
|
* A complex number `re + im·i`, boxed as a value with its own field API.
|
|
5
5
|
*
|
|
6
|
-
* The contract shell over {@link Complex}
|
|
7
|
-
*
|
|
6
|
+
* The contract shell over {@link Complex}, for algebra written against
|
|
7
|
+
* `IField`, not for loops: it allocates one pair per operation. A value never
|
|
8
|
+
* changes: the pairs that go in and out are copies. Its results are those of
|
|
9
|
+
* its 0.2 release, bit for bit: the compensated product
|
|
10
|
+
* ({@link complexMultiplyPrecise}), Smith's quotient with each `x·y ± z·w`
|
|
11
|
+
* compensated, the inverse `conj(z) / |z|²` and `Math.hypot`'s modulus; the
|
|
12
|
+
* other operations delegate to the out-first functions in `complex.ts`.
|
|
8
13
|
*
|
|
9
14
|
* ```ts
|
|
10
15
|
* const z = ComplexNum.from(3, 4);
|
|
@@ -23,27 +28,40 @@ export declare class ComplexNum implements IField<ComplexNum> {
|
|
|
23
28
|
static readonly I: ComplexNum;
|
|
24
29
|
/** Creates a complex number from its real and imaginary parts. */
|
|
25
30
|
static from(re: number, im?: number): ComplexNum;
|
|
26
|
-
/** Wraps an already-computed {@link Complex}
|
|
27
|
-
static fromTuple(value:
|
|
28
|
-
/**
|
|
31
|
+
/** Wraps a copy of an already-computed {@link Complex} pair. */
|
|
32
|
+
static fromTuple(value: ReadonlyComplex): ComplexNum;
|
|
33
|
+
/** A copy of the underlying pair, for callers working at the arithmetic layer. */
|
|
29
34
|
toTuple(): Complex;
|
|
30
35
|
/** Real part `a` of `a + bi`. */
|
|
31
36
|
get re(): number;
|
|
32
37
|
/** Imaginary part `b` of `a + bi`. */
|
|
33
38
|
get im(): number;
|
|
34
|
-
/** Modulus `|z| = √(re² + im²)`. Always non-negative. */
|
|
39
|
+
/** Modulus `|z| = √(re² + im²)`, by `Math.hypot`. Always non-negative. */
|
|
35
40
|
abs(): number;
|
|
36
|
-
/** Argument `arg(z) = atan2(im, re) ∈
|
|
41
|
+
/** Argument `arg(z) = atan2(im, re) ∈ [−π, π]`. */
|
|
37
42
|
arg(): number;
|
|
38
43
|
/** `conj(a + bi) = a − bi`. */
|
|
39
44
|
conj(): ComplexNum;
|
|
40
45
|
add(other: ComplexNum): ComplexNum;
|
|
41
46
|
sub(other: ComplexNum): ComplexNum;
|
|
42
47
|
neg(): ComplexNum;
|
|
48
|
+
/** Product `this · other`, each part within 1.5 ulps of its exact value. */
|
|
43
49
|
mul(other: ComplexNum): ComplexNum;
|
|
44
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Multiplicative inverse `1 / z = conj(z) / |z|²`. The squared modulus
|
|
52
|
+
* overflows for `|z|` beyond about `1e154` and underflows below `1e-154`;
|
|
53
|
+
* `complexInvert` holds at every magnitude.
|
|
54
|
+
*
|
|
55
|
+
* @throws {RangeError} When called on zero, the only value without one.
|
|
56
|
+
*/
|
|
45
57
|
inv(): ComplexNum;
|
|
46
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Quotient `this / other`, by Smith's algorithm with each `x·y ± z·w`
|
|
60
|
+
* compensated (`@ac-kit/math-scalar`'s `sumOfProducts` and
|
|
61
|
+
* `diffOfProducts`).
|
|
62
|
+
*
|
|
63
|
+
* @throws {RangeError} When `other` is zero.
|
|
64
|
+
*/
|
|
47
65
|
div(other: ComplexNum): ComplexNum;
|
|
48
66
|
}
|
|
49
67
|
//# sourceMappingURL=complex-num.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complex-num.d.ts","sourceRoot":"","sources":["../../src/complex/complex-num.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"complex-num.d.ts","sourceRoot":"","sources":["../../src/complex/complex-num.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EACN,KAAK,OAAO,EAUZ,KAAK,eAAe,EACpB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,UAAW,YAAW,MAAM,CAAC,UAAU,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC,OAAO,eAEN;IAED,mCAAmC;IACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAmC;IAEnE,mCAAmC;IACnC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAmC;IAElE,oDAAoD;IACpD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAmC;IAEhE,kEAAkE;IAClE,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,SAAI,GAAG,UAAU,CAE1C;IAED,gEAAgE;IAChE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CAEnD;IAED,kFAAkF;IAClF,OAAO,IAAI,OAAO,CAEjB;IAED,iCAAiC;IACjC,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,sCAAsC;IACtC,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,0EAA0E;IAC1E,GAAG,IAAI,MAAM,CAEZ;IAED,mDAAmD;IACnD,GAAG,IAAI,MAAM,CAEZ;IAED,+BAA+B;IAC/B,IAAI,IAAI,UAAU,CAEjB;IAED,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAIjC;IAED,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAIjC;IAED,GAAG,IAAI,UAAU,CAEhB;IAED,4EAA4E;IAC5E,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAIjC;IAED;;;;;;OAMG;IACH,GAAG,IAAI,UAAU,CAQhB;IAED;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAwBjC;CACD"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { diffOfProducts, sumOfProducts } from "@ac-kit/math-scalar";
|
|
2
|
+
import { complexAdd, complexArgument, complexClone, complexConjugate, complexCreate, complexMultiplyPrecise, complexNegate, complexOf, complexSubtract, } from "./complex.js";
|
|
2
3
|
/**
|
|
3
4
|
* A complex number `re + im·i`, boxed as a value with its own field API.
|
|
4
5
|
*
|
|
5
|
-
* The contract shell over {@link Complex}
|
|
6
|
-
*
|
|
6
|
+
* The contract shell over {@link Complex}, for algebra written against
|
|
7
|
+
* `IField`, not for loops: it allocates one pair per operation. A value never
|
|
8
|
+
* changes: the pairs that go in and out are copies. Its results are those of
|
|
9
|
+
* its 0.2 release, bit for bit: the compensated product
|
|
10
|
+
* ({@link complexMultiplyPrecise}), Smith's quotient with each `x·y ± z·w`
|
|
11
|
+
* compensated, the inverse `conj(z) / |z|²` and `Math.hypot`'s modulus; the
|
|
12
|
+
* other operations delegate to the out-first functions in `complex.ts`.
|
|
7
13
|
*
|
|
8
14
|
* ```ts
|
|
9
15
|
* const z = ComplexNum.from(3, 4);
|
|
@@ -17,22 +23,22 @@ export class ComplexNum {
|
|
|
17
23
|
this.value_ = value;
|
|
18
24
|
}
|
|
19
25
|
/** The complex number `0 + 0i`. */
|
|
20
|
-
static ZERO = new ComplexNum(
|
|
26
|
+
static ZERO = new ComplexNum(complexCreate());
|
|
21
27
|
/** The complex number `1 + 0i`. */
|
|
22
|
-
static ONE = new ComplexNum(
|
|
28
|
+
static ONE = new ComplexNum(complexOf(1, 0));
|
|
23
29
|
/** The imaginary unit `i`, satisfying `i² = −1`. */
|
|
24
|
-
static I = new ComplexNum(
|
|
30
|
+
static I = new ComplexNum(complexOf(0, 1));
|
|
25
31
|
/** Creates a complex number from its real and imaginary parts. */
|
|
26
32
|
static from(re, im = 0) {
|
|
27
|
-
return new ComplexNum(
|
|
33
|
+
return new ComplexNum(complexOf(re, im));
|
|
28
34
|
}
|
|
29
|
-
/** Wraps an already-computed {@link Complex}
|
|
35
|
+
/** Wraps a copy of an already-computed {@link Complex} pair. */
|
|
30
36
|
static fromTuple(value) {
|
|
31
|
-
return new ComplexNum(value);
|
|
37
|
+
return new ComplexNum(complexClone(value));
|
|
32
38
|
}
|
|
33
|
-
/**
|
|
39
|
+
/** A copy of the underlying pair, for callers working at the arithmetic layer. */
|
|
34
40
|
toTuple() {
|
|
35
|
-
return this.value_;
|
|
41
|
+
return complexClone(this.value_);
|
|
36
42
|
}
|
|
37
43
|
/** Real part `a` of `a + bi`. */
|
|
38
44
|
get re() {
|
|
@@ -42,37 +48,68 @@ export class ComplexNum {
|
|
|
42
48
|
get im() {
|
|
43
49
|
return this.value_[1];
|
|
44
50
|
}
|
|
45
|
-
/** Modulus `|z| = √(re² + im²)`. Always non-negative. */
|
|
51
|
+
/** Modulus `|z| = √(re² + im²)`, by `Math.hypot`. Always non-negative. */
|
|
46
52
|
abs() {
|
|
47
|
-
return
|
|
53
|
+
return Math.hypot(this.value_[0], this.value_[1]);
|
|
48
54
|
}
|
|
49
|
-
/** Argument `arg(z) = atan2(im, re) ∈
|
|
55
|
+
/** Argument `arg(z) = atan2(im, re) ∈ [−π, π]`. */
|
|
50
56
|
arg() {
|
|
51
57
|
return complexArgument(this.value_);
|
|
52
58
|
}
|
|
53
59
|
/** `conj(a + bi) = a − bi`. */
|
|
54
60
|
conj() {
|
|
55
|
-
return new ComplexNum(complexConjugate(this.value_));
|
|
61
|
+
return new ComplexNum(complexConjugate(complexCreate(), this.value_));
|
|
56
62
|
}
|
|
57
63
|
add(other) {
|
|
58
|
-
return new ComplexNum(complexAdd(this.value_, other.value_));
|
|
64
|
+
return new ComplexNum(complexAdd(complexCreate(), this.value_, other.value_));
|
|
59
65
|
}
|
|
60
66
|
sub(other) {
|
|
61
|
-
return new ComplexNum(
|
|
67
|
+
return new ComplexNum(complexSubtract(complexCreate(), this.value_, other.value_));
|
|
62
68
|
}
|
|
63
69
|
neg() {
|
|
64
|
-
return new ComplexNum(
|
|
70
|
+
return new ComplexNum(complexNegate(complexCreate(), this.value_));
|
|
65
71
|
}
|
|
72
|
+
/** Product `this · other`, each part within 1.5 ulps of its exact value. */
|
|
66
73
|
mul(other) {
|
|
67
|
-
return new ComplexNum(
|
|
74
|
+
return new ComplexNum(complexMultiplyPrecise(complexCreate(), this.value_, other.value_));
|
|
68
75
|
}
|
|
69
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Multiplicative inverse `1 / z = conj(z) / |z|²`. The squared modulus
|
|
78
|
+
* overflows for `|z|` beyond about `1e154` and underflows below `1e-154`;
|
|
79
|
+
* `complexInvert` holds at every magnitude.
|
|
80
|
+
*
|
|
81
|
+
* @throws {RangeError} When called on zero, the only value without one.
|
|
82
|
+
*/
|
|
70
83
|
inv() {
|
|
71
|
-
|
|
84
|
+
const re = this.value_[0];
|
|
85
|
+
const im = this.value_[1];
|
|
86
|
+
const normSq = re * re + im * im;
|
|
87
|
+
if (normSq === 0) {
|
|
88
|
+
throw new RangeError("Cannot invert a zero complex number.");
|
|
89
|
+
}
|
|
90
|
+
return new ComplexNum(complexOf(re / normSq, -im / normSq));
|
|
72
91
|
}
|
|
73
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Quotient `this / other`, by Smith's algorithm with each `x·y ± z·w`
|
|
94
|
+
* compensated (`@ac-kit/math-scalar`'s `sumOfProducts` and
|
|
95
|
+
* `diffOfProducts`).
|
|
96
|
+
*
|
|
97
|
+
* @throws {RangeError} When `other` is zero.
|
|
98
|
+
*/
|
|
74
99
|
div(other) {
|
|
75
|
-
|
|
100
|
+
const [ar, ai] = this.value_;
|
|
101
|
+
const [br, bi] = other.value_;
|
|
102
|
+
if (br === 0 && bi === 0) {
|
|
103
|
+
throw new RangeError("Cannot divide by a zero complex number.");
|
|
104
|
+
}
|
|
105
|
+
if (Math.abs(br) >= Math.abs(bi)) {
|
|
106
|
+
const ratio = bi / br;
|
|
107
|
+
const denominator = sumOfProducts(br, 1, bi, ratio);
|
|
108
|
+
return new ComplexNum(complexOf(sumOfProducts(ar, 1, ai, ratio) / denominator, diffOfProducts(ai, 1, ar, ratio) / denominator));
|
|
109
|
+
}
|
|
110
|
+
const ratio = br / bi;
|
|
111
|
+
const denominator = sumOfProducts(br, ratio, bi, 1);
|
|
112
|
+
return new ComplexNum(complexOf(sumOfProducts(ar, ratio, ai, 1) / denominator, diffOfProducts(ai, ratio, ar, 1) / denominator));
|
|
76
113
|
}
|
|
77
114
|
}
|
|
78
115
|
//# sourceMappingURL=complex-num.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complex-num.js","sourceRoot":"","sources":["../../src/complex/complex-num.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"complex-num.js","sourceRoot":"","sources":["../../src/complex/complex-num.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpE,OAAO,EAEN,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,SAAS,EACT,eAAe,GAEf,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,UAAU;IACL,MAAM,CAAU;IAEjC,YAAoB,KAAc;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,mCAAmC;IACnC,MAAM,CAAU,IAAI,GAAe,IAAI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