Back to Eqiora docs Skip to main content

ExprDagBuilder

Struct ExprDagBuilder 

pub struct ExprDagBuilder { /* private fields */ }
Description

Builder that makes forward references and cycles unrepresentable.

Implementations§

§

impl ExprDagBuilder

pub fn finite_unary( &mut self, operation: FiniteUnaryOperation, value: ExprId, ) -> Result<ExprId, Diagnostic>

Add a finite unary operation such as a transpose or adjoint; types are checked during semantic admission.

pub fn finite_binary( &mut self, operation: FiniteBinaryOperation, left: ExprId, right: ExprId, ) -> Result<ExprId, Diagnostic>

Add a finite binary operation; endpoint types are checked during inference.

§

impl ExprDagBuilder

pub fn property( &mut self, release: PropertyRelease, arguments: impl IntoIterator<Item = ExprId>, ) -> Result<ExprId, Diagnostic>

Add a property value together with its scientific identity. Equal values from different releases get distinct arena IDs.

§Errors

Rejects arguments to a constant or an invalid typed application.

pub fn bind_property( &mut self, id: ExprId, release: PropertyRelease, ) -> Result<(), Diagnostic>

Reattach a scientific identity to an existing node during replay.

§Errors

Rejects a foreign root, a duplicate annotation, a changed constant, or a substituted analytic definition: each annotation must match the value it is attached to.

§

impl ExprDagBuilder

