pub struct EdModel<B> { /* private fields */ }Expand description
One owned basis and operator specification reusable across frontend calls.
Implementations§
Source§impl<B> EdModel<B>
impl<B> EdModel<B>
pub fn new( basis: impl Into<B>, terms: impl IntoIterator<Item = OperatorSpec>, ) -> Self
pub fn with_checks(self, checks: AssemblyChecks) -> Self
Sourcepub fn with_components(
self,
components: impl IntoIterator<Item = PackedTermComponent>,
) -> Result<Self>
pub fn with_components( self, components: impl IntoIterator<Item = PackedTermComponent>, ) -> Result<Self>
Add named local-term components to this basis-owned model.
Names and defaults are validated before any operator assembly. The components may be non-Hermitian individually; Hermiticity is checked after evaluating a concrete parameter set.
pub fn with_site_permutation(self, permutation: &[usize]) -> Result<Self>
pub const fn basis(&self) -> &B
pub fn terms(&self) -> &[OperatorSpec]
pub fn components(&self) -> &[PackedTermComponent]
pub fn component_names(&self) -> impl Iterator<Item = &str>
pub fn dimension(&self) -> usize
pub fn states(&self) -> Result<Vec<B::State>>
Sourcepub fn scatter_state_vector(
&self,
values: &[Complex64],
full_dimension: usize,
) -> Result<Vec<Complex64>>
pub fn scatter_state_vector( &self, values: &[Complex64], full_dimension: usize, ) -> Result<Vec<Complex64>>
Scatter a basis-ordered vector into packed-state index order.
Explicit tensor-product parents may expose a frontend-compatible row ordering rather than ascending packed states. Subsystem kernels use the packed state itself as the mixed-radix row index, so this method makes that conversion explicit and reusable.
Sourcepub fn scatter_density(
&self,
values: &[Complex64],
full_dimension: usize,
) -> Result<Vec<Complex64>>
pub fn scatter_density( &self, values: &[Complex64], full_dimension: usize, ) -> Result<Vec<Complex64>>
Scatter both axes of a row-major density matrix by packed state.
Sourcepub fn reduction_images(
&self,
states: &[B::State],
) -> Result<Vec<Option<ReductionImage<B::State>>>>
pub fn reduction_images( &self, states: &[B::State], ) -> Result<Vec<Option<ReductionImage<B::State>>>>
Query canonical representatives and normalized orbit coefficients.
This works for both explicit and symmetry-reduced bases and does not materialize an operator or projector.
Sourcepub fn projector_to(&self, parent: &Self) -> Result<BasisProjector>
pub fn projector_to(&self, parent: &Self) -> Result<BasisProjector>
Build the sparse isometry from this model’s basis into an explicit parent model’s basis.
The parent is deliberately explicit: frontends may choose either a particle-conserving parent or the unrestricted physical Hilbert space without encoding either policy in the Rust core.
Sourcepub fn embedding_to(&self, parent: &Self) -> Result<BasisProjector>
pub fn embedding_to(&self, parent: &Self) -> Result<BasisProjector>
Build a one-hot embedding when this basis is an explicitly selected subset of a parent that uses the same physical state identifiers.
Unlike PackedEdModel::projector_to, this does not apply symmetry
orbit amplitudes. Frontends use it for filters such as a fixed total
excitation inside an otherwise identical product basis.
Sourcepub fn lift_to_batch(
&self,
parent: &Self,
vectors: &[Vec<Complex64>],
) -> Result<Vec<Vec<Complex64>>>
pub fn lift_to_batch( &self, parent: &Self, vectors: &[Vec<Complex64>], ) -> Result<Vec<Vec<Complex64>>>
Lift a batch of reduced-space vectors into an explicit parent model.
Sourcepub fn project_from_batch(
&self,
parent: &Self,
vectors: &[Vec<Complex64>],
) -> Result<Vec<Vec<Complex64>>>
pub fn project_from_batch( &self, parent: &Self, vectors: &[Vec<Complex64>], ) -> Result<Vec<Vec<Complex64>>>
Project a batch of parent-space vectors into this model’s basis.
Sourcepub fn apply_terms_from_batch(
&self,
source: &Self,
terms: impl IntoIterator<Item = OperatorSpec>,
inputs: &[Vec<Complex64>],
) -> Result<Vec<Vec<Complex64>>>
pub fn apply_terms_from_batch( &self, source: &Self, terms: impl IntoIterator<Item = OperatorSpec>, inputs: &[Vec<Complex64>], ) -> Result<Vec<Vec<Complex64>>>
Apply temporary terms directly from a source model into this target model without materializing either physical parent space.
Sourcepub fn apply_terms_between_subspaces_batch(
source: &Self,
source_projector: Option<&BasisProjector>,
target: &Self,
target_projector: Option<&BasisProjector>,
terms: impl IntoIterator<Item = OperatorSpec>,
inputs: &[Vec<Complex64>],
) -> Result<Vec<Vec<Complex64>>>
pub fn apply_terms_between_subspaces_batch( source: &Self, source_projector: Option<&BasisProjector>, target: &Self, target_projector: Option<&BasisProjector>, terms: impl IntoIterator<Item = OperatorSpec>, inputs: &[Vec<Complex64>], ) -> Result<Vec<Vec<Complex64>>>
Apply temporary local terms between arbitrary isometric subspaces.
source and target own the physical local algebras. Optional
projectors describe reduced coordinates inside those explicit parent
bases. Omitting a projector selects the entire corresponding parent
basis, so this one operation covers ordinary sector shifts,
reduced-to-full, full-to-reduced, and reduced-to-reduced actions:
output = P_target† O P_source input.
The local operator is streamed through PackedEdModel::apply_terms_from_batch;
neither a square parent-space operator nor a dense projector product is
materialized.
Sourcepub fn materialized(&self, format: MatrixFormat) -> Result<Arc<Operator>>
pub fn materialized(&self, format: MatrixFormat) -> Result<Arc<Operator>>
Return the assembled operator shared by all calls using this model.
Assembly is performed at most once per storage format. Clones of an unchanged model share the same cache; model-transforming builders reset it before changing checks or site labels.
Sourcepub fn materialize(&self, format: MatrixFormat) -> Result<Operator>
pub fn materialize(&self, format: MatrixFormat) -> Result<Operator>
Materialize an owned operator for callers that do not need reuse.
Sourcepub fn materialize_with(
&self,
parameters: &HashMap<String, Complex64>,
format: MatrixFormat,
) -> Result<Operator>
pub fn materialize_with( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, ) -> Result<Operator>
Evaluate this basis-owned fixed/parameterized operator family.
Sourcepub fn assemble_terms(
&self,
terms: impl IntoIterator<Item = OperatorSpec>,
checks: AssemblyChecks,
format: MatrixFormat,
) -> Result<Operator>
pub fn assemble_terms( &self, terms: impl IntoIterator<Item = OperatorSpec>, checks: AssemblyChecks, format: MatrixFormat, ) -> Result<Operator>
Assemble caller-supplied terms on this model’s already-owned basis.
This is the native narrow waist for low-level basis operations. The terms use the model’s original site convention and are relabeled by the same permutation as its persistent terms.
Sourcepub fn apply_terms_batch(
&self,
terms: impl IntoIterator<Item = OperatorSpec>,
inputs: &[Vec<Complex64>],
action: OperatorAction,
) -> Result<Vec<Vec<Complex64>>>
pub fn apply_terms_batch( &self, terms: impl IntoIterator<Item = OperatorSpec>, inputs: &[Vec<Complex64>], action: OperatorAction, ) -> Result<Vec<Vec<Complex64>>>
Apply one temporary operator to a batch of column vectors.
The operator is assembled once for the whole batch and never converted to a dense matrix.
Sourcepub fn apply_batch(
&self,
inputs: &[Vec<Complex64>],
action: OperatorAction,
) -> Result<Vec<Vec<Complex64>>>
pub fn apply_batch( &self, inputs: &[Vec<Complex64>], action: OperatorAction, ) -> Result<Vec<Vec<Complex64>>>
Apply the model’s persistent terms without dense materialization.
The matrix-free representation is cached after the first call and reused by subsequent vectors and algebraic views.
Sourcepub fn apply_batch_with(
&self,
parameters: &HashMap<String, Complex64>,
inputs: &[Vec<Complex64>],
action: OperatorAction,
) -> Result<Vec<Vec<Complex64>>>
pub fn apply_batch_with( &self, parameters: &HashMap<String, Complex64>, inputs: &[Vec<Complex64>], action: OperatorAction, ) -> Result<Vec<Vec<Complex64>>>
Apply one evaluated member of this basis-owned operator family.
Sourcepub fn bra_ket_terms(
&self,
terms: impl IntoIterator<Item = OperatorSpec>,
kets: &[B::State],
) -> Result<Vec<Vec<BraKetTransition<B::State>>>>
pub fn bra_ket_terms( &self, terms: impl IntoIterator<Item = OperatorSpec>, kets: &[B::State], ) -> Result<Vec<Vec<BraKetTransition<B::State>>>>
Return raw local transitions grouped by input ket.
Unlike square operator assembly, this operation intentionally does not reduce destination states into the model’s symmetry sector.
pub fn eigh(&self, options: EighOptions) -> Result<Eigensystem>
pub fn eigh_with( &self, parameters: &HashMap<String, Complex64>, options: EighOptions, ) -> Result<Eigensystem>
pub fn eigsh( &self, format: MatrixFormat, options: EigshOptions, ) -> Result<Eigensystem>
pub fn eigsh_with( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, options: EigshOptions, ) -> Result<Eigensystem>
pub fn eigsh_with_initial( &self, format: MatrixFormat, options: EigshOptions, initial: &[Complex64], ) -> Result<Eigensystem>
pub fn eigsh_with_initial_and_parameters( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, options: EigshOptions, initial: &[Complex64], ) -> Result<Eigensystem>
Sourcepub fn evolve_batch(
&self,
initial_columns: &[Vec<Complex64>],
options: EvolutionOptions,
) -> Result<StateBatchTrajectory>
pub fn evolve_batch( &self, initial_columns: &[Vec<Complex64>], options: EvolutionOptions, ) -> Result<StateBatchTrajectory>
Evolve independent state columns under this model’s static Hamiltonian.
The matrix-free operator is cached and shared with normal operator applications. Numerical evolution remains a Rust-core capability; the language bindings only convert arrays and time grids.
pub fn evolve_batch_with( &self, parameters: &HashMap<String, Complex64>, initial_columns: &[Vec<Complex64>], options: EvolutionOptions, ) -> Result<StateBatchTrajectory>
Sourcepub fn operator_model(
&self,
format: MatrixFormat,
) -> Result<PackedOperatorModel>
pub fn operator_model( &self, format: MatrixFormat, ) -> Result<PackedOperatorModel>
Convert this basis-owned model into a basis-independent operator family without losing named components or their defaults.
Sourcepub fn evolve_time_dependent_batch<F>(
&self,
initial_columns: &[Vec<Complex64>],
initial_time: f64,
options: EvolutionOptions,
coefficients_at: F,
) -> Result<StateBatchTrajectory>
pub fn evolve_time_dependent_batch<F>( &self, initial_columns: &[Vec<Complex64>], initial_time: f64, options: EvolutionOptions, coefficients_at: F, ) -> Result<StateBatchTrajectory>
Evolve this basis-owned parameterized family with coefficients supplied at the integrator’s internal physical times.
pub fn evolve_time_dependent_batch_scaled<F>( &self, initial_columns: &[Vec<Complex64>], initial_time: f64, options: EvolutionOptions, operator_scale: Complex64, coefficients_at: F, ) -> Result<StateBatchTrajectory>
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for EdModel<B>where
B: Freeze,
impl<B> RefUnwindSafe for EdModel<B>where
B: RefUnwindSafe,
impl<B> Send for EdModel<B>where
B: Send,
impl<B> Sync for EdModel<B>where
B: Sync,
impl<B> Unpin for EdModel<B>where
B: Unpin,
impl<B> UnsafeUnpin for EdModel<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for EdModel<B>where
B: UnwindSafe,
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.