pub enum ZipTerm {
Read(usize),
Const(i64),
Real(u64),
Op(ZipOp, Box<ZipTerm>, Box<ZipTerm>),
Select(Box<ZipTerm>, Box<ZipTerm>, Box<ZipTerm>),
Abs(Box<ZipTerm>),
}Expand description
The term a zip loop computes from the elements it reads at the counter’s index: arithmetic, comparisons and
selects over array elements and constants. A guarded accumulation (If P: Set s to s + E) is the select
P ? E : 0; a call of one of the program’s pure functions is its body, inlined.
Variants§
Read(usize)
The element of operand k (the k-th distinct array the loop reads, in reading order).
Const(i64)
Real(u64)
A Real constant, by its bits.
Op(ZipOp, Box<ZipTerm>, Box<ZipTerm>)
Select(Box<ZipTerm>, Box<ZipTerm>, Box<ZipTerm>)
cond ? then : else, cond a boolean.
Abs(Box<ZipTerm>)
abs(x).
Implementations§
Source§impl ZipTerm
impl ZipTerm
Sourcepub fn ty(&self, reads: &[Ty]) -> Option<Ty>
pub fn ty(&self, reads: &[Ty]) -> Option<Ty>
The term’s type when operand k holds a reads[k]; None when an operator sees an operand it does not
take, a select’s guard is not a boolean or its arms differ in type, or the term is a boolean select.
Sourcepub fn eval(&self, row: &[i64]) -> Option<i64>
pub fn eval(&self, row: &[i64]) -> Option<i64>
The term’s value at one element, every operand an Int (row[k] the element of operand k), booleans
as 0 and 1; None when an intermediate value leaves 64 bits or it has none.
Sourcepub fn eval_within(&self, row: &[i64], lo: i128, hi: i128) -> Option<i64>
pub fn eval_within(&self, row: &[i64], lo: i128, hi: i128) -> Option<i64>
Self::eval with every intermediate value held to lo..=hi (None when one leaves it).
Sourcepub fn value(
&self,
row: &[Scalar],
ints: (i128, i128),
reals: f64,
) -> Result<Scalar, Stop>
pub fn value( &self, row: &[Scalar], ints: (i128, i128), reals: f64, ) -> Result<Scalar, Stop>
The term’s value at one element (row[k] the element of operand k) as the VM computes it, every Int
held to ints and every Real finite and within ±reals. Only the arm a select takes is evaluated, as
the VM’s If does (and a mux keeps).
Trait Implementations§
impl Eq for ZipTerm
impl StructuralPartialEq for ZipTerm
Auto Trait Implementations§
impl Freeze for ZipTerm
impl RefUnwindSafe for ZipTerm
impl Send for ZipTerm
impl Sync for ZipTerm
impl Unpin for ZipTerm
impl UnsafeUnpin for ZipTerm
impl UnwindSafe for ZipTerm
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.