symcrys 0.1.0 → 0.2.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.
Files changed (60) hide show
  1. package/README.md +35 -12
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +5 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/lattice.d.ts +22 -0
  7. package/dist/lattice.d.ts.map +1 -0
  8. package/dist/lattice.js +43 -0
  9. package/dist/lattice.js.map +1 -0
  10. package/dist/linalg.d.ts +32 -0
  11. package/dist/linalg.d.ts.map +1 -0
  12. package/dist/linalg.js +120 -0
  13. package/dist/linalg.js.map +1 -0
  14. package/dist/operations.d.ts +30 -0
  15. package/dist/operations.d.ts.map +1 -0
  16. package/dist/operations.js +49 -0
  17. package/dist/operations.js.map +1 -0
  18. package/dist/pointGroups/data.d.ts +40 -0
  19. package/dist/pointGroups/data.d.ts.map +1 -0
  20. package/dist/pointGroups/data.js +204 -0
  21. package/dist/pointGroups/data.js.map +1 -0
  22. package/dist/pointGroups/elements.d.ts +75 -0
  23. package/dist/pointGroups/elements.d.ts.map +1 -0
  24. package/dist/pointGroups/elements.js +181 -0
  25. package/dist/pointGroups/elements.js.map +1 -0
  26. package/dist/pointGroups/itaOrder.d.ts +22 -0
  27. package/dist/pointGroups/itaOrder.d.ts.map +1 -0
  28. package/dist/pointGroups/itaOrder.js +675 -0
  29. package/dist/pointGroups/itaOrder.js.map +1 -0
  30. package/dist/pointGroups/pointGroups.d.ts +84 -0
  31. package/dist/pointGroups/pointGroups.d.ts.map +1 -0
  32. package/dist/pointGroups/pointGroups.js +229 -0
  33. package/dist/pointGroups/pointGroups.js.map +1 -0
  34. package/dist/pointGroups/properties.d.ts +18 -0
  35. package/dist/pointGroups/properties.d.ts.map +1 -0
  36. package/dist/pointGroups/properties.js +60 -0
  37. package/dist/pointGroups/properties.js.map +1 -0
  38. package/dist/symmetryDirections.d.ts +18 -0
  39. package/dist/symmetryDirections.d.ts.map +1 -0
  40. package/dist/symmetryDirections.js +65 -0
  41. package/dist/symmetryDirections.js.map +1 -0
  42. package/dist/tolerances.d.ts +11 -0
  43. package/dist/tolerances.d.ts.map +1 -0
  44. package/dist/tolerances.js +11 -0
  45. package/dist/tolerances.js.map +1 -0
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +5 -4
  49. package/src/index.ts +41 -0
  50. package/src/lattice.ts +59 -0
  51. package/src/linalg.ts +138 -0
  52. package/src/operations.ts +63 -0
  53. package/src/pointGroups/data.ts +294 -0
  54. package/src/pointGroups/elements.ts +264 -0
  55. package/src/pointGroups/itaOrder.ts +688 -0
  56. package/src/pointGroups/pointGroups.ts +304 -0
  57. package/src/pointGroups/properties.ts +62 -0
  58. package/src/symmetryDirections.ts +72 -0
  59. package/src/tolerances.ts +12 -0
  60. package/src/version.ts +1 -1
