Enum tract_hir::internal::TDim

source ·
pub enum TDim {
    Val(i64),
    Sym(Symbol),
    Add(Vec<TDim>),
    Mul(Vec<TDim>),
    MulInt(i64, Box<TDim>),
    Div(Box<TDim>, u64),
}

Variants§

§

Val(i64)

§

Sym(Symbol)

§

Add(Vec<TDim>)

§

Mul(Vec<TDim>)

§

MulInt(i64, Box<TDim>)

§

Div(Box<TDim>, u64)

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 substitute(&self, from: &Symbol, to: &TDim) -> TDim

source

pub fn reduce(self) -> TDim

source

pub fn simplify(self) -> TDim

source

pub fn gcd(&self) -> u64

source

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

source

pub fn slope(&self, sym: &Symbol) -> (i64, u64)

source

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

source

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

true is both are equal of if there is one single symbol involved and there is a solution to make them equal

Trait Implementations§

source§

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

§

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

§

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 Datum for TDim

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 one() -> TDim

do not use num_traits::Mul as it implies a regular Mul
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) -> TDim

source§

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

Full evaluation of the symbol, failing if a symbol is missing
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,

§

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 FromIterator<TDim> for ShapeFactoid

source§

fn from_iter<I: IntoIterator<Item = TDim>>(iter: I) -> ShapeFactoid

Converts an iterator over usize into a closed shape.

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 IntoExp<GenericFactoid<TDim>> for &TDim

source§

fn bex(self) -> Exp<DimFact>

Converts the value to an Expression.
source§

impl IntoExp<GenericFactoid<TDim>> for TDim

source§

fn bex(self) -> Exp<DimFact>

Converts the value to an Expression.
source§

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

§

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

§

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

§

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 Output for TDim

source§

fn into_wrapped(source: TDim) -> Wrapped

Wraps the fact in the Wrapped type.
source§

fn from_wrapped(wrapped: Wrapped) -> TractResult<TDim>

Retrieves the fact from the Wrapped type. Panics if wrapped doesn’t have the right constructor.
source§

fn wrap(self) -> Wrapped

Wraps self in the Wrapped type.
source§

impl PartialEq for TDim

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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>,

Method which 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>,

Method which 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,

§

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

§

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

§

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

Method which 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>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<'a> ToDim for &'a TDim

source§

fn to_dim(&self) -> TDim

Convert self to a TDim.
source§

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

§

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

§

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> 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 + Send + Sync>

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

§

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§

default 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>,

§

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

§

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