EfficientStateVector

Struct EfficientStateVector 

Source
pub struct EfficientStateVector { /* private fields */ }
Expand description

A memory-efficient storage for large quantum state vectors with SciRS2 enhancements

This provides memory-efficient storage and operations for quantum states, with support for chunk-based processing, buffer pools, and advanced memory management.

Implementations§

Source§

impl EfficientStateVector

Source

pub fn new(num_qubits: usize) -> QuantRS2Result<Self>

Create a new efficient state vector for the given number of qubits

Source

pub fn with_config( num_qubits: usize, config: MemoryConfig, ) -> QuantRS2Result<Self>

Create a new efficient state vector with custom memory configuration

Source

pub fn new_gpu_optimized(num_qubits: usize) -> QuantRS2Result<Self>

Create state vector optimized for GPU operations

Source

pub fn num_qubits(&self) -> usize

Get the number of qubits

Source

pub fn size(&self) -> usize

Get the size of the state vector

Source

pub fn data(&self) -> &[Complex64]

Get a reference to the state data

Source

pub fn data_mut(&mut self) -> &mut [Complex64]

Get a mutable reference to the state data

Source

pub fn normalize(&mut self) -> QuantRS2Result<()>

Normalize the state vector using SciRS2 optimizations

Source

pub fn get_probability(&self, basis_state: usize) -> QuantRS2Result<f64>

Calculate the probability of measuring a specific basis state

Source

pub fn process_chunks<F>( &mut self, chunk_size: usize, f: F, ) -> QuantRS2Result<()>
where F: Fn(&mut [Complex64], usize) + Send + Sync,

Apply a function to chunks of the state vector with SciRS2 optimization

This is useful for operations that can be parallelized or when working with states too large to fit in cache.

Source

pub fn optimize_memory_layout(&mut self) -> QuantRS2Result<()>

Optimize memory layout for better cache performance

Source

pub fn clone_optimized(&self) -> QuantRS2Result<Self>

Clone state vector with memory optimization

Source

pub fn get_config(&self) -> &MemoryConfig

Get memory configuration

Source

pub fn update_config(&mut self, config: MemoryConfig) -> QuantRS2Result<()>

Update memory configuration

Source§

impl EfficientStateVector

Source

pub fn memory_stats(&self) -> StateMemoryStats

Get enhanced memory usage statistics

Source

pub fn memory_efficiency_report(&self) -> String

Get memory efficiency report

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V