@@ -0,0 +1,304 @@
1
+ /**
2
+ * Public API for the crystallographic point groups: lookup, settings, operations, generators and
3
+ * symbols, in the ITC convention (default) or the Birss convention.
4
+ */
5
+
6
+ import {
7
+ MAX_GROUP_ORDER,
8
+ closeGroup,
9
+ compose,
10
+ operationsEqual,
11
+ transformOperation,
12
+ type Operation,
13
+ } from '../operations.js';
14
+ import { inItaOrder, itaGeneratorOperations } from './itaOrder.js';
15
+ import type { CrystalSystem } from '../lattice.js';
16
+ import { POINT_GROUP_DATA, POINT_GROUP_KEYS, type PointGroupData, type PointGroupKey } from './data.js';
17
+
18
+ export { POINT_GROUP_KEYS, type PointGroupKey } from './data.js';
19
+
20
+ /** `'itc'`: International Tables for Crystallography (default). `'birss'`: Birss, Symmetry and Magnetism (1966). */
21
+ export type Convention = 'itc' | 'birss';
22
+
23
+ /** Type I: crystallographic point group without time reversal (the only type so far). */
24
+ export type PointGroupType = 'I';
25
+
26
+ export interface PointGroup {
27
+ readonly key: PointGroupKey;
28
+ readonly type: PointGroupType;
29
+ readonly crystalSystem: CrystalSystem;
30
+ /** Number of operations. */
31
+ readonly order: number;
32
+ }
33
+
34
+ export interface Setting {
35
+ /** 1-based; the same physical frame in both conventions. */
36
+ readonly index: number;
37
+ /** Short symbol of the setting in the requested convention. */
38
+ readonly symbol: string;
39
+ /** Full symbol, symmetry directions separated by single spaces. */
40
+ readonly fullSymbol: string;
41
+ /** Monoclinic: the unique axis; orthorhombic mm2: the axis of the twofold rotation. */
42
+ readonly uniqueAxis?: 'a' | 'b' | 'c';
43
+ /** True for the default setting of the requested convention. */
44
+ readonly isDefault: boolean;
45
+ }
46
+
47
+ export interface SettingOptions {
48
+ /** Default `'itc'`. */
49
+ readonly convention?: Convention;
50
+ /** 1-based setting index; default: the default setting of the convention. */
51
+ readonly setting?: number;
52
+ }
53
+
54
+ export interface SymbolOptions extends SettingOptions {
55
+ /**
56
+ * `'short'` (default): short symbol of the setting, e.g. `321` (ITC) for class `32`.
57
+ * `'full'`: full symbol, positions separated by spaces, e.g. `-3 2/m 1`.
58
+ * `'schoenflies'`: Schoenflies symbol, subscripts written inline (`C3v`, `D2d`, `Oh`).
59
+ */
60
+ readonly form?: 'short' | 'full' | 'schoenflies';
61
+ }
62
+
63
+ const BY_KEY = new Map<string, PointGroupData>(POINT_GROUP_DATA.map((d) => [d.key, d]));
64
+
65
+ /** True if `key` is the key of one of the 32 crystal classes. */
66
+ export function isPointGroupKey(key: string): key is PointGroupKey {
67
+ return BY_KEY.has(key);
68
+ }
69
+
70
+ function data(key: string): PointGroupData {
71
+ const d = BY_KEY.get(key);
72
+ if (!d) throw new RangeError(`Unknown point group key: ${JSON.stringify(key)}`);
73
+ return d;
74
+ }
75
+
76
+ function convention(options?: SettingOptions): Convention {
77
+ const c = options?.convention ?? 'itc';
78
+ if (c !== 'itc' && c !== 'birss') throw new RangeError(`Unknown convention: ${JSON.stringify(c)}`);
79
+ return c;
80
+ }
81
+
82
+ function defaultSetting(d: PointGroupData, c: Convention): number {
83
+ return c === 'itc' ? d.itcDefault : 1;
84
+ }
85
+
86
+ /** The requested setting index, checked; the convention's default if none is given. */
87
+ function settingIndex(d: PointGroupData, options?: SettingOptions): number {
88
+ const c = convention(options);
89
+ const index = options?.setting ?? defaultSetting(d, c);
90
+ if (!Number.isInteger(index) || index < 1 || index > d.settings.length) {
91
+ throw new RangeError(`Point group ${d.key} has no setting ${String(index)} (settings 1 to ${d.settings.length})`);
92
+ }
93
+ return index;
94
+ }
95
+
96
+ function freezeOperation(op: Operation): Operation {
97
+ const [r0, r1, r2] = op.matrix;
98
+ return Object.freeze({
99
+ matrix: Object.freeze([Object.freeze([...r0]), Object.freeze([...r1]), Object.freeze([...r2])] as const),
100
+ timeReversal: op.timeReversal,
101
+ }) as Operation;
102
+ }
103
+
104
+ const generatorCache = new Map<string, readonly Operation[]>();
105
+ const operationCache = new Map<string, readonly Operation[]>();
106
+
107
+ /** The stored generators carried into the frame of a setting: the generators of the Birss convention. */
108
+ function settingGenerators(d: PointGroupData, index: number): readonly Operation[] {
109
+ const cacheKey = `${d.key}#${index}`;
110
+ let result = generatorCache.get(cacheKey);
111
+ if (!result) {
112
+ const frame = d.settings[index - 1].frame;
113
+ result = Object.freeze(d.generators.map((g) => freezeOperation(transformOperation(g, frame))));
114
+ generatorCache.set(cacheKey, result);
115
+ }
116
+ return result;
117
+ }
118
+
119
+ const itaGeneratorCache = new Map<string, readonly Operation[]>();
120
+
121
+ /** ITA's generators of a setting (see `generators`); throws if setting 1 has none. */
122
+ function settingItaGenerators(d: PointGroupData, index: number): readonly Operation[] {
123
+ const cacheKey = `${d.key}#${index}`;
124
+ let result = itaGeneratorCache.get(cacheKey);
125
+ if (!result) {
126
+ let gens = itaGeneratorOperations(d.key, index, d.crystalSystem);
127
+ if (!gens) {
128
+ if (index === 1) throw new Error(`Point group ${d.key}: no ITA generators for setting 1`);
129
+ gens = settingItaGenerators(d, 1).map((op) => transformOperation(op, d.settings[index - 1].frame));
130
+ }
131
+ result = Object.freeze(gens.map(freezeOperation));
132
+ itaGeneratorCache.set(cacheKey, result);
133
+ }
134
+ return result;
135
+ }
136
+
137
+ const birssOperationCache = new Map<string, readonly Operation[]>();
138
+
139
+ /**
140
+ * The operations of a setting in the Birss convention, in birss-app's order (docs/conventions.md,
141
+ * "Birss convention and birss-app"): the generators of the setting first, then repeated passes
142
+ * that append every new product g·h of two operations found before the pass, in the order of g,
143
+ * then h, until a pass adds nothing.
144
+ */
145
+ function birssOperations(d: PointGroupData, index: number): readonly Operation[] {
146
+ const cacheKey = `${d.key}#${index}`;
147
+ let result = birssOperationCache.get(cacheKey);
148
+ if (!result) {
149
+ const group = [...settingGenerators(d, index)];
150
+ for (let changed = true; changed;) {
151
+ changed = false;
152
+ const size = group.length;
153
+ for (let i = 0; i < size; i++) {
154
+ for (let j = 0; j < size; j++) {
155
+ const product = compose(group[i], group[j]);
156
+ if (!group.some((g) => operationsEqual(g, product))) {
157
+ if (group.length >= MAX_GROUP_ORDER) throw new Error(`Point group ${d.key}: closure does not terminate`);
158
+ group.push(product);
159
+ changed = true;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ if (!sameSet(group, settingOperations(d, index))) {
165
+ throw new Error(`Point group ${d.key}, setting ${index}: Birss operations differ from the closure`);
166
+ }
167
+ result = Object.freeze(group.map(freezeOperation));
168
+ birssOperationCache.set(cacheKey, result);
169
+ }
170
+ return result;
171
+ }
172
+
173
+ /**
174
+ * The operations of a setting in ITA's order (docs/conventions.md, "Order of the operations"): for a
175
+ * setting ITA lists, coset by coset from ITA's generators; for a setting ITA does not list (today
176
+ * `mm2` settings 2 and 3), the order of setting 1, carried into the frame of the setting. Setting 1
177
+ * is always one ITA lists; throws if its generators are missing or do not give the closure.
178
+ */
179
+ function settingOperations(d: PointGroupData, index: number): readonly Operation[] {
180
+ const cacheKey = `${d.key}#${index}`;
181
+ let result = operationCache.get(cacheKey);
182
+ if (!result) {
183
+ const closed = closeGroup(settingGenerators(d, index));
184
+ let ordered = inItaOrder(d.key, index, d.crystalSystem, closed);
185
+ if (!ordered) {
186
+ if (index === 1) throw new Error(`Point group ${d.key}: no ITA generators for setting 1`);
187
+ ordered = settingOperations(d, 1).map((op) => transformOperation(op, d.settings[index - 1].frame));
188
+ }
189
+ if (!sameSet(ordered, closed)) {
190
+ throw new Error(`Point group ${d.key}, setting ${index}: ordered operations differ from the closure`);
191
+ }
192
+ result = Object.freeze(ordered.map(freezeOperation));
193
+ operationCache.set(cacheKey, result);
194
+ }
195
+ return result;
196
+ }
197
+
198
+ /** True if `a` is `b` in some order: equal length, no operation twice in `a`, every one of `a` in `b`. */
199
+ function sameSet(a: readonly Operation[], b: readonly Operation[]): boolean {
200
+ return (
201
+ a.length === b.length &&
202
+ a.every((op, i) => b.some((x) => operationsEqual(x, op)) && !a.slice(0, i).some((x) => operationsEqual(x, op)))
203
+ );
204
+ }
205
+
206
+ const groupCache = new Map<string, PointGroup>();
207
+
208
+ /** The point group with this key. Throws a RangeError for an unknown key. */
209
+ export function pointGroup(key: PointGroupKey): PointGroup {
210
+ const d = data(key);
211
+ let g = groupCache.get(d.key);
212
+ if (!g) {
213
+ g = Object.freeze({ key: d.key, type: 'I', crystalSystem: d.crystalSystem, order: settingOperations(d, 1).length });
214
+ groupCache.set(d.key, g);
215
+ }
216
+ return g;
217
+ }
218
+
219
+ /** All 32 crystal classes, in the order of `POINT_GROUP_KEYS` (by crystal system, as in ITA). */
220
+ export function pointGroups(): readonly PointGroup[] {
221
+ return POINT_GROUP_KEYS.map(pointGroup);
222
+ }
223
+
224
+ /** The settings of a point group, with symbols and the default of the given convention (default `'itc'`). */
225
+ export function settings(key: PointGroupKey, conventionName: Convention = 'itc'): readonly Setting[] {
226
+ const d = data(key);
227
+ const c = convention({ convention: conventionName });
228
+ const def = defaultSetting(d, c);
229
+ return d.settings.map((s, i) =>
230
+ Object.freeze({
231
+ index: i + 1,
232
+ symbol: s[c].short,
233
+ fullSymbol: s[c].full,
234
+ ...(s.uniqueAxis ? { uniqueAxis: s.uniqueAxis } : {}),
235
+ isDefault: i + 1 === def,
236
+ }),
237
+ );
238
+ }
239
+
240
+ /**
241
+ * All operations of the point group in the requested setting (default: the convention's default
242
+ * setting). ITC convention: in ITA's order, identity first, then as ITA numbers the general
243
+ * position; Birss convention: in birss-app's order (docs/conventions.md, "Order of the
244
+ * operations"). The matrices are Cartesian (docs/conventions.md, "Cartesian frame").
245
+ */
246
+ export function operations(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
247
+ const d = data(key);
248
+ const index = settingIndex(d, options);
249
+ return convention(options) === 'birss' ? birssOperations(d, index) : settingOperations(d, index);
250
+ }
251
+
252
+ /**
253
+ * Generators of the point group in the requested setting (docs/conventions.md, "Generators"). ITC
254
+ * convention: ITA's selected generators in printed order, without the identity and ITA's lattice
255
+ * translations, so the list is empty for `1`; for `mm2` settings 2 and 3, which ITA does not list,
256
+ * those of setting 1 carried into their frame. Birss convention: birss-app's generators (for `1`
257
+ * the identity, as in birss-app).
258
+ */
259
+ export function generators(key: PointGroupKey, options?: SettingOptions): readonly Operation[] {
260
+ const d = data(key);
261
+ const index = settingIndex(d, options);
262
+ return convention(options) === 'birss' ? settingGenerators(d, index) : settingItaGenerators(d, index);
263
+ }
264
+
265
+ /** A symbol of the point group in the requested convention and setting. */
266
+ export function symbol(key: PointGroupKey, options?: SymbolOptions): string {
267
+ const d = data(key);
268
+ const form = options?.form ?? 'short';
269
+ const s = d.settings[settingIndex(d, options) - 1][convention(options)];
270
+ if (form === 'schoenflies') return d.schoenflies;
271
+ if (form === 'short') return s.short;
272
+ if (form === 'full') return s.full;
273
+ throw new RangeError(`Unknown symbol form: ${JSON.stringify(form)}`);
274
+ }
275
+
276
+ /** A point group in a given setting. */
277
+ export interface PointGroupInSetting {
278
+ readonly key: PointGroupKey;
279
+ readonly setting: number;
280
+ }
281
+
282
+ const compact = (s: string): string => s.replace(/\s+/g, '');
283
+
284
+ /**
285
+ * Finds a point group by a Hermann–Mauguin symbol in the given convention (default `'itc'`): the
286
+ * key (giving the default setting), the short symbol of a setting, or a full symbol (spaces are
287
+ * ignored). Returns undefined if nothing matches, also for a value that is not a string. Symbols
288
+ * are written as in this library: `-` for the overbar, also in the Birss convention (`m-3m`, where
289
+ * Birss prints `m3m`; docs/conventions.md, "Where ITC and Birss differ").
290
+ */
291
+ export function findPointGroup(hm: string, conventionName: Convention = 'itc'): PointGroupInSetting | undefined {
292
+ const c = convention({ convention: conventionName });
293
+ if (typeof hm !== 'string') return undefined;
294
+ const target = compact(hm);
295
+ const byKey = BY_KEY.get(target);
296
+ if (byKey) return { key: byKey.key, setting: defaultSetting(byKey, c) };
297
+ for (const form of ['short', 'full'] as const) {
298
+ for (const d of POINT_GROUP_DATA) {
299
+ const i = d.settings.findIndex((s) => compact(s[c][form]) === target);
300
+ if (i >= 0) return { key: d.key, setting: i + 1 };
301
+ }
302
+ }
303
+ return undefined;
304
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Properties of a point group that follow from its operations alone. They do not depend on the
3
+ * setting or the convention. Properties that need tensors (piezoelectric, …) come with the tensor
4
+ * module (CLAUDE.md, decision of 2026-11-08 on #13).
5
+ */
6
+
7
+ import { INVERSION, det, matricesEqual } from '../linalg.js';
8
+ import { EPSILON } from '../tolerances.js';
9
+ import { compose, operation, operationsEqual, type Operation } from '../operations.js';
10
+ import { POINT_GROUP_KEYS, type PointGroupKey } from './data.js';
11
+ import { operations } from './pointGroups.js';
12
+
13
+ /** Operations in setting 1, the frame all stored data share. */
14
+ const stored = (key: PointGroupKey): readonly Operation[] => operations(key, { setting: 1 });
15
+
16
+ /** Contains the inversion. */
17
+ export function isCentrosymmetric(key: PointGroupKey): boolean {
18
+ return stored(key).some((op) => !op.timeReversal && matricesEqual(op.matrix, INVERSION));
19
+ }
20
+
21
+ /**
22
+ * Polar (pyroelectric class): some direction is left unchanged by every operation, i.e. the group
23
+ * average of the matrices, which projects onto the invariant vectors, is not zero.
24
+ */
25
+ export function isPolar(key: PointGroupKey): boolean {
26
+ const ops = stored(key);
27
+ for (let i = 0; i < 3; i++) {
28
+ for (let j = 0; j < 3; j++) {
29
+ let sum = 0;
30
+ for (const op of ops) sum += op.matrix[i][j];
31
+ if (Math.abs(sum / ops.length) > EPSILON) return true;
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+
37
+ /** Chiral (enantiomorphic class): proper rotations only. */
38
+ export function isChiral(key: PointGroupKey): boolean {
39
+ return stored(key).every((op) => det(op.matrix) > 0);
40
+ }
41
+
42
+ function sameSet(a: readonly Operation[], b: readonly Operation[]): boolean {
43
+ return a.length === b.length && a.every((x) => b.some((y) => operationsEqual(x, y)));
44
+ }
45
+
46
+ const laueCache = new Map<PointGroupKey, PointGroupKey>();
47
+
48
+ /** The Laue class: the centrosymmetric crystal class generated by the group and the inversion. */
49
+ export function laueClass(key: PointGroupKey): PointGroupKey {
50
+ const cached = laueCache.get(key);
51
+ if (cached) return cached;
52
+ const ops = stored(key);
53
+ const withInversion = [...ops];
54
+ for (const op of ops) {
55
+ const product = compose(operation(INVERSION), op);
56
+ if (!withInversion.some((x) => operationsEqual(x, product))) withInversion.push(product);
57
+ }
58
+ const laue = POINT_GROUP_KEYS.find((k) => isCentrosymmetric(k) && sameSet(withInversion, stored(k)));
59
+ if (!laue) throw new Error(`laueClass: no centrosymmetric class matches ${key}`);
60
+ laueCache.set(key, laue);
61
+ return laue;
62
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The symmetry directions of the crystal families: the lattice directions along which the
3
+ * symmetry elements of a crystallographic point group lie, grouped by their position in the full
4
+ * Hermann–Mauguin symbol. Data from ITA Table 2.1.3.1 (docs/conventions.md, "Symmetry
5
+ * directions and elements"); `symmetryDirections.reference.test.ts` re-reads the transcription and requires the
6
+ * same directions, in the same order and with the same signs.
7
+ */
8
+
9
+ import type { CrystalFamily } from './lattice.js';
10
+
11
+ /** A lattice direction [uvw]: integer coordinates in the conventional basis a, b, c. */
12
+ export type Uvw = readonly [number, number, number];
13
+
14
+ const frozen = (rows: [number, number, number][][]): readonly (readonly Uvw[])[] =>
15
+ Object.freeze(rows.map((dirs) => Object.freeze(dirs.map((d) => Object.freeze(d) as unknown as Uvw))));
16
+
17
+ /**
18
+ * The directions of each position of the full symbol, per family, as printed in ITA Table 2.1.3.1
19
+ * (hexagonal family: the row "Hexagonal", which also serves the trigonal classes with hexagonal
20
+ * axes). Monoclinic: the full symbol reads along a, b, c (ITA 6th ed. § 2.1.3.15, p. 171), the
21
+ * orthorhombic row. Triclinic: no symmetry direction.
22
+ */
23
+ export const LATTICE_SYMMETRY_DIRECTIONS: Readonly<Record<CrystalFamily, readonly (readonly Uvw[])[]>> = Object.freeze({
24
+ triclinic: frozen([]),
25
+ monoclinic: frozen([[[1, 0, 0]], [[0, 1, 0]], [[0, 0, 1]]]),
26
+ orthorhombic: frozen([[[1, 0, 0]], [[0, 1, 0]], [[0, 0, 1]]]),
27
+ tetragonal: frozen([
28
+ [[0, 0, 1]],
29
+ [
30
+ [1, 0, 0],
31
+ [0, 1, 0],
32
+ ],
33
+ [
34
+ [1, -1, 0],
35
+ [1, 1, 0],
36
+ ],
37
+ ]),
38
+ hexagonal: frozen([
39
+ [[0, 0, 1]],
40
+ [
41
+ [1, 0, 0],
42
+ [0, 1, 0],
43
+ [-1, -1, 0],
44
+ ],
45
+ [
46
+ [1, -1, 0],
47
+ [1, 2, 0],
48
+ [-2, -1, 0],
49
+ ],
50
+ ]),
51
+ cubic: frozen([
52
+ [
53
+ [1, 0, 0],
54
+ [0, 1, 0],
55
+ [0, 0, 1],
56
+ ],
57
+ [
58
+ [1, 1, 1],
59
+ [1, -1, -1],
60
+ [-1, 1, -1],
61
+ [-1, -1, 1],
62
+ ],
63
+ [
64
+ [1, -1, 0],
65
+ [1, 1, 0],
66
+ [0, 1, -1],
67
+ [0, 1, 1],
68
+ [-1, 0, 1],
69
+ [1, 0, 1],
70
+ ],
71
+ ]),
72
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Numeric tolerances, in one place. The values differ on purpose: each gates a different quantity.
3
+ */
4
+
5
+ /** Two matrix entries (or vector components) closer than this are equal. */
6
+ export const EPSILON = 1e-6;
7
+
8
+ /**
9
+ * During group closure, an entry closer than this to one of the exact values in `SNAP_VALUES`
10
+ * (linalg.ts) is replaced by it, so rounding errors cannot accumulate over repeated products.
11
+ */
12
+ export const SNAP_EPSILON = 1e-9;
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Version of symcrys. Kept equal to `version` in package.json (checked by version.test.ts). */
2
- export const VERSION = '0.1.0';
2
+ export const VERSION = '0.2.0';