@quantumplayed/quantum-game-engine 1.0.2 → 1.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.
- package/README.md +179 -0
- package/dist/EntanglementEngine.d.ts +8 -44
- package/dist/EntanglementEngine.js +7 -487
- package/dist/EntanglementEngine.js.map +1 -1
- package/dist/Operations.d.ts +6 -0
- package/dist/Operations.js +48 -0
- package/dist/Operations.js.map +1 -1
- package/dist/QuantumEntity.d.ts +18 -11
- package/dist/QuantumEntity.js +47 -101
- package/dist/QuantumEntity.js.map +1 -1
- package/dist/QuantumSystem.d.ts +64 -0
- package/dist/QuantumSystem.js +510 -0
- package/dist/QuantumSystem.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/src/CircuitLog.d.ts +0 -54
- package/dist/src/CircuitLog.js +0 -80
- package/dist/src/CircuitLog.js.map +0 -1
- package/dist/src/Complex.d.ts +0 -13
- package/dist/src/Complex.d.ts.map +0 -1
- package/dist/src/Complex.js +0 -49
- package/dist/src/Complex.js.map +0 -1
- package/dist/src/EntanglementEngine.d.ts +0 -48
- package/dist/src/EntanglementEngine.d.ts.map +0 -1
- package/dist/src/EntanglementEngine.js +0 -456
- package/dist/src/EntanglementEngine.js.map +0 -1
- package/dist/src/Operations.d.ts +0 -18
- package/dist/src/Operations.d.ts.map +0 -1
- package/dist/src/Operations.js +0 -107
- package/dist/src/Operations.js.map +0 -1
- package/dist/src/QuantumEntity.d.ts +0 -26
- package/dist/src/QuantumEntity.d.ts.map +0 -1
- package/dist/src/QuantumEntity.js +0 -142
- package/dist/src/QuantumEntity.js.map +0 -1
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -6
- package/dist/src/index.js.map +0 -1
- package/dist/tests/DensityMatrix.test.d.ts +0 -1
- package/dist/tests/DensityMatrix.test.d.ts.map +0 -1
- package/dist/tests/DensityMatrix.test.js +0 -41
- package/dist/tests/DensityMatrix.test.js.map +0 -1
- package/dist/tests/EntanglementEngine.test.d.ts +0 -1
- package/dist/tests/EntanglementEngine.test.d.ts.map +0 -1
- package/dist/tests/EntanglementEngine.test.js +0 -72
- package/dist/tests/EntanglementEngine.test.js.map +0 -1
- package/dist/tests/QuantumEntity.test.d.ts +0 -1
- package/dist/tests/QuantumEntity.test.d.ts.map +0 -1
- package/dist/tests/QuantumEntity.test.js +0 -60
- package/dist/tests/QuantumEntity.test.js.map +0 -1
package/dist/QuantumEntity.d.ts
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
4
|
-
export
|
|
5
|
-
entity: QuantumEntity;
|
|
6
|
-
state: number;
|
|
7
|
-
}
|
|
1
|
+
import { QuantumSystem, type Predicate, type TargetOperation } from "./QuantumSystem.js";
|
|
2
|
+
import { type QuantumOperation } from "./Operations.js";
|
|
3
|
+
import { type Complex } from "./Complex.js";
|
|
4
|
+
export { type Predicate, type TargetOperation, QuantumSystem };
|
|
8
5
|
export declare class QuantumEntity {
|
|
9
6
|
private static _nextId;
|
|
10
7
|
readonly id: number;
|
|
11
8
|
dimension: number;
|
|
12
|
-
|
|
13
|
-
entangledSystem?: JointQuantumSystem;
|
|
9
|
+
system: QuantumSystem;
|
|
14
10
|
constructor(options: {
|
|
15
11
|
dimension: number;
|
|
16
12
|
initialState: number;
|
|
17
13
|
});
|
|
18
14
|
/** Reset the auto-increment counter (useful in tests). */
|
|
19
15
|
static resetIdCounter(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Always returns the current amplitudes for this entity.
|
|
18
|
+
* When entangled, returns the marginal branch amplitudes.
|
|
19
|
+
*/
|
|
20
|
+
get amplitudes(): Record<number, Complex>;
|
|
21
|
+
/**
|
|
22
|
+
* Backwards-compatible handle to the entangled system.
|
|
23
|
+
* Returns the joint system if entangled with other entities, otherwise undefined.
|
|
24
|
+
*/
|
|
25
|
+
get entangledSystem(): QuantumSystem | undefined;
|
|
20
26
|
is(state: number): Predicate;
|
|
21
|
-
apply(operation: QuantumOperation, controls?: Predicate[]):
|
|
27
|
+
apply(operation: QuantumOperation, controls?: Predicate[]): QuantumSystem | undefined;
|
|
22
28
|
measure(forcedOutcome?: number): number;
|
|
23
29
|
getProbabilities(): Record<number, number>;
|
|
30
|
+
getProbabilityOf(state: number): number;
|
|
31
|
+
getProbabilityArray(): number[];
|
|
24
32
|
getAmplitudes(): Record<number, Complex>;
|
|
25
33
|
getReducedDensityMatrix(): Record<number, Record<number, Complex>>;
|
|
26
|
-
setState(amplitudes: SparseAmplitudes): void;
|
|
27
34
|
}
|
package/dist/QuantumEntity.js
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { QuantumSystem } from "./QuantumSystem.js";
|
|
2
|
+
import { CircuitLogger } from "./CircuitLog.js";
|
|
3
|
+
export { QuantumSystem };
|
|
4
4
|
export class QuantumEntity {
|
|
5
5
|
static _nextId = 0;
|
|
6
6
|
id;
|
|
7
7
|
dimension;
|
|
8
|
-
|
|
9
|
-
entangledSystem;
|
|
8
|
+
system;
|
|
10
9
|
constructor(options) {
|
|
11
10
|
this.id = QuantumEntity._nextId++;
|
|
12
11
|
this.dimension = options.dimension;
|
|
13
|
-
this.
|
|
14
|
-
this.amplitudes[options.initialState] = { re: 1.0, im: 0.0 };
|
|
12
|
+
this.system = new QuantumSystem([this], options.initialState);
|
|
15
13
|
}
|
|
16
14
|
/** Reset the auto-increment counter (useful in tests). */
|
|
17
15
|
static resetIdCounter() {
|
|
18
16
|
QuantumEntity._nextId = 0;
|
|
19
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Always returns the current amplitudes for this entity.
|
|
20
|
+
* When entangled, returns the marginal branch amplitudes.
|
|
21
|
+
*/
|
|
22
|
+
get amplitudes() {
|
|
23
|
+
return this.getAmplitudes();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Backwards-compatible handle to the entangled system.
|
|
27
|
+
* Returns the joint system if entangled with other entities, otherwise undefined.
|
|
28
|
+
*/
|
|
29
|
+
get entangledSystem() {
|
|
30
|
+
return this.system.entities.length > 1 ? this.system : undefined;
|
|
31
|
+
}
|
|
20
32
|
// Return a Predicate for conditional interactions
|
|
21
33
|
is(state) {
|
|
22
34
|
return { entity: this, state };
|
|
@@ -24,119 +36,53 @@ export class QuantumEntity {
|
|
|
24
36
|
// Apply an operation directly to this entity, optionally conditionally
|
|
25
37
|
apply(operation, controls) {
|
|
26
38
|
if (controls && controls.length > 0) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
controls: controls,
|
|
39
|
+
return QuantumSystem.conditionalInteract({
|
|
40
|
+
controls,
|
|
30
41
|
targets: [{ entity: this, operation }]
|
|
31
42
|
});
|
|
32
|
-
return;
|
|
33
43
|
}
|
|
34
|
-
if (this.
|
|
35
|
-
|
|
36
|
-
this.
|
|
44
|
+
if (this.system.entities.length > 1) {
|
|
45
|
+
this.system.applyToSubspace([this], operation);
|
|
46
|
+
return this.system;
|
|
37
47
|
}
|
|
38
48
|
else {
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
this.system.applyLocal(0, operation);
|
|
50
|
+
if (CircuitLogger.isRecording()) {
|
|
51
|
+
CircuitLogger.addGate(operation.name, [this.id], [this.dimension], operation.params);
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
44
54
|
}
|
|
45
55
|
}
|
|
46
56
|
// Measure the entity, collapsing its state.
|
|
47
57
|
// If forcedOutcome is provided (0..dimension-1), collapse directly to that state.
|
|
48
58
|
measure(forcedOutcome) {
|
|
49
|
-
|
|
50
|
-
// measureTarget handles its own logging
|
|
51
|
-
return this.entangledSystem.measureTarget(this, forcedOutcome);
|
|
52
|
-
}
|
|
53
|
-
// Forced outcome — collapse directly
|
|
54
|
-
if (forcedOutcome !== undefined) {
|
|
55
|
-
this.amplitudes = { [forcedOutcome]: { re: 1.0, im: 0.0 } };
|
|
56
|
-
if (CircuitLogger.isRecording()) {
|
|
57
|
-
CircuitLogger.addMeasurement(this.id, this.dimension, forcedOutcome);
|
|
58
|
-
}
|
|
59
|
-
return forcedOutcome;
|
|
60
|
-
}
|
|
61
|
-
const rand = Math.random();
|
|
62
|
-
let cumulativeProb = 0;
|
|
63
|
-
for (const key in this.amplitudes) {
|
|
64
|
-
const k = parseInt(key);
|
|
65
|
-
const amp = this.amplitudes[k];
|
|
66
|
-
const prob = amp.re * amp.re + amp.im * amp.im;
|
|
67
|
-
cumulativeProb += prob;
|
|
68
|
-
if (rand <= cumulativeProb) {
|
|
69
|
-
// Collapse!
|
|
70
|
-
this.amplitudes = { [k]: { re: 1.0, im: 0.0 } };
|
|
71
|
-
if (CircuitLogger.isRecording()) {
|
|
72
|
-
CircuitLogger.addMeasurement(this.id, this.dimension, k);
|
|
73
|
-
}
|
|
74
|
-
return k;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// Fallback for floating point error
|
|
78
|
-
const keys = Object.keys(this.amplitudes);
|
|
79
|
-
if (keys.length === 0) {
|
|
80
|
-
throw new Error("Cannot measure an entity with 0 probability mass (Decoherence error)");
|
|
81
|
-
}
|
|
82
|
-
const k = parseInt(keys[keys.length - 1]);
|
|
83
|
-
this.amplitudes = { [k]: { re: 1.0, im: 0.0 } };
|
|
84
|
-
if (CircuitLogger.isRecording()) {
|
|
85
|
-
CircuitLogger.addMeasurement(this.id, this.dimension, k);
|
|
86
|
-
}
|
|
87
|
-
return k;
|
|
59
|
+
return this.system.measureEntity(this, forcedOutcome);
|
|
88
60
|
}
|
|
89
61
|
// Extract the raw probability map for UIs
|
|
90
62
|
getProbabilities() {
|
|
91
|
-
|
|
92
|
-
return this.entangledSystem.getTargetProbabilities(this);
|
|
93
|
-
}
|
|
94
|
-
const probs = {};
|
|
95
|
-
for (const key in this.amplitudes) {
|
|
96
|
-
const k = parseInt(key);
|
|
97
|
-
const amp = this.amplitudes[k];
|
|
98
|
-
probs[k] = amp.re * amp.re + amp.im * amp.im;
|
|
99
|
-
}
|
|
100
|
-
return probs;
|
|
63
|
+
return this.system.getEntityProbabilities(this);
|
|
101
64
|
}
|
|
102
|
-
//
|
|
65
|
+
// Get probability of a specific state
|
|
66
|
+
getProbabilityOf(state) {
|
|
67
|
+
return this.getProbabilities()[state] ?? 0;
|
|
68
|
+
}
|
|
69
|
+
// Extract fixed-length probability array [P(0), P(1), ..., P(D-1)]
|
|
70
|
+
getProbabilityArray() {
|
|
71
|
+
const probs = this.getProbabilities();
|
|
72
|
+
const arr = new Array(this.dimension).fill(0);
|
|
73
|
+
for (const [k, p] of Object.entries(probs)) {
|
|
74
|
+
arr[parseInt(k)] = p;
|
|
75
|
+
}
|
|
76
|
+
return arr;
|
|
77
|
+
}
|
|
78
|
+
// Extract raw complex amplitudes
|
|
103
79
|
getAmplitudes() {
|
|
104
|
-
|
|
105
|
-
return this.entangledSystem.getTargetAmplitudes(this);
|
|
106
|
-
}
|
|
107
|
-
const amps = {};
|
|
108
|
-
for (const key in this.amplitudes) {
|
|
109
|
-
const k = parseInt(key);
|
|
110
|
-
amps[k] = { ...this.amplitudes[k] };
|
|
111
|
-
}
|
|
112
|
-
return amps;
|
|
80
|
+
return this.system.getEntityAmplitudes(this);
|
|
113
81
|
}
|
|
114
82
|
// Get the One-Body Reduced Density Matrix
|
|
115
83
|
// Diagonal elements = classical probability. Off-diagonal elements = coherence.
|
|
116
84
|
getReducedDensityMatrix() {
|
|
117
|
-
|
|
118
|
-
return this.entangledSystem.getReducedDensityMatrix(this);
|
|
119
|
-
}
|
|
120
|
-
// Pure state density matrix: rho_{j,k} = c_j * c_k^*
|
|
121
|
-
const rho = {};
|
|
122
|
-
for (const [jStr, ampJ] of Object.entries(this.amplitudes)) {
|
|
123
|
-
const j = parseInt(jStr);
|
|
124
|
-
if (!rho[j])
|
|
125
|
-
rho[j] = {};
|
|
126
|
-
for (const [kStr, ampK] of Object.entries(this.amplitudes)) {
|
|
127
|
-
const k = parseInt(kStr);
|
|
128
|
-
const ampKStar = ComplexMath.conjugate(ampK);
|
|
129
|
-
rho[j][k] = ComplexMath.multiply(ampJ, ampKStar);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return rho;
|
|
133
|
-
}
|
|
134
|
-
// Manually set the state (Use with caution, primarily for state restoration/cloning)
|
|
135
|
-
setState(amplitudes) {
|
|
136
|
-
if (this.entangledSystem) {
|
|
137
|
-
throw new Error("Cannot manually set state of an entangled entity. Set the state on the JointQuantumSystem instead.");
|
|
138
|
-
}
|
|
139
|
-
this.amplitudes = { ...amplitudes };
|
|
85
|
+
return this.system.getEntityReducedDensityMatrix(this);
|
|
140
86
|
}
|
|
141
87
|
}
|
|
142
88
|
//# sourceMappingURL=QuantumEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantumEntity.js","sourceRoot":"","sources":["../src/QuantumEntity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QuantumEntity.js","sourceRoot":"","sources":["../src/QuantumEntity.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Complex } from "./Complex.js";
|
|
2
|
+
import { type QuantumOperation, type SparseAmplitudes } from "./Operations.js";
|
|
3
|
+
import type { QuantumEntity } from "./QuantumEntity.js";
|
|
4
|
+
export interface Predicate {
|
|
5
|
+
entity: QuantumEntity;
|
|
6
|
+
state: number;
|
|
7
|
+
}
|
|
8
|
+
export interface TargetOperation {
|
|
9
|
+
entity: QuantumEntity;
|
|
10
|
+
operation: QuantumOperation;
|
|
11
|
+
}
|
|
12
|
+
export declare class QuantumSystem {
|
|
13
|
+
private static _nextId;
|
|
14
|
+
static maxDimensionLimit: number;
|
|
15
|
+
static setMaxDimensionLimit(limit: number): void;
|
|
16
|
+
static resetIdCounter(): void;
|
|
17
|
+
readonly id: number;
|
|
18
|
+
entities: QuantumEntity[];
|
|
19
|
+
dimensions: number[];
|
|
20
|
+
dimension: number;
|
|
21
|
+
amplitudes: SparseAmplitudes;
|
|
22
|
+
get totalDimension(): number;
|
|
23
|
+
get jointAmplitudes(): SparseAmplitudes;
|
|
24
|
+
set jointAmplitudes(val: SparseAmplitudes);
|
|
25
|
+
constructor(entities: QuantumEntity[], initialStateOrAmplitudes?: number | SparseAmplitudes);
|
|
26
|
+
is(state: number): Predicate;
|
|
27
|
+
decomposeState(jointState: number): number[];
|
|
28
|
+
composeState(states: number[]): number;
|
|
29
|
+
getProbabilities(): Record<number, number>;
|
|
30
|
+
getProbabilityOf(state: number): number;
|
|
31
|
+
getProbabilityArray(): number[];
|
|
32
|
+
getAmplitudes(): Record<number, Complex>;
|
|
33
|
+
getEntityProbabilities(targetEntity: QuantumEntity): Record<number, number>;
|
|
34
|
+
getTargetProbabilities(targetEntity: QuantumEntity): Record<number, number>;
|
|
35
|
+
getEntityAmplitudes(targetEntity: QuantumEntity): Record<number, Complex>;
|
|
36
|
+
getTargetAmplitudes(targetEntity: QuantumEntity): Record<number, Complex>;
|
|
37
|
+
getEntityReducedDensityMatrix(targetEntity: QuantumEntity): Record<number, Record<number, Complex>>;
|
|
38
|
+
getReducedDensityMatrix(targetEntity: QuantumEntity): Record<number, Record<number, Complex>>;
|
|
39
|
+
applyLocal(entityIndex: number, operation: QuantumOperation): void;
|
|
40
|
+
applyToSubspace(targetEntities: QuantumEntity[], operation: QuantumOperation): void;
|
|
41
|
+
measure(forcedOutcome?: number): number;
|
|
42
|
+
measureEntity(targetEntity: QuantumEntity, forcedOutcome?: number): number;
|
|
43
|
+
measureTarget(targetEntity: QuantumEntity, forcedOutcome?: number): number;
|
|
44
|
+
getProjectedAmplitudes(conditions: {
|
|
45
|
+
entity: QuantumEntity;
|
|
46
|
+
state: number;
|
|
47
|
+
}[]): SparseAmplitudes;
|
|
48
|
+
getJointProbability(conditions: {
|
|
49
|
+
entity: QuantumEntity;
|
|
50
|
+
state: number;
|
|
51
|
+
}[]): number;
|
|
52
|
+
areMutuallyExclusive(conditions: {
|
|
53
|
+
entity: QuantumEntity;
|
|
54
|
+
state: number;
|
|
55
|
+
}[]): boolean;
|
|
56
|
+
static create(entities: QuantumEntity[]): QuantumSystem;
|
|
57
|
+
static inject(entities: QuantumEntity[], jointAmplitudes: SparseAmplitudes): QuantumSystem;
|
|
58
|
+
static merge(involvedEntities: QuantumEntity[]): QuantumSystem;
|
|
59
|
+
static interact(entities: QuantumEntity[], operation: QuantumOperation): void;
|
|
60
|
+
static conditionalInteract(args: {
|
|
61
|
+
controls: Predicate[];
|
|
62
|
+
targets: TargetOperation[];
|
|
63
|
+
}): QuantumSystem;
|
|
64
|
+
}
|