Skip to main content

EdModel

Struct EdModel 

Source
pub struct EdModel<B> { /* private fields */ }
Expand description

One owned basis and operator specification reusable across frontend calls.

Implementations§

Source§

impl<B> EdModel<B>
where B: Basis + Clone, B::State: Hash + Ord + 'static,

Source

pub fn new( basis: impl Into<B>, terms: impl IntoIterator<Item = OperatorSpec>, ) -> Self

Source

pub fn with_checks(self, checks: AssemblyChecks) -> Self

Source

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.

Source

pub fn with_site_permutation(self, permutation: &[usize]) -> Result<Self>

Source

pub const fn basis(&self) -> &B

Source

pub fn terms(&self) -> &[OperatorSpec]

Source

pub fn components(&self) -> &[PackedTermComponent]

Source

pub fn component_names(&self) -> impl Iterator<Item = &str>

Source

pub fn dimension(&self) -> usize

Source

pub fn states(&self) -> Result<Vec<B::State>>

Source

pub fn scatter_state_vector( &self, values: &[Complex64], full_dimension: usize, ) -> Result<Vec<Complex64>>
where usize: TryFrom<B::State>,

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.

Source

pub fn scatter_density( &self, values: &[Complex64], full_dimension: usize, ) -> Result<Vec<Complex64>>
where usize: TryFrom<B::State>,

Scatter both axes of a row-major density matrix by packed state.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn materialize(&self, format: MatrixFormat) -> Result<Operator>

Materialize an owned operator for callers that do not need reuse.

Source

pub fn materialize_with( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, ) -> Result<Operator>

Evaluate this basis-owned fixed/parameterized operator family.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn eigh(&self, options: EighOptions) -> Result<Eigensystem>

Source

pub fn eigh_with( &self, parameters: &HashMap<String, Complex64>, options: EighOptions, ) -> Result<Eigensystem>

Source

pub fn eigsh( &self, format: MatrixFormat, options: EigshOptions, ) -> Result<Eigensystem>

Source

pub fn eigsh_with( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, options: EigshOptions, ) -> Result<Eigensystem>

Source

pub fn eigsh_with_initial( &self, format: MatrixFormat, options: EigshOptions, initial: &[Complex64], ) -> Result<Eigensystem>

Source

pub fn eigsh_with_initial_and_parameters( &self, parameters: &HashMap<String, Complex64>, format: MatrixFormat, options: EigshOptions, initial: &[Complex64], ) -> Result<Eigensystem>

Source

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.

Source

pub fn evolve_batch_with( &self, parameters: &HashMap<String, Complex64>, initial_columns: &[Vec<Complex64>], options: EvolutionOptions, ) -> Result<StateBatchTrajectory>

Source

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.

Source

pub fn evolve_time_dependent_batch<F>( &self, initial_columns: &[Vec<Complex64>], initial_time: f64, options: EvolutionOptions, coefficients_at: F, ) -> Result<StateBatchTrajectory>
where F: Fn(f64, &mut [Complex64]) -> Result<()> + Send + Sync + 'static,

Evolve this basis-owned parameterized family with coefficients supplied at the integrator’s internal physical times.

Source

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>
where F: Fn(f64, &mut [Complex64]) -> Result<()> + Send + Sync + 'static,

Trait Implementations§

Source§

impl<B: Clone> Clone for EdModel<B>

Source§

fn clone(&self) -> EdModel<B>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug> Debug for EdModel<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,