pub struct QuantumCognitiveState { /* private fields */ }Expand description
Quantum state vector over graph nodes.
|psi> = sum_i alpha_i |i> where alpha_i are complex amplitudes.
Implementations§
Source§impl QuantumCognitiveState
impl QuantumCognitiveState
Sourcepub fn from_fiedler(fiedler: &[f64], node_ids: &[u64]) -> Self
pub fn from_fiedler(fiedler: &[f64], node_ids: &[u64]) -> Self
Initialize from the Fiedler vector (classical -> quantum).
The Fiedler vector becomes the initial state with real amplitudes, normalized so that the Born-rule probabilities sum to 1.
Sourcepub fn uniform(n: usize, node_ids: &[u64]) -> Self
pub fn uniform(n: usize, node_ids: &[u64]) -> Self
Initialize uniform superposition (maximum uncertainty).
Sourcepub fn probability(&self, i: usize) -> f64
pub fn probability(&self, i: usize) -> f64
Born rule: probability of node i being in the “answer.”
Sourcepub fn probabilities(&self) -> Vec<f64>
pub fn probabilities(&self) -> Vec<f64>
Born rule: probability distribution over all nodes.
Sourcepub fn entropy(&self) -> f64
pub fn entropy(&self) -> f64
Von Neumann entropy: S = -sum p_i ln(p_i).
- 0 = fully collapsed (one node dominates)
- ln(n) = maximum uncertainty (uniform superposition)
Sourcepub fn evolve(
&mut self,
laplacian_action: impl Fn(&[Complex]) -> Vec<Complex>,
dt: f64,
)
pub fn evolve( &mut self, laplacian_action: impl Fn(&[Complex]) -> Vec<Complex>, dt: f64, )
Coherent evolution: |psi(t+dt)> = exp(-i dt H)|psi(t)>.
Uses first-order approximation: |psi’> ~= (I - i dt H)|psi>. H = graph Laplacian L (sparse, computed from CausalGraph adjacency).
laplacian_action computes H|psi> given |psi>.
Sourcepub fn evidence_impact(&self, u_idx: usize, v_idx: usize, weight: f64) -> f64
pub fn evidence_impact(&self, u_idx: usize, v_idx: usize, weight: f64) -> f64
Measure evidence impact via expectation value: <psi|DeltaL|psi>.
This is the quantum generalization of delta_lambda_2 = w*(phi[u]-phi[v])^2.
Sourcepub fn rank_evidence_quantum(
&self,
candidates: &[(usize, usize, f64)],
) -> Vec<QuantumEvidenceRanking>
pub fn rank_evidence_quantum( &self, candidates: &[(usize, usize, f64)], ) -> Vec<QuantumEvidenceRanking>
Rank evidence by quantum impact (Born-rule weighted).
This generalizes rank_evidence_by_impact to use amplitudes
instead of the Fiedler vector.
Sourcepub fn observe_evidence(&mut self, u_idx: usize, v_idx: usize, weight: f64)
pub fn observe_evidence(&mut self, u_idx: usize, v_idx: usize, weight: f64)
Projective measurement: collapse onto evidence outcome.
After observing that edge (u,v) IS part of the causal chain, amplitudes at u and v are boosted, others are suppressed.
Sourcepub fn suppress(&mut self, node_idx: usize, factor: f64)
pub fn suppress(&mut self, node_idx: usize, factor: f64)
Partial collapse: suppress hypotheses inconsistent with evidence.
Nodes contradicting the evidence have amplitudes dampened by factor.
Sourcepub fn collapse(&self) -> (usize, f64)
pub fn collapse(&self) -> (usize, f64)
Full collapse: return the classical deterministic answer.
Projects |psi> onto the most probable basis state.
Returns (index, probability).
Sourcepub fn to_classical(&self) -> Vec<f64>
pub fn to_classical(&self) -> Vec<f64>
Get the classical Fiedler-like vector (real parts of amplitudes).
This is the “classical projection” – always available.
Sourcepub fn is_collapsed(&self, threshold: f64) -> bool
pub fn is_collapsed(&self, threshold: f64) -> bool
Is the state close to collapsed? (entropy near zero)
Sourcepub fn estimated_measurements_to_collapse(&self) -> Option<usize>
pub fn estimated_measurements_to_collapse(&self) -> Option<usize>
How many measurements until collapse?
Based on entropy decay rate from history.
Sourcepub fn measurement_count(&self) -> u64
pub fn measurement_count(&self) -> u64
Number of measurements performed so far.
Trait Implementations§
Source§impl Clone for QuantumCognitiveState
impl Clone for QuantumCognitiveState
Source§impl Debug for QuantumCognitiveState
impl Debug for QuantumCognitiveState
Source§impl<'de> Deserialize<'de> for QuantumCognitiveState
impl<'de> Deserialize<'de> for QuantumCognitiveState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for QuantumCognitiveState
impl RefUnwindSafe for QuantumCognitiveState
impl Send for QuantumCognitiveState
impl Sync for QuantumCognitiveState
impl Unpin for QuantumCognitiveState
impl UnsafeUnpin for QuantumCognitiveState
impl UnwindSafe for QuantumCognitiveState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more