symcrys 0.10.1 → 0.11.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/README.md +6 -6
- package/dist/cell.d.ts +19 -16
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js +63 -35
- package/dist/cell.js.map +1 -1
- package/dist/checks.d.ts +29 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +79 -0
- package/dist/checks.js.map +1 -0
- package/dist/closure.d.ts +43 -0
- package/dist/closure.d.ts.map +1 -0
- package/dist/closure.js +201 -0
- package/dist/closure.js.map +1 -0
- package/dist/crystalClasses.d.ts +145 -117
- package/dist/crystalClasses.d.ts.map +1 -1
- package/dist/crystalClasses.js +161 -121
- package/dist/crystalClasses.js.map +1 -1
- package/dist/freeze.d.ts +7 -0
- package/dist/freeze.d.ts.map +1 -0
- package/dist/freeze.js +15 -0
- package/dist/freeze.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/indices.d.ts +31 -5
- package/dist/indices.d.ts.map +1 -1
- package/dist/indices.js +104 -13
- package/dist/indices.js.map +1 -1
- package/dist/lattice.d.ts +15 -1
- package/dist/lattice.d.ts.map +1 -1
- package/dist/lattice.js +30 -1
- package/dist/lattice.js.map +1 -1
- package/dist/linalg.d.ts +2 -2
- package/dist/linalg.d.ts.map +1 -1
- package/dist/linalg.js +3 -3
- package/dist/linalg.js.map +1 -1
- package/dist/magnetic.d.ts +12 -10
- package/dist/magnetic.d.ts.map +1 -1
- package/dist/magnetic.js +8 -6
- package/dist/magnetic.js.map +1 -1
- package/dist/notation.d.ts +16 -0
- package/dist/notation.d.ts.map +1 -0
- package/dist/notation.js +66 -0
- package/dist/notation.js.map +1 -0
- package/dist/operations.d.ts +40 -26
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +48 -60
- package/dist/operations.js.map +1 -1
- package/dist/plane.d.ts +141 -79
- package/dist/plane.d.ts.map +1 -1
- package/dist/plane.js +147 -77
- package/dist/plane.js.map +1 -1
- package/dist/pointGroups/crystalForms.d.ts +6 -21
- package/dist/pointGroups/crystalForms.d.ts.map +1 -1
- package/dist/pointGroups/crystalForms.js +9 -16
- package/dist/pointGroups/crystalForms.js.map +1 -1
- package/dist/pointGroups/crystalFormsData.d.ts +4 -1
- package/dist/pointGroups/crystalFormsData.d.ts.map +1 -1
- package/dist/pointGroups/crystalFormsData.js +64 -1
- package/dist/pointGroups/crystalFormsData.js.map +1 -1
- package/dist/pointGroups/elements.d.ts +19 -17
- package/dist/pointGroups/elements.d.ts.map +1 -1
- package/dist/pointGroups/elements.js +65 -83
- package/dist/pointGroups/elements.js.map +1 -1
- package/dist/pointGroups/identify.d.ts +10 -18
- package/dist/pointGroups/identify.d.ts.map +1 -1
- package/dist/pointGroups/identify.js +27 -79
- package/dist/pointGroups/identify.js.map +1 -1
- package/dist/pointGroups/itaOrder.d.ts +15 -14
- package/dist/pointGroups/itaOrder.d.ts.map +1 -1
- package/dist/pointGroups/itaOrder.js +116 -94
- package/dist/pointGroups/itaOrder.js.map +1 -1
- package/dist/pointGroups/itcData.d.ts +96 -0
- package/dist/pointGroups/itcData.d.ts.map +1 -0
- package/dist/pointGroups/itcData.js +336 -0
- package/dist/pointGroups/itcData.js.map +1 -0
- package/dist/pointGroups/itcMagneticData.d.ts +55 -0
- package/dist/pointGroups/itcMagneticData.d.ts.map +1 -0
- package/dist/pointGroups/itcMagneticData.js +172 -0
- package/dist/pointGroups/itcMagneticData.js.map +1 -0
- package/dist/pointGroups/keys.d.ts +32 -0
- package/dist/pointGroups/keys.d.ts.map +1 -0
- package/dist/pointGroups/keys.js +120 -0
- package/dist/pointGroups/keys.js.map +1 -0
- package/dist/pointGroups/magneticSymbols.d.ts +6 -5
- package/dist/pointGroups/magneticSymbols.d.ts.map +1 -1
- package/dist/pointGroups/magneticSymbols.js +15 -12
- package/dist/pointGroups/magneticSymbols.js.map +1 -1
- package/dist/pointGroups/orbits.d.ts +23 -42
- package/dist/pointGroups/orbits.d.ts.map +1 -1
- package/dist/pointGroups/orbits.js +20 -62
- package/dist/pointGroups/orbits.js.map +1 -1
- package/dist/pointGroups/pointGroups.d.ts +135 -67
- package/dist/pointGroups/pointGroups.d.ts.map +1 -1
- package/dist/pointGroups/pointGroups.js +409 -244
- package/dist/pointGroups/pointGroups.js.map +1 -1
- package/dist/pointGroups/properties.d.ts +21 -22
- package/dist/pointGroups/properties.d.ts.map +1 -1
- package/dist/pointGroups/properties.js +40 -37
- package/dist/pointGroups/properties.js.map +1 -1
- package/dist/pointGroups/seitzData.d.ts +26 -0
- package/dist/pointGroups/seitzData.d.ts.map +1 -0
- package/dist/pointGroups/seitzData.js +130 -0
- package/dist/pointGroups/seitzData.js.map +1 -0
- package/dist/pointGroups/wyckoff.d.ts +70 -40
- package/dist/pointGroups/wyckoff.d.ts.map +1 -1
- package/dist/pointGroups/wyckoff.js +98 -91
- package/dist/pointGroups/wyckoff.js.map +1 -1
- package/dist/pointGroups/wyckoffData.d.ts +7 -4
- package/dist/pointGroups/wyckoffData.d.ts.map +1 -1
- package/dist/pointGroups/wyckoffData.js +789 -168
- package/dist/pointGroups/wyckoffData.js.map +1 -1
- package/dist/siteSymmetry.d.ts +8 -16
- package/dist/siteSymmetry.d.ts.map +1 -1
- package/dist/siteSymmetry.js +34 -24
- package/dist/siteSymmetry.js.map +1 -1
- package/dist/spaceGroups/affine.d.ts.map +1 -1
- package/dist/spaceGroups/affine.js +3 -2
- package/dist/spaceGroups/affine.js.map +1 -1
- package/dist/spaceGroups/cell.d.ts +43 -31
- package/dist/spaceGroups/cell.d.ts.map +1 -1
- package/dist/spaceGroups/cell.js +173 -85
- package/dist/spaceGroups/cell.js.map +1 -1
- package/dist/spaceGroups/describe.d.ts +12 -10
- package/dist/spaceGroups/describe.d.ts.map +1 -1
- package/dist/spaceGroups/describe.js +11 -10
- package/dist/spaceGroups/describe.js.map +1 -1
- package/dist/spaceGroups/planeGroupData.d.ts +1 -1
- package/dist/spaceGroups/planeGroupData.d.ts.map +1 -1
- package/dist/spaceGroups/planeGroupData.js +8 -8
- package/dist/spaceGroups/planeGroupData.js.map +1 -1
- package/dist/spaceGroups/planeGroups.d.ts.map +1 -1
- package/dist/spaceGroups/planeGroups.js +2 -1
- package/dist/spaceGroups/planeGroups.js.map +1 -1
- package/dist/spaceGroups/positions.d.ts +48 -19
- package/dist/spaceGroups/positions.d.ts.map +1 -1
- package/dist/spaceGroups/positions.js +166 -67
- package/dist/spaceGroups/positions.js.map +1 -1
- package/dist/tensors/propertyTable.d.ts +3 -1
- package/dist/tensors/propertyTable.d.ts.map +1 -1
- package/dist/tensors/propertyTable.js +17 -10
- package/dist/tensors/propertyTable.js.map +1 -1
- package/dist/tensors/rowEchelon.d.ts +3 -3
- package/dist/tensors/rowEchelon.d.ts.map +1 -1
- package/dist/tensors/rowEchelon.js +4 -4
- package/dist/tensors/rowEchelon.js.map +1 -1
- package/dist/tensors/tensorForm.d.ts +75 -34
- package/dist/tensors/tensorForm.d.ts.map +1 -1
- package/dist/tensors/tensorForm.js +171 -67
- package/dist/tensors/tensorForm.js.map +1 -1
- package/dist/tensors/tensorProperties.d.ts +10 -9
- package/dist/tensors/tensorProperties.d.ts.map +1 -1
- package/dist/tensors/tensorProperties.js +22 -12
- package/dist/tensors/tensorProperties.js.map +1 -1
- package/dist/tolerances.d.ts +56 -1
- package/dist/tolerances.d.ts.map +1 -1
- package/dist/tolerances.js +51 -1
- package/dist/tolerances.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/cell.ts +78 -51
- package/src/checks.ts +84 -0
- package/src/closure.ts +214 -0
- package/src/crystalClasses.ts +232 -157
- package/src/freeze.ts +14 -0
- package/src/index.ts +21 -10
- package/src/indices.ts +108 -18
- package/src/lattice.ts +41 -1
- package/src/linalg.ts +3 -3
- package/src/magnetic.ts +14 -9
- package/src/notation.ts +73 -0
- package/src/operations.ts +78 -71
- package/src/plane.ts +253 -127
- package/src/pointGroups/crystalForms.ts +11 -44
- package/src/pointGroups/crystalFormsData.ts +66 -1
- package/src/pointGroups/elements.ts +82 -92
- package/src/pointGroups/identify.ts +38 -97
- package/src/pointGroups/itaOrder.ts +117 -101
- package/src/pointGroups/itcData.ts +404 -0
- package/src/pointGroups/itcMagneticData.ts +206 -0
- package/src/pointGroups/keys.ts +144 -0
- package/src/pointGroups/magneticSymbols.ts +18 -17
- package/src/pointGroups/orbits.ts +41 -89
- package/src/pointGroups/pointGroups.ts +540 -297
- package/src/pointGroups/properties.ts +44 -40
- package/src/pointGroups/seitzData.ts +147 -0
- package/src/pointGroups/wyckoff.ts +137 -112
- package/src/pointGroups/wyckoffData.ts +793 -170
- package/src/siteSymmetry.ts +43 -40
- package/src/spaceGroups/affine.ts +3 -2
- package/src/spaceGroups/cell.ts +227 -116
- package/src/spaceGroups/describe.ts +22 -19
- package/src/spaceGroups/planeGroupData.ts +9 -9
- package/src/spaceGroups/planeGroups.ts +2 -1
- package/src/spaceGroups/positions.ts +202 -78
- package/src/tensors/propertyTable.ts +26 -14
- package/src/tensors/rowEchelon.ts +4 -3
- package/src/tensors/tensorForm.ts +258 -88
- package/src/tensors/tensorProperties.ts +34 -14
- package/src/tolerances.ts +66 -1
- package/src/version.ts +1 -1
- package/dist/pointGroups/data.d.ts +0 -75
- package/dist/pointGroups/data.d.ts.map +0 -1
- package/dist/pointGroups/data.js +0 -212
- package/dist/pointGroups/data.js.map +0 -1
- package/dist/pointGroups/magneticData.d.ts +0 -66
- package/dist/pointGroups/magneticData.d.ts.map +0 -1
- package/dist/pointGroups/magneticData.js +0 -184
- package/dist/pointGroups/magneticData.js.map +0 -1
- package/dist/spaceGroups/snap.d.ts +0 -20
- package/dist/spaceGroups/snap.d.ts.map +0 -1
- package/dist/spaceGroups/snap.js +0 -103
- package/dist/spaceGroups/snap.js.map +0 -1
- package/src/pointGroups/data.ts +0 -305
- package/src/pointGroups/magneticData.ts +0 -328
- package/src/spaceGroups/snap.ts +0 -121
package/dist/closure.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The group generated by operations a caller passes in, within a tolerance, and that group made
|
|
3
|
+
* exact (docs/conventions.md, "Tolerances"). Operations read from a file or computed elsewhere carry
|
|
4
|
+
* rounding errors (√3/2 written as 0.866025); compared within the tolerance they still generate the
|
|
5
|
+
* right group, but its matrices are not exactly a group, and a tensor form computed from them has
|
|
6
|
+
* the wrong number of free parameters (#89). `idealGroup` therefore replaces them by the exact group
|
|
7
|
+
* nearest to them before anything is computed from them.
|
|
8
|
+
*/
|
|
9
|
+
import { det, inverse, multiply, snap, trace, transpose } from './linalg.js';
|
|
10
|
+
import { IDEAL_PASSES, IDEAL_SETTLED, IDEAL_SNAP, IDEAL_UNSETTLED, PRODUCT_MATCH } from './tolerances.js';
|
|
11
|
+
const IDENTITY = {
|
|
12
|
+
cartesian: [
|
|
13
|
+
[1, 0, 0],
|
|
14
|
+
[0, 1, 0],
|
|
15
|
+
[0, 0, 1],
|
|
16
|
+
],
|
|
17
|
+
timeReversal: false,
|
|
18
|
+
};
|
|
19
|
+
/** No finite group of Cartesian operations that symcrys computes with has more elements (m-3m1' has 96). */
|
|
20
|
+
export const MAX_GROUP_ORDER = 200;
|
|
21
|
+
/** True if the two operations agree in time reversal and in every matrix entry within `tolerance`. */
|
|
22
|
+
export function sameWithin(a, b, tolerance) {
|
|
23
|
+
return (a.timeReversal === b.timeReversal &&
|
|
24
|
+
a.cartesian.every((row, i) => row.every((v, j) => Math.abs(v - b.cartesian[i][j]) < tolerance)));
|
|
25
|
+
}
|
|
26
|
+
/** The kind of an operation (rounded trace, sign of the determinant, time reversal): equal operations have the same. */
|
|
27
|
+
const kindOf = (op) => `${Math.round(trace(op.cartesian))}${det(op.cartesian) > 0 ? '+' : '-'}${op.timeReversal ? "'" : ''}`;
|
|
28
|
+
/**
|
|
29
|
+
* The group the operations generate within `tolerance` (two operations equal when they agree in
|
|
30
|
+
* time reversal and in every matrix entry within it), the identity first, then the operations of
|
|
31
|
+
* the list that are new, then products in the order they are found; or undefined if it has more
|
|
32
|
+
* than `maxOrder` elements. A new operation is compared only with the operations of its kind.
|
|
33
|
+
*/
|
|
34
|
+
export function closeWithin(operations, tolerance, maxOrder = MAX_GROUP_ORDER) {
|
|
35
|
+
const group = [];
|
|
36
|
+
const byKind = new Map();
|
|
37
|
+
const has = (op) => (byKind.get(kindOf(op)) ?? []).some((g) => sameWithin(g, op, tolerance));
|
|
38
|
+
const push = (op) => {
|
|
39
|
+
group.push(op);
|
|
40
|
+
const k = kindOf(op);
|
|
41
|
+
const list = byKind.get(k);
|
|
42
|
+
if (list)
|
|
43
|
+
list.push(op);
|
|
44
|
+
else
|
|
45
|
+
byKind.set(k, [op]);
|
|
46
|
+
};
|
|
47
|
+
push(IDENTITY);
|
|
48
|
+
const generators = [];
|
|
49
|
+
for (const s of operations) {
|
|
50
|
+
const op = { cartesian: s.cartesian, timeReversal: s.timeReversal };
|
|
51
|
+
if (has(op))
|
|
52
|
+
continue;
|
|
53
|
+
generators.push(op);
|
|
54
|
+
for (let i = 0; i < group.length; i++) {
|
|
55
|
+
for (const t of generators) {
|
|
56
|
+
const product = {
|
|
57
|
+
cartesian: multiply(group[i].cartesian, t.cartesian),
|
|
58
|
+
timeReversal: group[i].timeReversal !== t.timeReversal,
|
|
59
|
+
};
|
|
60
|
+
if (has(product))
|
|
61
|
+
continue;
|
|
62
|
+
if (group.length >= maxOrder)
|
|
63
|
+
return undefined;
|
|
64
|
+
push(product);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return group;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The group the operations generate within `tolerance` (`closeWithin`); throws a RangeError if it
|
|
72
|
+
* has more than `MAX_GROUP_ORDER` elements.
|
|
73
|
+
*/
|
|
74
|
+
export function closedGroup(operations, tolerance) {
|
|
75
|
+
const group = closeWithin(operations, tolerance);
|
|
76
|
+
if (!group) {
|
|
77
|
+
throw new RangeError(`The operations generate no finite point group within the tolerance ${tolerance} (more than ${MAX_GROUP_ORDER} elements): matrices with errors too large for the tolerance (pass a larger one, about ten times their rounding), or a rotation by an angle that is not 360°/n`);
|
|
78
|
+
}
|
|
79
|
+
return group;
|
|
80
|
+
}
|
|
81
|
+
/** The largest difference of two matrix entries. */
|
|
82
|
+
function distance(a, b) {
|
|
83
|
+
let d = 0;
|
|
84
|
+
for (let i = 0; i < 3; i++)
|
|
85
|
+
for (let j = 0; j < 3; j++)
|
|
86
|
+
d = Math.max(d, Math.abs(a[i][j] - b[i][j]));
|
|
87
|
+
return d;
|
|
88
|
+
}
|
|
89
|
+
const add = (a, b) => a.map((row, i) => row.map((v, j) => v + b[i][j]));
|
|
90
|
+
const scale = (a, s) => a.map((row) => row.map((v) => v * s));
|
|
91
|
+
/**
|
|
92
|
+
* The square root of a symmetric positive definite matrix and its inverse, by the iteration of
|
|
93
|
+
* Denman and Beavers (Y ← (Y + Z⁻¹)/2, Z ← (Z + Y⁻¹)/2 from Y = M, Z = 1), which converges
|
|
94
|
+
* quadratically; here M lies near the identity.
|
|
95
|
+
*/
|
|
96
|
+
function squareRoots(m) {
|
|
97
|
+
let y = m;
|
|
98
|
+
let z = IDENTITY.cartesian;
|
|
99
|
+
for (let pass = 0; pass < IDEAL_PASSES; pass++) {
|
|
100
|
+
const nextY = scale(add(y, inverse(z)), 0.5);
|
|
101
|
+
const nextZ = scale(add(z, inverse(y)), 0.5);
|
|
102
|
+
const change = distance(nextY, y);
|
|
103
|
+
y = nextY;
|
|
104
|
+
z = nextZ;
|
|
105
|
+
if (change < IDEAL_SETTLED)
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return [y, z];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The group generated by `operations` within `tolerance` (`closeWithin`, at most `MAX_GROUP_ORDER`
|
|
112
|
+
* elements), made exact: each matrix f(x) is replaced by the mean of f(xy)·f(y)⁻¹ over the group,
|
|
113
|
+
* repeated until nothing changes. For an exact group this is f(x) itself; for matrices that are a
|
|
114
|
+
* group only within a small error the passes settle on an exact representation nearby (tested in
|
|
115
|
+
* closure.test.ts and tensors/tolerance.test.ts), and the invariant metric of the result makes it
|
|
116
|
+
* orthogonal. Entries within 10⁻¹² of 0, ±1/2, ±√2/2, ±√3/2, ±1 are then set to them, so that exact
|
|
117
|
+
* input stays exact. Throws a RangeError if the operations generate more than `MAX_GROUP_ORDER`
|
|
118
|
+
* elements or do not settle into a group (a tolerance too large or too small for their errors).
|
|
119
|
+
*/
|
|
120
|
+
export function idealGroup(operations, tolerance) {
|
|
121
|
+
const group = closedGroup(operations, tolerance);
|
|
122
|
+
const n = group.length;
|
|
123
|
+
// The product table: the element nearest to each product, of the same time reversal, sought
|
|
124
|
+
// among the elements of its kind first and among all if none of them is near enough.
|
|
125
|
+
const byKind = new Map();
|
|
126
|
+
group.forEach((g, k) => {
|
|
127
|
+
const list = byKind.get(kindOf(g));
|
|
128
|
+
if (list)
|
|
129
|
+
list.push(k);
|
|
130
|
+
else
|
|
131
|
+
byKind.set(kindOf(g), [k]);
|
|
132
|
+
});
|
|
133
|
+
const all = group.map((_, k) => k);
|
|
134
|
+
const nearest = (product, candidates) => {
|
|
135
|
+
let best = -1;
|
|
136
|
+
let bestDistance = Infinity;
|
|
137
|
+
for (const k of candidates) {
|
|
138
|
+
if (group[k].timeReversal !== product.timeReversal)
|
|
139
|
+
continue;
|
|
140
|
+
const d = distance(group[k].cartesian, product.cartesian);
|
|
141
|
+
if (d < bestDistance) {
|
|
142
|
+
best = k;
|
|
143
|
+
bestDistance = d;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return bestDistance < PRODUCT_MATCH ? best : -1;
|
|
147
|
+
};
|
|
148
|
+
const table = group.map((a) => group.map((b) => {
|
|
149
|
+
const product = {
|
|
150
|
+
cartesian: multiply(a.cartesian, b.cartesian),
|
|
151
|
+
timeReversal: a.timeReversal !== b.timeReversal,
|
|
152
|
+
};
|
|
153
|
+
let k = nearest(product, byKind.get(kindOf(product)) ?? []);
|
|
154
|
+
if (k < 0)
|
|
155
|
+
k = nearest(product, all);
|
|
156
|
+
if (k < 0)
|
|
157
|
+
throw new RangeError(`The operations do not form a group within the tolerance ${tolerance}`);
|
|
158
|
+
return k;
|
|
159
|
+
}));
|
|
160
|
+
let f = group.map((g) => g.cartesian);
|
|
161
|
+
for (let pass = 0;; pass++) {
|
|
162
|
+
const inverses = f.map(inverse);
|
|
163
|
+
const next = f.map((_, x) => {
|
|
164
|
+
const sum = [
|
|
165
|
+
[0, 0, 0],
|
|
166
|
+
[0, 0, 0],
|
|
167
|
+
[0, 0, 0],
|
|
168
|
+
];
|
|
169
|
+
for (let y = 0; y < n; y++) {
|
|
170
|
+
const p = multiply(f[table[x][y]], inverses[y]);
|
|
171
|
+
for (let i = 0; i < 3; i++)
|
|
172
|
+
for (let j = 0; j < 3; j++)
|
|
173
|
+
sum[i][j] += p[i][j] / n;
|
|
174
|
+
}
|
|
175
|
+
return sum;
|
|
176
|
+
});
|
|
177
|
+
const change = Math.max(...next.map((m, k) => distance(m, f[k])));
|
|
178
|
+
f = next;
|
|
179
|
+
if (change < IDEAL_SETTLED)
|
|
180
|
+
break;
|
|
181
|
+
if (pass >= IDEAL_PASSES) {
|
|
182
|
+
if (change < IDEAL_UNSETTLED)
|
|
183
|
+
break;
|
|
184
|
+
throw new RangeError(`The operations do not settle into a group within the tolerance ${tolerance}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// The representation is exact but need not be orthogonal: it may be an orthogonal one seen in a
|
|
188
|
+
// slightly oblique frame. Its invariant metric M = (1/n) Σ fᵀf gives that frame, and M^½ f M^-½
|
|
189
|
+
// is orthogonal.
|
|
190
|
+
const metric = f.reduce((sum, m) => add(sum, scale(multiply(transpose(m), m), 1 / n)), scale(IDENTITY.cartesian, 0));
|
|
191
|
+
const [root, inverseRoot] = squareRoots(metric);
|
|
192
|
+
f = f.map((m) => multiply(multiply(root, m), inverseRoot));
|
|
193
|
+
// Only rounding of the last bits is snapped: a group turned by a small angle has entries near the
|
|
194
|
+
// exact values that are not equal to them.
|
|
195
|
+
const exact = f.map((m, k) => ({ cartesian: snap(m, IDEAL_SNAP), timeReversal: group[k].timeReversal }));
|
|
196
|
+
return {
|
|
197
|
+
operations: exact,
|
|
198
|
+
deviation: Math.max(...exact.map((op, k) => distance(op.cartesian, group[k].cartesian))),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=closure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closure.js","sourceRoot":"","sources":["../src/closure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE1G,MAAM,QAAQ,GAAuB;IACnC,SAAS,EAAE;QACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KACV;IACD,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,4GAA4G;AAC5G,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,sGAAsG;AACtG,MAAM,UAAU,UAAU,CAAC,CAAqB,EAAE,CAAqB,EAAE,SAAiB;IACxF,OAAO,CACL,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,YAAY;QACjC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG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