@aleph-ai/tinyaleph 1.4.4 → 1.5.2
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/backends/bioinformatics/binding.js +44 -52
- package/backends/bioinformatics/dna-computing.js +14 -23
- package/backends/bioinformatics/encoding.js +22 -30
- package/backends/bioinformatics/folding.js +24 -32
- package/backends/bioinformatics/genetic-code.js +17 -21
- package/backends/bioinformatics/index.js +12 -12
- package/backends/bioinformatics/transcription.js +5 -3
- package/backends/bioinformatics/translation.js +6 -4
- package/backends/cryptographic/index.js +10 -9
- package/backends/index.js +7 -6
- package/backends/interface.js +4 -1
- package/backends/scientific/index.js +7 -4
- package/backends/semantic/index.js +7 -4
- package/backends/semantic/surface.js +2 -1
- package/backends/semantic/two-layer.js +5 -3
- package/core/beacon.js +10 -9
- package/core/compound.js +4 -4
- package/core/crt-homology.js +40 -13
- package/core/enochian-vocabulary.js +5 -17
- package/core/enochian.js +3 -2
- package/core/entanglement.js +7 -7
- package/core/errors.js +2 -10
- package/core/events.js +7 -6
- package/core/fano.js +7 -6
- package/core/hilbert.js +40 -34
- package/core/hypercomplex.js +4 -2
- package/core/index.js +42 -80
- package/core/inference.js +6 -6
- package/core/lambda.js +5 -18
- package/core/llm.js +1 -1
- package/core/logger.js +3 -4
- package/core/prime.js +26 -1
- package/core/quaternion-semantics.js +3 -3
- package/core/reduction.js +5 -21
- package/core/resonance.js +20 -6
- package/core/rformer-crt.js +15 -29
- package/core/rformer-layers.js +12 -14
- package/core/rformer-tf.js +34 -43
- package/core/rformer.js +17 -32
- package/core/sieve.js +8 -3
- package/core/symbols/archetypes.js +3 -3
- package/core/symbols/base.js +4 -4
- package/core/symbols/elements.js +6 -3
- package/core/symbols/hieroglyphs.js +3 -3
- package/core/symbols/iching.js +3 -3
- package/core/symbols/index.js +32 -18
- package/core/symbols/tarot.js +6 -3
- package/core/symbols.js +26 -4
- package/core/topology.js +3 -14
- package/core/types.js +3 -14
- package/engine/aleph.js +8 -6
- package/engine/index.js +4 -2
- package/index.js +3 -2
- package/modular.js +18 -41
- package/package.json +4 -2
- package/physics/collapse.js +10 -11
- package/physics/entropy.js +8 -8
- package/physics/index.js +70 -102
- package/physics/kuramoto-coupled-ladder.js +10 -14
- package/physics/kuramoto.js +5 -2
- package/physics/lyapunov.js +7 -7
- package/physics/oscillator.js +5 -1
- package/physics/primeon_z_ladder_multi.js +7 -9
- package/physics/primeon_z_ladder_u.js +8 -9
- package/physics/stochastic-kuramoto.js +7 -7
- package/physics/sync-models.js +11 -14
- package/telemetry/index.js +1 -1
- package/telemetry/metrics.js +3 -8
package/core/symbols/index.js
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
* by simply creating new files and importing them here.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const { SymbolDatabase, SymbolCategory, PrimeGenerator } = require('./base');
|
|
10
|
-
|
|
11
9
|
// Import all symbol definition files
|
|
12
|
-
const { archetypeSymbols } = require('./archetypes');
|
|
13
|
-
const { tarotSymbols } = require('./tarot');
|
|
14
|
-
const { ichingHexagrams } = require('./iching');
|
|
15
|
-
const { egyptianHieroglyphs } = require('./hieroglyphs');
|
|
16
|
-
const { allElementSymbols } = require('./elements');
|
|
17
10
|
|
|
18
11
|
// ═══════════════════════════════════════════════════════════════════
|
|
19
12
|
// Create and populate the singleton database
|
|
20
13
|
// ═══════════════════════════════════════════════════════════════════
|
|
21
14
|
|
|
15
|
+
import { SymbolDatabase, SymbolCategory, PrimeGenerator } from './base.js';
|
|
16
|
+
import { archetypeSymbols } from './archetypes.js';
|
|
17
|
+
import { tarotSymbols } from './tarot.js';
|
|
18
|
+
import { ichingHexagrams } from './iching.js';
|
|
19
|
+
import { egyptianHieroglyphs } from './hieroglyphs.js';
|
|
20
|
+
import { allElementSymbols } from './elements.js';
|
|
21
|
+
|
|
22
22
|
let symbolDatabaseInstance = null;
|
|
23
23
|
|
|
24
24
|
function createSymbolDatabase() {
|
|
@@ -50,7 +50,18 @@ const symbolDatabase = createSymbolDatabase();
|
|
|
50
50
|
// Convenience exports
|
|
51
51
|
// ═══════════════════════════════════════════════════════════════════
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
// Convenience functions
|
|
54
|
+
const getSymbol = (id) => symbolDatabase.getSymbol(id);
|
|
55
|
+
const getSymbolByPrime = (prime) => symbolDatabase.getSymbolByPrime(prime);
|
|
56
|
+
const getSymbolsByCategory = (category) => symbolDatabase.getSymbolsByCategory(category);
|
|
57
|
+
const getSymbolsByTag = (tag) => symbolDatabase.getSymbolsByTag(tag);
|
|
58
|
+
const search = (query) => symbolDatabase.search(query);
|
|
59
|
+
const encode = (ids) => symbolDatabase.encode(ids);
|
|
60
|
+
const decode = (sig) => symbolDatabase.decode(sig);
|
|
61
|
+
const getAllSymbols = () => symbolDatabase.getAllSymbols();
|
|
62
|
+
const getStats = () => symbolDatabase.getStats();
|
|
63
|
+
|
|
64
|
+
export {
|
|
54
65
|
// Database instance and class
|
|
55
66
|
symbolDatabase,
|
|
56
67
|
SymbolDatabase,
|
|
@@ -65,13 +76,16 @@ module.exports = {
|
|
|
65
76
|
allElementSymbols,
|
|
66
77
|
|
|
67
78
|
// Convenience functions
|
|
68
|
-
getSymbol
|
|
69
|
-
getSymbolByPrime
|
|
70
|
-
getSymbolsByCategory
|
|
71
|
-
getSymbolsByTag
|
|
72
|
-
search
|
|
73
|
-
encode
|
|
74
|
-
decode
|
|
75
|
-
getAllSymbols
|
|
76
|
-
getStats
|
|
77
|
-
};
|
|
79
|
+
getSymbol,
|
|
80
|
+
getSymbolByPrime,
|
|
81
|
+
getSymbolsByCategory,
|
|
82
|
+
getSymbolsByTag,
|
|
83
|
+
search,
|
|
84
|
+
encode,
|
|
85
|
+
decode,
|
|
86
|
+
getAllSymbols,
|
|
87
|
+
getStats
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Default export for backward compatibility
|
|
91
|
+
export default symbolDatabase;
|
package/core/symbols/tarot.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* symbolic meaning from Kabbalistic, astrological, and esoteric traditions.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
import { SymbolCategory } from './base.js';
|
|
10
10
|
|
|
11
11
|
const tarotMajorArcana = [
|
|
12
12
|
// ═══════════════════════════════════════════════════════════════════
|
|
@@ -204,8 +204,11 @@ const tarotMinorSuits = [
|
|
|
204
204
|
}
|
|
205
205
|
];
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
// Named export for tarotSymbols (used by index.js)
|
|
208
|
+
export const tarotSymbols = [...tarotMajorArcana, ...tarotMinorSuits];
|
|
209
|
+
|
|
210
|
+
export default {
|
|
208
211
|
tarotMajorArcana,
|
|
209
212
|
tarotMinorSuits,
|
|
210
|
-
tarotSymbols
|
|
213
|
+
tarotSymbols
|
|
211
214
|
};
|
package/core/symbols.js
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Symbol Database
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Comprehensive database of 400+ symbols with:
|
|
5
5
|
* - Unicode emoji representation
|
|
6
6
|
* - Prime number assignment (unique per symbol)
|
|
7
7
|
* - Category organization
|
|
8
8
|
* - Cultural tags for cross-cultural mapping
|
|
9
9
|
* - Rich, detailed meanings
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* Includes:
|
|
12
12
|
* - Jungian archetypes and mythological figures
|
|
13
13
|
* - Tarot Major and Minor Arcana
|
|
14
14
|
* - I-Ching 64 hexagrams
|
|
15
15
|
* - Egyptian hieroglyphs
|
|
16
16
|
* - Natural elements, places, objects, abstracts
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* Refactored to use modular symbol definition files.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
// Re-export everything from the modular structure
|
|
22
|
-
|
|
22
|
+
export {
|
|
23
|
+
symbolDatabase,
|
|
24
|
+
SymbolDatabase,
|
|
25
|
+
SymbolCategory,
|
|
26
|
+
PrimeGenerator,
|
|
27
|
+
archetypeSymbols,
|
|
28
|
+
tarotSymbols,
|
|
29
|
+
ichingHexagrams,
|
|
30
|
+
egyptianHieroglyphs,
|
|
31
|
+
allElementSymbols,
|
|
32
|
+
getSymbol,
|
|
33
|
+
getSymbolByPrime,
|
|
34
|
+
getSymbolsByCategory,
|
|
35
|
+
getSymbolsByTag,
|
|
36
|
+
search,
|
|
37
|
+
encode,
|
|
38
|
+
decode,
|
|
39
|
+
getAllSymbols,
|
|
40
|
+
getStats
|
|
41
|
+
} from './symbols/index.js';
|
|
42
|
+
|
|
43
|
+
// Default export
|
|
44
|
+
export { default } from './symbols/index.js';
|
package/core/topology.js
CHANGED
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
* - Fine structure constant: α⁻¹ = 108 + 29 = 137
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
const { TWIST_108, factorize, isPrime } = require('./prime');
|
|
19
|
-
|
|
20
18
|
// ============================================================================
|
|
21
19
|
// KNOT INVARIANTS
|
|
22
20
|
// ============================================================================
|
|
@@ -24,6 +22,8 @@ const { TWIST_108, factorize, isPrime } = require('./prime');
|
|
|
24
22
|
/**
|
|
25
23
|
* Knot class representing a mathematical knot with topological invariants
|
|
26
24
|
*/
|
|
25
|
+
import { TWIST_108, factorize, isPrime } from './prime.js';
|
|
26
|
+
|
|
27
27
|
class Knot {
|
|
28
28
|
/**
|
|
29
29
|
* Create a knot with specified invariants
|
|
@@ -627,29 +627,18 @@ class FreeEnergyDynamics {
|
|
|
627
627
|
// EXPORTS
|
|
628
628
|
// ============================================================================
|
|
629
629
|
|
|
630
|
-
|
|
631
|
-
// Knot classes
|
|
630
|
+
export {
|
|
632
631
|
Knot,
|
|
633
|
-
|
|
634
|
-
// Standard knots
|
|
635
632
|
UNKNOT,
|
|
636
633
|
TREFOIL,
|
|
637
634
|
FIGURE_EIGHT,
|
|
638
635
|
CINQUEFOIL,
|
|
639
636
|
THREE_TWIST,
|
|
640
637
|
STANDARD_KNOTS,
|
|
641
|
-
|
|
642
|
-
// Physical constants
|
|
643
638
|
PhysicalConstants,
|
|
644
|
-
|
|
645
|
-
// Observer hierarchy
|
|
646
639
|
OBSERVER_HIERARCHY,
|
|
647
640
|
getObserverLevel,
|
|
648
641
|
observerCapacity,
|
|
649
|
-
|
|
650
|
-
// Gauge symmetry
|
|
651
642
|
GaugeSymmetry,
|
|
652
|
-
|
|
653
|
-
// Free energy dynamics
|
|
654
643
|
FreeEnergyDynamics
|
|
655
644
|
};
|
package/core/types.js
CHANGED
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
* - Full typing judgments Γ ⊢ e : T
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
const { isPrime, firstNPrimes } = require('./prime');
|
|
17
|
-
|
|
18
16
|
// ============================================================================
|
|
19
17
|
// TYPE DEFINITIONS
|
|
20
18
|
// ============================================================================
|
|
@@ -22,6 +20,8 @@ const { isPrime, firstNPrimes } = require('./prime');
|
|
|
22
20
|
/**
|
|
23
21
|
* Type constants for the type system
|
|
24
22
|
*/
|
|
23
|
+
import { isPrime, firstNPrimes } from './prime.js';
|
|
24
|
+
|
|
25
25
|
const Types = {
|
|
26
26
|
NOUN: 'N',
|
|
27
27
|
ADJECTIVE: 'A',
|
|
@@ -878,31 +878,20 @@ function IMPL(s1, s2) {
|
|
|
878
878
|
// EXPORTS
|
|
879
879
|
// ============================================================================
|
|
880
880
|
|
|
881
|
-
|
|
882
|
-
// Type constants
|
|
881
|
+
export {
|
|
883
882
|
Types,
|
|
884
|
-
|
|
885
|
-
// Base class
|
|
886
883
|
Term,
|
|
887
|
-
|
|
888
|
-
// Term classes
|
|
889
884
|
NounTerm,
|
|
890
885
|
AdjTerm,
|
|
891
886
|
ChainTerm,
|
|
892
887
|
FusionTerm,
|
|
893
|
-
|
|
894
|
-
// Sentence classes
|
|
895
888
|
SentenceTerm,
|
|
896
889
|
NounSentence,
|
|
897
890
|
SeqSentence,
|
|
898
891
|
ImplSentence,
|
|
899
|
-
|
|
900
|
-
// Typing system
|
|
901
892
|
TypingContext,
|
|
902
893
|
TypingJudgment,
|
|
903
894
|
TypeChecker,
|
|
904
|
-
|
|
905
|
-
// Builders
|
|
906
895
|
N,
|
|
907
896
|
A,
|
|
908
897
|
FUSE,
|
package/engine/aleph.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* We excite the field, evolve it, and sample at coherent emission moments.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { Hypercomplex } from '../core/hypercomplex.js';
|
|
10
|
+
import { KuramotoModel } from '../physics/kuramoto.js';
|
|
11
|
+
import { stateEntropy, coherence } from '../physics/entropy.js';
|
|
12
|
+
import { estimateLyapunov, adaptiveCoupling, classifyStability } from '../physics/lyapunov.js';
|
|
13
|
+
import { collapseProbability, shouldCollapse, bornMeasurement } from '../physics/collapse.js';
|
|
14
14
|
|
|
15
15
|
class AlephEngine {
|
|
16
16
|
constructor(backend, options = {}) {
|
|
@@ -415,4 +415,6 @@ class AlephEngine {
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
export {
|
|
419
|
+
AlephEngine
|
|
420
|
+
};
|
package/engine/index.js
CHANGED
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - Multiple backends (semantic, cryptographic, scientific)
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
*
|
|
14
|
+
* import { createEngine } from '@aleph-ai/tinyaleph';
|
|
15
15
|
*
|
|
16
16
|
* const engine = createEngine('semantic', config);
|
|
17
17
|
* const result = engine.run('What is wisdom?');
|
|
@@ -20,4 +20,5 @@
|
|
|
20
20
|
* @module @aleph-ai/tinyaleph
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
export * from './modular.js';
|
|
24
|
+
export { default } from './modular.js';
|
package/modular.js
CHANGED
|
@@ -24,28 +24,26 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
// Core mathematical foundation
|
|
27
|
-
|
|
27
|
+
import core from './core/index.js';
|
|
28
28
|
|
|
29
29
|
// Enochian Packet Layer (Section 7.4 of whitepaper)
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
import enochian from './core/enochian.js';
|
|
31
|
+
import enochianVocabulary from './core/enochian-vocabulary.js';
|
|
32
32
|
|
|
33
33
|
// Browser-compatible utilities (extracted from apps/sentient)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const transport = require('./transport');
|
|
38
|
-
const profiling = require('./profiling/primitives');
|
|
34
|
+
import errors from './core/errors.js';
|
|
35
|
+
import logger from './core/logger.js';
|
|
36
|
+
import metrics from './telemetry/metrics.js';
|
|
39
37
|
|
|
40
38
|
// Observer architecture (Sentient Observer core modules)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
import smf from './observer/smf.js';
|
|
40
|
+
import prsc from './observer/prsc.js';
|
|
41
|
+
import temporal from './observer/temporal.js';
|
|
42
|
+
import entanglement from './observer/entanglement.js';
|
|
43
|
+
import agency from './observer/agency.js';
|
|
44
|
+
import boundary from './observer/boundary.js';
|
|
45
|
+
import safety from './observer/safety.js';
|
|
46
|
+
import hqe from './observer/hqe.js';
|
|
49
47
|
const {
|
|
50
48
|
Hypercomplex,
|
|
51
49
|
FANO_LINES,
|
|
@@ -101,7 +99,7 @@ const {
|
|
|
101
99
|
} = core;
|
|
102
100
|
|
|
103
101
|
// Physics engine
|
|
104
|
-
|
|
102
|
+
import physics from './physics/index.js';
|
|
105
103
|
const {
|
|
106
104
|
Oscillator,
|
|
107
105
|
OscillatorBank,
|
|
@@ -160,7 +158,7 @@ const {
|
|
|
160
158
|
} = physics;
|
|
161
159
|
|
|
162
160
|
// Domain backends
|
|
163
|
-
|
|
161
|
+
import backends from './backends/index.js';
|
|
164
162
|
const {
|
|
165
163
|
Backend,
|
|
166
164
|
SemanticBackend,
|
|
@@ -180,7 +178,7 @@ const {
|
|
|
180
178
|
} = backends;
|
|
181
179
|
|
|
182
180
|
// Unified engine
|
|
183
|
-
|
|
181
|
+
import engine from './engine/index.js';
|
|
184
182
|
const { AlephEngine } = engine;
|
|
185
183
|
|
|
186
184
|
/**
|
|
@@ -231,7 +229,7 @@ function deriveKey(password, salt, length = 32, iterations = 10000) {
|
|
|
231
229
|
return backend.deriveKey(password, salt, length, iterations);
|
|
232
230
|
}
|
|
233
231
|
|
|
234
|
-
|
|
232
|
+
export default {
|
|
235
233
|
// Main engine
|
|
236
234
|
AlephEngine,
|
|
237
235
|
createEngine,
|
|
@@ -413,27 +411,6 @@ module.exports = {
|
|
|
413
411
|
MetricRegistry: metrics.MetricRegistry,
|
|
414
412
|
MetricType: metrics.MetricType,
|
|
415
413
|
|
|
416
|
-
// Transport
|
|
417
|
-
transport,
|
|
418
|
-
Transport: transport.Transport,
|
|
419
|
-
WebSocketTransport: transport.WebSocketTransport,
|
|
420
|
-
SSETransport: transport.SSETransport,
|
|
421
|
-
MemoryTransport: transport.MemoryTransport,
|
|
422
|
-
PollingTransport: transport.PollingTransport,
|
|
423
|
-
TransportManager: transport.TransportManager,
|
|
424
|
-
TransportState: transport.TransportState,
|
|
425
|
-
|
|
426
|
-
// Profiling primitives
|
|
427
|
-
profiling,
|
|
428
|
-
RingBuffer: profiling.RingBuffer,
|
|
429
|
-
Timer: profiling.Timer,
|
|
430
|
-
Sampler: profiling.Sampler,
|
|
431
|
-
RateCalculator: profiling.RateCalculator,
|
|
432
|
-
MovingAverage: profiling.MovingAverage,
|
|
433
|
-
Profiler: profiling.Profiler,
|
|
434
|
-
hrtime: profiling.hrtime,
|
|
435
|
-
hrtimeNs: profiling.hrtimeNs,
|
|
436
|
-
|
|
437
414
|
// Observer Architecture (Sentient Observer core)
|
|
438
415
|
// SMF - Sedenion Memory Field
|
|
439
416
|
smf,
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-ai/tinyaleph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Prime-resonant semantic computing framework - hypercomplex algebra, oscillator dynamics, and entropy-minimizing reasoning",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "index.js",
|
|
7
|
+
"module": "index.js",
|
|
6
8
|
"types": "types/index.d.ts",
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
},
|
|
79
81
|
"homepage": "https://github.com/aleph-ai/tinyaleph#readme",
|
|
80
82
|
"engines": {
|
|
81
|
-
"node": ">=
|
|
83
|
+
"node": ">=16.0.0"
|
|
82
84
|
},
|
|
83
85
|
"files": [
|
|
84
86
|
"index.js",
|
package/physics/collapse.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Quantum-inspired state collapse mechanics
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { Hypercomplex } from '../core/hypercomplex.js';
|
|
6
|
+
|
|
5
7
|
function collapseProbability(entropyIntegral, lyapunovFactor = 1) {
|
|
6
8
|
const factor = lyapunovFactor < 0 ? 1.5 : 0.5;
|
|
7
9
|
return (1 - Math.exp(-entropyIntegral)) * factor;
|
|
@@ -28,7 +30,6 @@ function measureState(hypercomplex, basis = null) {
|
|
|
28
30
|
* Collapse state to a specific basis vector
|
|
29
31
|
*/
|
|
30
32
|
function collapseToIndex(hypercomplex, index) {
|
|
31
|
-
const { Hypercomplex } = require('../core/hypercomplex');
|
|
32
33
|
const collapsed = Hypercomplex.zero(hypercomplex.dim);
|
|
33
34
|
collapsed.c[index] = hypercomplex.c[index] >= 0 ? 1 : -1;
|
|
34
35
|
return collapsed;
|
|
@@ -58,7 +59,6 @@ function bornMeasurement(hypercomplex) {
|
|
|
58
59
|
* Partial collapse: mix between current state and collapsed state
|
|
59
60
|
*/
|
|
60
61
|
function partialCollapse(hypercomplex, targetIndex, strength = 0.5) {
|
|
61
|
-
const { Hypercomplex } = require('../core/hypercomplex');
|
|
62
62
|
const collapsed = Hypercomplex.zero(hypercomplex.dim);
|
|
63
63
|
const sign = hypercomplex.c[targetIndex] >= 0 ? 1 : -1;
|
|
64
64
|
collapsed.c[targetIndex] = sign;
|
|
@@ -75,7 +75,6 @@ function partialCollapse(hypercomplex, targetIndex, strength = 0.5) {
|
|
|
75
75
|
* Decoherence: gradual loss of quantum coherence
|
|
76
76
|
*/
|
|
77
77
|
function applyDecoherence(hypercomplex, rate = 0.1) {
|
|
78
|
-
const { Hypercomplex } = require('../core/hypercomplex');
|
|
79
78
|
const result = Hypercomplex.zero(hypercomplex.dim);
|
|
80
79
|
for (let i = 0; i < hypercomplex.dim; i++) {
|
|
81
80
|
// Add small random noise proportional to rate
|
|
@@ -84,12 +83,12 @@ function applyDecoherence(hypercomplex, rate = 0.1) {
|
|
|
84
83
|
return result.normalize();
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
export {
|
|
87
|
+
collapseProbability,
|
|
88
|
+
shouldCollapse,
|
|
89
|
+
measureState,
|
|
90
|
+
collapseToIndex,
|
|
91
|
+
bornMeasurement,
|
|
92
|
+
partialCollapse,
|
|
93
|
+
applyDecoherence
|
|
95
94
|
};
|
package/physics/entropy.js
CHANGED
|
@@ -77,12 +77,12 @@ function oscillatorEntropy(bank) {
|
|
|
77
77
|
return shannonEntropy(probs);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
export {
|
|
81
|
+
shannonEntropy,
|
|
82
|
+
stateEntropy,
|
|
83
|
+
coherence,
|
|
84
|
+
mutualInformation,
|
|
85
|
+
relativeEntropy,
|
|
86
|
+
jointEntropy,
|
|
87
|
+
oscillatorEntropy
|
|
88
88
|
};
|