pub fn project_operator_component<I>( &mut self, instance: &PureOperatorInstantiation<'_, I>, arguments: &[impl AsRef<[ExprId]>], component: &[u32], max_nodes: usize, ) -> Result<ExprId, Diagnostic>

Append one ordered scalar component of a checked pure instantiation. Each argument supplies its complete row-major scalar coordinates. The Model itself keeps the original application and definition. max_nodes bounds the whole destination arena before expansion allocates.

§

impl ExprDagBuilder

pub fn gradient(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Take the physical-space gradient.

pub fn divergence(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Take the physical-space divergence.

pub fn symmetric_part(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Take the symmetric part of a square Cartesian rank-two tensor.

pub fn isotropic_lift(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Lift a supported invariant scalar to an isotropic Cartesian tensor.

pub fn trace( &mut self, value: ExprId, on: Id<Domain>, ) -> Result<ExprId, Diagnostic>

Take a full trace on a boundary or physical-interface Domain. The operand’s support selects the adjacent parent.

pub fn normal_component( &mut self, value: ExprId, on: Id<Domain>, ) -> Result<ExprId, Diagnostic>

Contract with the normal of a boundary or physical-interface Domain. Exterior boundaries use the parent-outward normal; physical interfaces use the common normal of their first declared boundary.

pub fn pullback( &mut self, value: ExprId, source: Vec<ExprId>, at: Vec<(ExprId, ExprId)>, ) -> Result<ExprId, Diagnostic>

Pull a value back along a map between coordinate supports, before any numerical sampling. Type admission requires every coordinate to be bound, each with its own unit.

pub fn coordinate_map_factor( &mut self, factor: CoordinateMapFactor, source: Vec<ExprId>, at: Vec<(ExprId, ExprId)>, ) -> Result<ExprId, Diagnostic>

Derive a local Jacobian factor from a complete coordinate map.

§Errors

Rejects empty inventories and operands outside this expression arena.

pub fn coordinate_map_factor_action( &mut self, value: ExprId, parameter: ExprId, directions: Vec<ExprId>, ) -> Result<ExprId, Diagnostic>

Apply a dimensioned direction, one per mapped row, to a Jacobian factor. The directions are not assumed to be time derivatives; a conservation correspondence has to establish that separately.

§Errors

Rejects a non-factor value, a wrong row count, or unavailable operands.

§

impl ExprDagBuilder

pub fn new() -> ExprDagBuilder

Empty expression arena.

pub fn from_dag(expression: &ExprDag) -> ExprDagBuilder

Start from an existing DAG, keeping its node indices, definitions, and releases.

pub fn push(&mut self, node: ExprNode) -> Result<ExprId, Diagnostic>

Append one node and return its stable local ID.

pub fn validate_prior_operand(&self, operand: ExprId) -> Result<(), Diagnostic>

Check that an operand references an existing arena node without appending nodes.

§Errors

Rejects an ID outside the current arena using the ordinary operand diagnostic.

pub fn array( &mut self, elements: impl IntoIterator<Item = ExprId>, ) -> Result<ExprId, Diagnostic>

Construct an ordered outer channel array from existing DAG nodes.

pub fn index(&mut self, value: ExprId, index: u32) -> Result<ExprId, Diagnostic>

Select one outer channel-array element; type checking verifies the bound.

pub fn complex( &mut self, real: ExprId, imag: ExprId, ) -> Result<ExprId, Diagnostic>

Construct a complex scalar; typing checks both real scalar operands.

pub fn sample( &mut self, value: ExprId, clock: Id<ClockDomain>, ) -> Result<ExprId, Diagnostic>

Sample a continuous expression on a nominal clock. Semantic admission checks the clock and the owning activation.

pub fn hold(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Read a clocked State continuously. The operand must be a State symbol with explicit initialization and updates; no memory or initial value is created.

pub fn constant<V>(&mut self, value: V) -> Result<ExprId, Diagnostic>
where V: TryInto<ValueLiteral>, <V as TryInto<ValueLiteral>>::Error: Display,

Add a checked constant; a numerical quantity supplies an explicit real scalar type.

pub fn symbol(&mut self, symbol: SymbolRef) -> Result<ExprId, Diagnostic>

Add a typed symbol reference.

pub fn require( &mut self, condition: ExprId, value: ExprId, ) -> Result<ExprId, Diagnostic>

Require a true domain condition before demanding the complete value.

pub fn select( &mut self, condition: ExprId, then_value: ExprId, else_value: ExprId, ) -> Result<ExprId, Diagnostic>

Select one complete value lazily from a Boolean condition.

pub fn min(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Select the smaller scalar, retaining the first operand on ties. Both operands are demanded; typing requires identical ordered scalar types.

pub fn max(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Select the larger scalar, retaining the first operand on ties. Both operands are demanded; typing requires identical ordered scalar types.

pub fn compare( &mut self, op: ComparisonOp, left: ExprId, right: ExprId, ) -> Result<ExprId, Diagnostic>

Compare two scalar expressions.

pub fn not(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Negate a Boolean expression.

pub fn and(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Short-circuit Boolean conjunction.

pub fn or(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Short-circuit Boolean disjunction.

pub fn neg(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Add unary negation.

pub fn add(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Add two expressions.

pub fn sub(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Subtract two expressions.

pub fn mul(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Multiply two expressions.

pub fn div(&mut self, left: ExprId, right: ExprId) -> Result<ExprId, Diagnostic>

Divide two expressions.

pub fn quotient( &mut self, left: ExprId, right: ExprId, ) -> Result<ExprId, Diagnostic>

Checked integer quotient.

pub fn remainder( &mut self, left: ExprId, right: ExprId, ) -> Result<ExprId, Diagnostic>

Checked integer remainder.

pub fn ordinal(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Explicit nominal index ordinal projection.

pub fn to_real(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Explicit integer-to-real conversion.

pub fn to_integer(&mut self, value: ExprId) -> Result<ExprId, Diagnostic>

Checked integral real-to-integer conversion.

pub fn powi( &mut self, base: ExprId, exponent: i32, ) -> Result<ExprId, Diagnostic>

Raise an expression to an integer power.

pub fn coordinate( &mut self, support: Id<Domain>, factor: Id<Domain>, axis: usize, ) -> Result<ExprId, Diagnostic>

Read one coordinate-factor axis on a declared support. Whole-Model admission checks factor membership, axis bounds, and units.

pub fn unary_math( &mut self, function: UnaryMathFunction, value: ExprId, ) -> Result<ExprId, Diagnostic>

Apply a dimension-aware unary mathematical function.

pub fn coordinate_partial( &mut self, value: ExprId, wrt: ExprId, ) -> Result<ExprId, Diagnostic>

Add a coordinate partial derivative; the numerical representation decides whether it is supported.

§Errors

Rejects operands outside this builder or beyond the expression arena limits.

pub fn evaluate_at( &mut self, value: ExprId, at: Vec<(ExprId, ExprId)>, side: Option<BoundarySide>, ) -> Result<ExprId, Diagnostic>

Evaluate an expression at a point that gives every coordinate, without choosing a numerical representation.

§Errors

Rejects an empty or oversized point and operands outside the expression arena.

pub fn pure_operator( &mut self, definition: &PureOperatorDefinition, arguments: impl IntoIterator<Item = ExprId>, ) -> Result<ExprId, Diagnostic>

Apply a closed pure-operator definition to earlier expressions.

The definition is deduplicated by content digest and stored in the finished expression. Arguments are matched to formal slots by position; there is no lookup by name and no implicit commutativity.

§Errors

Returns EQ0301 for an empty or wrongly sized argument list, a forward reference, or a digest collision between different canonical definitions.

pub fn finish( self, roots: impl IntoIterator<Item = ExprId>, ) -> Result<ExprDag, Diagnostic>

Finish a DAG with one or more output roots.

§Errors

Returns EQ0301 when the arena or root set is empty, or a root is not present in this arena.

Trait Implementations§

§

impl Debug for ExprDagBuilder

§

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

Formats the value using the given formatter. Read more
§

impl Default for ExprDagBuilder

§

fn default() -> ExprDagBuilder

Returns the “default value” for a type. Read more

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
§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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

§

impl<T, Dst> ConvAsUtil<Dst> for T

§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
§

impl<T> ConvUtil for T

§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
§

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

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
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.
§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

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

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,