Enum TDim

Source
pub enum TDim {
    Val(i64),
    Sym(Symbol),
    Add(Vec<TDim>),
    Mul(Vec<TDim>),
    MulInt(i64, Box<TDim>),
    Div(Box<TDim>, u64),
    Broadcast(Vec<TDim>),
    Min(Vec<TDim>),
    Max(Vec<TDim>),
}

Variants§

§

Val(i64)

§

Sym(Symbol)

§

Add(Vec<TDim>)

§

Mul(Vec<TDim>)

§

MulInt(i64, Box<TDim>)

§

Div(Box<TDim>, u64)

§

Broadcast(Vec<TDim>)

§

Min(Vec<TDim>)

§

Max(Vec<TDim>)

Implementations§

Source§

impl TDim

Source

pub fn is_one(&self) -> bool

Source

pub fn to_i64(&self) -> Result<i64, Error>

Source

pub fn as_i64(&self) -> Option<i64>

Source

pub fn eval_to_i64(&self, values: &SymbolValues) -> Result<i64, Error>

Source

pub fn eval(&self, values: &SymbolValues) -> TDim

Source

pub fn eval_with_scenario(&self, scenario: &str) -> TDim

Source

pub fn substitute(&self, from: &Symbol, to: &TDim) -> Result<TDim, Error>

Source

pub fn reduce(self) -> TDim

Source

pub fn find_scope(&self) -> Option<SymbolScope>

Source

pub fn simplify(self) -> TDim

Source

pub fn low_inclusive_bound(&self) -> Option<i64>

Source

pub fn high_inclusive_bound(&self) -> Option<i64>

Source

pub fn prove_positive_or_zero(&self) -> bool

Source

pub fn prove_strict_positive(&self) -> bool

Source

pub fn prove_negative_or_zero(&self) -> bool

Source

pub fn prove_strict_negative(&self) -> bool

Source

pub fn gcd(&self) -> u64

Source

pub fn div_ceil(self, rhs: u64) -> TDim

Source

pub fn symbols(&self) -> HashSet<Symbol>

Source

pub fn compatible_with(&self, other: &TDim) -> bool

Trait Implementations§

Source§

impl<'a> Add<&'a TDim> for TDim

Source§

type Output = TDim

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a TDim) -> TDim

Performs the + operation. Read more
Source§

impl<I> Add<I> for TDim
where I: Into<TDim>,

Source§

type Output = TDim

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I) -> TDim

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a TDim> for TDim

Source§

