pub struct HalfStateVector {
pub amps: Vec<HalfComplex>,
pub n_qubits: usize,
pub format: HalfFormat,
}Expand description
A state vector whose amplitudes are stored in a 16-bit format.
Uses half the memory of an f32 StateVector; conversions go through
HalfStateVector::from_dense / HalfStateVector::to_dense.
Fields§
§amps: Vec<HalfComplex>§n_qubits: usize§format: HalfFormatImplementations§
Source§impl HalfStateVector
impl HalfStateVector
Sourcepub fn from_dense(sv: &StateVector, format: HalfFormat) -> Self
pub fn from_dense(sv: &StateVector, format: HalfFormat) -> Self
Pack a dense f32 state vector into the chosen 16-bit format.
Sourcepub fn to_dense(&self) -> QuantumResult<StateVector>
pub fn to_dense(&self) -> QuantumResult<StateVector>
Unpack back to a full-precision f32 StateVector.
§Errors
Propagates the dense constructor’s qubit-count validation.
Trait Implementations§
Source§impl Clone for HalfStateVector
impl Clone for HalfStateVector
Source§fn clone(&self) -> HalfStateVector
fn clone(&self) -> HalfStateVector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 HalfStateVector
impl RefUnwindSafe for HalfStateVector
impl Send for HalfStateVector
impl Sync for HalfStateVector
impl Unpin for HalfStateVector
impl UnsafeUnpin for HalfStateVector
impl UnwindSafe for HalfStateVector
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