pub struct QuantumOperator { /* private fields */ }Expand description
Named linear combination of operator components.
Implementations§
Source§impl QuantumOperator
impl QuantumOperator
Sourcepub fn new(
components: impl IntoIterator<Item = QuantumComponent>,
) -> Result<Self>
pub fn new( components: impl IntoIterator<Item = QuantumComponent>, ) -> Result<Self>
Construct a named linear family after validating names and shapes.
Sourcepub const fn shape(&self) -> (usize, usize)
pub const fn shape(&self) -> (usize, usize)
Return the common rectangular shape of every component.
Sourcepub fn component_names(&self) -> impl Iterator<Item = &str>
pub fn component_names(&self) -> impl Iterator<Item = &str>
Iterate component names in stable coefficient order.
Sourcepub fn components(&self) -> &[QuantumComponent]
pub fn components(&self) -> &[QuantumComponent]
Return every named component in stable coefficient order.
Sourcepub fn component(&self, name: &str) -> Result<&Operator>
pub fn component(&self, name: &str) -> Result<&Operator>
Look up one named component or return an invalid-options error.
Sourcepub fn resolve_coefficients(
&self,
parameters: &HashMap<String, Complex64>,
) -> Result<Vec<Complex64>>
pub fn resolve_coefficients( &self, parameters: &HashMap<String, Complex64>, ) -> Result<Vec<Complex64>>
Resolve named parameters into the stable component order returned by
Self::component_names.
This is the allocation-light coefficient boundary used by dynamic frontends: names are validated once at the edge, while repeated operator applications consume a compact coefficient slice.
Sourcepub fn apply_coefficients(
&self,
coefficients: &[Complex64],
input: &[Complex64],
output: &mut [Complex64],
) -> Result<()>
pub fn apply_coefficients( &self, coefficients: &[Complex64], input: &[Complex64], output: &mut [Complex64], ) -> Result<()>
Apply a compact ordered coefficient vector without materializing the linear combination.
Sourcepub fn apply(
&self,
parameters: &HashMap<String, Complex64>,
input: &[Complex64],
output: &mut [Complex64],
) -> Result<()>
pub fn apply( &self, parameters: &HashMap<String, Complex64>, input: &[Complex64], output: &mut [Complex64], ) -> Result<()>
Apply one named member of the family without assembling a temporary sparse matrix.
Sourcepub fn evaluate(
&self,
parameters: &HashMap<String, Complex64>,
format: MatrixFormat,
) -> Result<Operator>
pub fn evaluate( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, ) -> Result<Operator>
Materialize one parameter value in the requested format.
For repeated evaluations prefer QuantumOperator::plan, which
retains a common sparse pattern and updates only numeric values.
Sourcepub fn plan(&self, format: MatrixFormat) -> Result<QuantumOperatorPlan>
pub fn plan(&self, format: MatrixFormat) -> Result<QuantumOperatorPlan>
Prepare a fixed sparse pattern for repeated evaluations of this family.
The plan aligns every component on one union pattern, reuses all index arrays, and mutates only a preallocated value buffer. It supports dense, CSC, CSR, DIA, and matrix-free output without a model-specific fast path.
pub fn scaled(&self, coefficient: impl Into<Complex64>) -> Result<Self>
pub fn conjugated(&self) -> Result<Self>
pub fn add(&self, right: &Self) -> Result<Self>
pub fn adjoint(&self) -> Result<Self>
pub fn transpose(&self) -> Result<Self>
Trait Implementations§
Source§impl Clone for QuantumOperator
impl Clone for QuantumOperator
Source§fn clone(&self) -> QuantumOperator
fn clone(&self) -> QuantumOperator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for QuantumOperator
impl RefUnwindSafe for QuantumOperator
impl Send for QuantumOperator
impl Sync for QuantumOperator
impl Unpin for QuantumOperator
impl UnsafeUnpin for QuantumOperator
impl UnwindSafe for QuantumOperator
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,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.