pub struct StateVectorSimulator {
pub parallel: bool,
pub noise_model: Option<NoiseModel>,
pub advanced_noise_model: Option<AdvancedNoiseModel>,
pub use_simd: bool,
pub use_gate_fusion: bool,
pub diagnostics: Option<SimulationDiagnostics>,
/* private fields */
}Expand description
A state vector simulator for quantum circuits
This simulator implements the state vector approach, where the full quantum state is represented as a complex vector of dimension 2^N for N qubits.
Fields§
§parallel: boolUse parallel execution
noise_model: Option<NoiseModel>Basic noise model (if any)
advanced_noise_model: Option<AdvancedNoiseModel>Advanced noise model (if any)
use_simd: boolEnable SIMD optimizations for gate operations
use_gate_fusion: boolEnable gate fusion optimization
diagnostics: Option<SimulationDiagnostics>Diagnostics system for monitoring and error handling
Implementations§
Source§impl StateVectorSimulator
impl StateVectorSimulator
Sourcepub fn sequential() -> Self
pub fn sequential() -> Self
Create a new state vector simulator with parallel execution disabled
Sourcepub fn with_noise(noise_model: NoiseModel) -> Self
pub fn with_noise(noise_model: NoiseModel) -> Self
Create a new state vector simulator with a basic noise model
Sourcepub fn with_advanced_noise(advanced_noise_model: AdvancedNoiseModel) -> Self
pub fn with_advanced_noise(advanced_noise_model: AdvancedNoiseModel) -> Self
Create a new state vector simulator with an advanced noise model
Sourcepub fn with_buffer_pool(
parallel: bool,
max_buffers: usize,
target_size: usize,
) -> Self
pub fn with_buffer_pool( parallel: bool, max_buffers: usize, target_size: usize, ) -> Self
Create simulator with custom buffer pool configuration
Sourcepub fn set_noise_model(&mut self, noise_model: NoiseModel) -> &mut Self
pub fn set_noise_model(&mut self, noise_model: NoiseModel) -> &mut Self
Set the basic noise model
Sourcepub fn set_advanced_noise_model(
&mut self,
advanced_noise_model: AdvancedNoiseModel,
) -> &mut Self
pub fn set_advanced_noise_model( &mut self, advanced_noise_model: AdvancedNoiseModel, ) -> &mut Self
Set the advanced noise model
Sourcepub fn remove_noise_model(&mut self) -> &mut Self
pub fn remove_noise_model(&mut self) -> &mut Self
Remove all noise models
Sourcepub const fn set_simd_enabled(&mut self, enabled: bool) -> &mut Self
pub const fn set_simd_enabled(&mut self, enabled: bool) -> &mut Self
Enable or disable SIMD optimizations
Sourcepub const fn set_gate_fusion_enabled(&mut self, enabled: bool) -> &mut Self
pub const fn set_gate_fusion_enabled(&mut self, enabled: bool) -> &mut Self
Enable or disable gate fusion optimization
Sourcepub const fn get_buffer_pool(&self) -> &Mutex<BufferPool>
pub const fn get_buffer_pool(&self) -> &Mutex<BufferPool>
Get access to buffer pool for testing purposes
Sourcepub fn enable_diagnostics(&mut self) -> &mut Self
pub fn enable_diagnostics(&mut self) -> &mut Self
Enable diagnostics and monitoring
Sourcepub fn disable_diagnostics(&mut self) -> &mut Self
pub fn disable_diagnostics(&mut self) -> &mut Self
Disable diagnostics and monitoring
Sourcepub fn get_diagnostics_report(&self) -> Option<DiagnosticReport>
pub fn get_diagnostics_report(&self) -> Option<DiagnosticReport>
Get diagnostics report if diagnostics are enabled
Sourcepub fn high_performance() -> Self
pub fn high_performance() -> Self
Create a high-performance configuration
Source§impl StateVectorSimulator
impl StateVectorSimulator
Sourcepub const fn initialize_state(
&mut self,
num_qubits: usize,
) -> QuantRS2Result<()>
pub const fn initialize_state( &mut self, num_qubits: usize, ) -> QuantRS2Result<()>
Initialize state with specified number of qubits in |0…0⟩
Sourcepub fn get_state_mut(&mut self) -> Vec<Complex64> ⓘ
pub fn get_state_mut(&mut self) -> Vec<Complex64> ⓘ
Get mutable reference to the current quantum state
Sourcepub fn set_state(&mut self, _state: Vec<Complex64>) -> QuantRS2Result<()>
pub fn set_state(&mut self, _state: Vec<Complex64>) -> QuantRS2Result<()>
Set the quantum state
Sourcepub const fn apply_interface_circuit(
&mut self,
_circuit: &InterfaceCircuit,
) -> QuantRS2Result<()>
pub const fn apply_interface_circuit( &mut self, _circuit: &InterfaceCircuit, ) -> QuantRS2Result<()>
Apply an interface circuit to the quantum state
Sourcepub const fn apply_h(&mut self, _qubit: usize) -> QuantRS2Result<()>
pub const fn apply_h(&mut self, _qubit: usize) -> QuantRS2Result<()>
Apply Hadamard gate to qubit
Sourcepub const fn apply_x(&mut self, _qubit: usize) -> QuantRS2Result<()>
pub const fn apply_x(&mut self, _qubit: usize) -> QuantRS2Result<()>
Apply Pauli-X gate to qubit
Sourcepub const fn apply_z_public(&mut self, _qubit: usize) -> QuantRS2Result<()>
pub const fn apply_z_public(&mut self, _qubit: usize) -> QuantRS2Result<()>
Apply Pauli-Z gate to qubit
Sourcepub const fn apply_cnot_public(
&mut self,
_control: usize,
_target: usize,
) -> QuantRS2Result<()>
pub const fn apply_cnot_public( &mut self, _control: usize, _target: usize, ) -> QuantRS2Result<()>
Apply CNOT gate (public interface with usize indices)
Sourcepub const fn apply_toffoli(
&mut self,
control1: QubitId,
control2: QubitId,
target: QubitId,
) -> QuantRS2Result<()>
pub const fn apply_toffoli( &mut self, control1: QubitId, control2: QubitId, target: QubitId, ) -> QuantRS2Result<()>
Apply Toffoli (CCNOT) gate (public interface)
Sourcepub const fn apply_fredkin(
&mut self,
control: QubitId,
target1: QubitId,
target2: QubitId,
) -> QuantRS2Result<()>
pub const fn apply_fredkin( &mut self, control: QubitId, target1: QubitId, target2: QubitId, ) -> QuantRS2Result<()>
Apply Fredkin (CSWAP) gate (public interface)
Trait Implementations§
Source§impl Clone for StateVectorSimulator
impl Clone for StateVectorSimulator
Source§impl Debug for StateVectorSimulator
impl Debug for StateVectorSimulator
Source§impl Default for StateVectorSimulator
impl Default for StateVectorSimulator
Auto Trait Implementations§
impl !Freeze for StateVectorSimulator
impl !RefUnwindSafe for StateVectorSimulator
impl Send for StateVectorSimulator
impl Sync for StateVectorSimulator
impl Unpin for StateVectorSimulator
impl !UnwindSafe for StateVectorSimulator
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,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.