pub struct QuantumState {
pub amplitudes: Vec<f64>,
pub phases: Vec<f64>,
pub entanglementmatrix: Vec<Vec<f64>>,
pub measurement_probs: Vec<f64>,
}
Expand description
Quantum state representation for optimization variables
Fields§
§amplitudes: Vec<f64>
Probability amplitudes for each basis state
phases: Vec<f64>
Phase information
entanglementmatrix: Vec<Vec<f64>>
Entanglement connections between variables
measurement_probs: Vec<f64>
Measurement probabilities
Implementations§
Source§impl QuantumState
impl QuantumState
Sourcepub fn dimensions(dimensions: usize) -> Self
pub fn dimensions(dimensions: usize) -> Self
Create a new quantum state with uniform superposition
pub fn new_uniform(nqubits: usize) -> Self
Sourcepub fn from_amplitudes(amplitudes: Vec<f64>) -> CoreResult<Self>
pub fn from_amplitudes(amplitudes: Vec<f64>) -> CoreResult<Self>
Create a quantum state with specific amplitudes
Source§impl QuantumState
impl QuantumState
Sourcepub fn apply_rotation(&mut self, angle: f64, axis: usize)
pub fn apply_rotation(&mut self, angle: f64, axis: usize)
Apply a quantum rotation gate
Sourcepub fn apply_hadamard(&mut self, qubit: usize)
pub fn apply_hadamard(&mut self, qubit: usize)
Apply Hadamard gate to create superposition
Trait Implementations§
Source§impl Clone for QuantumState
impl Clone for QuantumState
Source§fn clone(&self) -> QuantumState
fn clone(&self) -> QuantumState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for QuantumState
impl RefUnwindSafe for QuantumState
impl Send for QuantumState
impl Sync for QuantumState
impl Unpin for QuantumState
impl UnwindSafe for QuantumState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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