pub struct QulacsStateVector { /* private fields */ }Expand description
Qulacs-inspired quantum state vector
This structure provides a high-performance state vector implementation following Qulacs’ design principles, adapted to use SciRS2’s abstractions.
Implementations§
Source§impl QulacsStateVector
impl QulacsStateVector
Sourcepub fn from_amplitudes(amplitudes: Array1<Complex64>) -> Result<Self>
pub fn from_amplitudes(amplitudes: Array1<Complex64>) -> Result<Self>
Sourcepub fn num_qubits(&self) -> usize
pub fn num_qubits(&self) -> usize
Get the number of qubits
Sourcepub fn dim(&self) -> StateIndex
pub fn dim(&self) -> StateIndex
Get the dimension of the state vector
Sourcepub fn amplitudes(&self) -> &Array1<Complex64>
pub fn amplitudes(&self) -> &Array1<Complex64>
Get a reference to the state amplitudes
Sourcepub fn amplitudes_mut(&mut self) -> &mut Array1<Complex64>
pub fn amplitudes_mut(&mut self) -> &mut Array1<Complex64>
Get a mutable reference to the state amplitudes
Sourcepub fn norm_squared(&self) -> f64
pub fn norm_squared(&self) -> f64
Calculate the squared norm of the state vector
Uses efficient array operations (SciRS2 ndarray is already optimized)
Sourcepub fn normalize(&mut self) -> Result<()>
pub fn normalize(&mut self) -> Result<()>
Normalize the state vector
Uses SciRS2 ndarray operations (already optimized)
Sourcepub fn inner_product(&self, other: &Self) -> Result<Complex64>
pub fn inner_product(&self, other: &Self) -> Result<Complex64>
Calculate inner product with another state vector
⟨self|other⟩ using SciRS2 ndarray operations
Sourcepub fn probability_one(&self, target: QubitIndex) -> Result<f64>
pub fn probability_one(&self, target: QubitIndex) -> Result<f64>
Sourcepub fn probability_zero(&self, target: QubitIndex) -> Result<f64>
pub fn probability_zero(&self, target: QubitIndex) -> Result<f64>
Sourcepub fn measure(&mut self, target: QubitIndex) -> Result<bool>
pub fn measure(&mut self, target: QubitIndex) -> Result<bool>
Sourcepub fn sample_qubits(
&self,
qubits: &[QubitIndex],
shots: usize,
) -> Result<Vec<Vec<bool>>>
pub fn sample_qubits( &self, qubits: &[QubitIndex], shots: usize, ) -> Result<Vec<Vec<bool>>>
Trait Implementations§
Source§impl Clone for QulacsStateVector
impl Clone for QulacsStateVector
Source§fn clone(&self) -> QulacsStateVector
fn clone(&self) -> QulacsStateVector
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 QulacsStateVector
impl RefUnwindSafe for QulacsStateVector
impl Send for QulacsStateVector
impl Sync for QulacsStateVector
impl Unpin for QulacsStateVector
impl UnwindSafe for QulacsStateVector
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 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.