Skip to main content

ExprNode

Enum ExprNode 

Source
pub enum ExprNode {
Show 18 variants RealConst(f64), ComplexConst(Complex<f64>), ScalarParam(Parameter), EventScalar(Arc<str>), EventP4Component { name: Arc<str>, component: P4Component, }, Unary { op: UnaryOp, input: ExprId, }, Binary { op: BinaryOp, lhs: ExprId, rhs: ExprId, }, NaryAdd { terms: Vec<ExprId>, }, NaryMul { factors: Vec<ExprId>, }, Complex { re: ExprId, im: ExprId, }, Vector { elements: Vec<ExprId>, }, Matrix { rows: usize, cols: usize, elements: Vec<ExprId>, }, Component { input: ExprId, index: usize, }, MatrixElement { input: ExprId, row: usize, col: usize, }, MatMul { lhs: ExprId, rhs: ExprId, }, MatVec { matrix: ExprId, vector: ExprId, }, Dot { lhs: ExprId, rhs: ExprId, }, Solve { matrix: ExprId, rhs: ExprId, },
}
Expand description

Serialized node in a topologically ordered ExprGraph.

Variants§

§

RealConst(f64)

A real constant.

§

ComplexConst(Complex<f64>)

A complex constant.

§

ScalarParam(Parameter)

A scalar fit parameter.

§

EventScalar(Arc<str>)

A named scalar event column.

§

EventP4Component

One component of a named event four-momentum.

Fields

§name: Arc<str>

Event column base name.

§component: P4Component

Requested four-momentum component.

§

Unary

A unary operation.

Fields

§op: UnaryOp

Operation to apply.

§input: ExprId

Input node.

§

Binary

A binary operation.

Fields

§op: BinaryOp

Operation to apply.

§lhs: ExprId

Left operand.

§rhs: ExprId

Right operand.

§

NaryAdd

A sum of zero or more terms.

Fields

§terms: Vec<ExprId>

Term nodes.

§

NaryMul

A product of zero or more factors.

Fields

§factors: Vec<ExprId>

Factor nodes.

§

Complex

A complex scalar assembled from real and imaginary expressions.

Fields

§re: ExprId

Real component.

§im: ExprId

Imaginary component.

§

Vector

A vector assembled from scalar elements.

Fields

§elements: Vec<ExprId>

Scalar element nodes.

§

Matrix

A row-major matrix assembled from scalar elements.

Fields

§rows: usize

Number of rows.

§cols: usize

Number of columns.

§elements: Vec<ExprId>

Row-major scalar elements.

§

Component

A vector component selection.

Fields

§input: ExprId

Vector input.

§index: usize

Zero-based component index.

§

MatrixElement

A matrix element selection.

Fields

§input: ExprId

Matrix input.

§row: usize

Zero-based row index.

§col: usize

Zero-based column index.

§

MatMul

Matrix-matrix multiplication.

Fields

§lhs: ExprId

Left matrix.

§rhs: ExprId

Right matrix.

§

MatVec

Matrix-vector multiplication.

Fields

§matrix: ExprId

Matrix operand.

§vector: ExprId

Vector operand.

§

Dot

Vector dot product.

Fields

§lhs: ExprId

Left vector.

§rhs: ExprId

Right vector.

§

Solve

Solution of a linear system.

Fields

§matrix: ExprId

Coefficient matrix.

§rhs: ExprId

Right-hand-side vector or matrix.

Implementations§

Source§

impl ExprNode

Source

pub fn semantics(&self, children: &[ExprNodeSemantics]) -> ExprNodeSemantics

Infers this node’s context-free value semantics from the already computed semantics of earlier nodes in the expression graph.

Source

pub fn dependency_kind(&self) -> ExprDependencyKind

Returns the intrinsic source of this node’s evaluation dependencies.

Source

pub fn from_folded_const(value: Complex<f64>) -> ExprNode

Creates the most compact constant-node representation for value.

Source

pub fn const_value(&self) -> Option<Complex<f64>>

Returns the node’s scalar constant value, if it is a constant.

Source

pub fn is_zero(node: &ExprNode) -> bool

Returns whether node is the scalar constant zero.

Source

pub fn is_one(node: &ExprNode) -> bool

Returns whether node is the scalar constant one.

Source

pub fn children(&self) -> impl ExactSizeIterator + DoubleEndedIterator

Iterates over this node’s direct dependencies in semantic operand order.

The iterator borrows the node and does not allocate. Binary operands are returned left-to-right, and vector, matrix, sum, and product children retain their stored order.

Source

pub fn child_ids(&self) -> Vec<ExprId>

Returns the identifiers of this node’s direct dependencies.

This compatibility helper collects Self::children. Prefer the borrowed iterator when an owned vector is not required.

Source

pub fn map_children(&self, map: impl FnMut(ExprId) -> ExprId) -> ExprNode

Returns a copy of this node with each direct dependency transformed.

Children are passed to map in the same semantic order as Self::children. Non-child fields are preserved exactly.

Trait Implementations§

Source§

impl Clone for ExprNode

Source§

fn clone(&self) -> ExprNode

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 Debug for ExprNode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ExprNode

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ExprNode, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Complex<f64>> for ExprNode

Source§

fn from(value: Complex<f64>) -> ExprNode

Converts to this type from the input type.
Source§

impl PartialEq for ExprNode

Source§

fn eq(&self, other: &ExprNode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ExprNode

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ExprNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

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 = !

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.