fn add_assign(&mut self, rhs: &'a TDim)

Performs the += operation. Read more
Source§

impl<I> AddAssign<I> for TDim
where I: Into<TDim>,

Source§

fn add_assign(&mut self, rhs: I)

Performs the += operation. Read more
Source§

impl Bounded for TDim

Source§

fn min_value() -> TDim

Returns the smallest finite number this type can represent
Source§

fn max_value() -> TDim

Returns the largest finite number this type can represent
Source§

impl Clone for TDim

Source§

fn clone(&self) -> TDim

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl CoerceFrom<Value> for TDim

Source§

fn coerce(builder: &mut ModelBuilder<'_>, from: &Value) -> Result<TDim, Error>

Source§

impl Datum for TDim

Source§

fn name() -> &'static str

Source§

fn datum_type() -> DatumType

Source§

fn is<D>() -> bool
where D: Datum,

Source§

impl Debug for TDim

Source§

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

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

impl Default for TDim

Source§

fn default() -> TDim

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

impl DimLike for TDim

Source§

fn maybe_div(&self, other: &TDim) -> Result<(TDim, u64), Error>

Source§

fn to_i64(&self) -> Result<i64, Error>

Convert to regular integer.
Source§

fn eval(&self, values: &SymbolValues) -> TDim

Substitute as many symbols as possible in the dim value.
Source§

fn substitute(&self, from: &Symbol, to: &TDim) -> Result<TDim, Error>

Source§

fn eval_to_i64(&self, values: &SymbolValues) -> Result<i64, Error>

Full evaluation of the symbol, failing if a symbol is missing
Source§

fn broadcast(self, other: TDim) -> Result<TDim, Error>

Source§

fn compatible_with(&self, other: &TDim) -> bool

Source§

fn mini(self, other: TDim) -> TDim

Source§

fn maxi(self, other: TDim) -> TDim

Source§

fn divceil(&self, other: usize) -> Self

Integer divise, rounding up to next integer.
Source§

fn to_usize(&self) -> Result<usize, Error>

Source§

fn to_isize(&self) -> Result<isize, Error>

Source§

fn to_i32(&self) -> Result<i32, Error>

Source§

impl Display for TDim

Source§

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

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

impl<I> Div<I> for TDim
where I: AsPrimitive<u64> + PrimInt,

Source§

type Output = TDim

The resulting type after applying the / operator.
Source§

fn div(self, rhs: I) -> TDim

Performs the / operation. Read more
Source§

impl<I> DivAssign<I> for TDim
where I: AsPrimitive<u64> + PrimInt,

Source§

fn div_assign(&mut self, rhs: I)

Performs the /= operation. Read more
Source§

impl<'a> From<&'a Symbol> for TDim

Source§

fn from(it: &'a Symbol) -> TDim

Converts to this type from the input type.
Source§

impl<'a> From<&'a i32> for TDim

Source§

fn from(v: &'a i32) -> TDim

Converts to this type from the input type.
Source§

impl<'a> From<&'a i64> for TDim

Source§

fn from(v: &'a i64) -> TDim

Converts to this type from the input type.
Source§

impl<'a> From<&'a isize> for TDim

Source§

fn from(v: &'a isize) -> TDim

Converts to this type from the input type.
Source§

impl<'a> From<&'a u64> for TDim

Source§

fn from(v: &'a u64) -> TDim

Converts to this type from the input type.
Source§

impl<'a> From<&'a usize> for TDim

Source§

fn from(v: &'a usize) -> TDim

Converts to this type from the input type.
Source§

impl From<Symbol> for TDim

Source§

fn from(it: Symbol) -> TDim

Converts to this type from the input type.
Source§

impl From<TDim> for Tensor

Source§

fn from(it: TDim) -> Tensor

Converts to this type from the input type.
Source§

impl From<i32> for TDim

Source§

fn from(v: i32) -> TDim

Converts to this type from the input type.
Source§

impl From<i64> for TDim

Source§

fn from(v: i64) -> TDim

Converts to this type from the input type.
Source§

impl From<isize> for TDim

Source§

fn from(v: isize) -> TDim

Converts to this type from the input type.
Source§

impl From<u64> for TDim

Source§

fn from(v: u64) -> TDim

Converts to this type from the input type.
Source§

impl From<usize> for TDim

Source§

fn from(v: usize) -> TDim

Converts to this type from the input type.
Source§

impl Hash for TDim

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> Mul<&'a TDim> for TDim

Source§

type Output = TDim

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a TDim) -> TDim

Performs the * operation. Read more
Source§

impl<I> Mul<I> for TDim
where I: Into<TDim>,

Source§

type Output = TDim

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: I) -> TDim

Performs the * operation. Read more
Source§

impl<'a> MulAssign<&'a TDim> for TDim

Source§

fn mul_assign(&mut self, rhs: &'a TDim)

Performs the *= operation. Read more
Source§

impl<I> MulAssign<I> for TDim
where I: Into<TDim>,

Source§

fn mul_assign(&mut self, rhs: I)

Performs the *= operation. Read more
Source§

impl Neg for TDim

Source§

type Output = TDim

The resulting type after applying the - operator.
Source§

fn neg(self) -> TDim

Performs the unary - operation. Read more
Source§

impl One for TDim

Source§

fn one() -> TDim

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl PartialEq for TDim

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Product<&'a TDim> for TDim

Source§

fn product<I>(iter: I) -> TDim
where I: Iterator<Item = &'a TDim>,

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl Product for TDim

Source§

fn product<I>(iter: I) -> TDim
where I: Iterator<Item = TDim>,

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<I> Rem<I> for TDim
where I: AsPrimitive<u64> + PrimInt,

Source§

type Output = TDim

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: I) -> TDim

Performs the % operation. Read more
Source§

impl<I> RemAssign<I> for TDim
where I: AsPrimitive<u64> + PrimInt,

Source§

fn rem_assign(&mut self, rhs: I)

Performs the %= operation. Read more
Source§

impl<'a> Sub<&'a TDim> for TDim

Source§

type Output = TDim

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a TDim) -> TDim

Performs the - operation. Read more
Source§

impl<I> Sub<I> for TDim
where I: Into<TDim>,

Source§

type Output = TDim

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I) -> TDim

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a TDim> for TDim

Source§

fn sub_assign(&mut self, rhs: &'a TDim)

Performs the -= operation. Read more
Source§

impl<I> SubAssign<I> for TDim
where I: Into<TDim>,

Source§

fn sub_assign(&mut self, rhs: I)

Performs the -= operation. Read more
Source§

impl<'a> Sum<&'a TDim> for TDim

Source§

fn sum<I>(iter: I) -> TDim
where I: Iterator<Item = &'a TDim>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Sum for TDim

Source§

fn sum<I>(iter: I) -> TDim
where I: Iterator<Item = TDim>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl ToDim for &TDim

Source§

fn to_dim(&self) -> TDim

Convert self to a TDim.
Source§

impl<'a> TryFrom<&'a TDim> for TDim

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(d: &'a TDim) -> Result<TDim, Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a TDim> for usize

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(d: &'a TDim) -> Result<usize, Error>

Performs the conversion.
Source§

impl Zero for TDim

Source§

fn zero() -> TDim

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl Eq for TDim

Source§

impl StructuralPartialEq for TDim

Auto Trait Implementations§

§

impl Freeze for TDim

§

impl !RefUnwindSafe for TDim

§

impl Send for TDim

§

impl Sync for TDim

§

impl Unpin for TDim

§

impl !UnwindSafe for TDim

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

Source§

impl<T> Downcast for T
where T: Any,

Source§

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

Convert 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.
Source§

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

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

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

Source§

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

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

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

Source§

impl<T> DynHash for T
where T: Hash + ?Sized,

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> 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> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
Source§

impl<D> Packing for D
where D: Datum,

Source§

impl<I> ToDim for I
where I: Into<TDim> + Clone,

Source§

fn to_dim(&self) -> TDim

Convert self to a TDim.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent
Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,