Skip to main content

ExpressionComplexity

Struct ExpressionComplexity 

Source
pub struct ExpressionComplexity {
Show 25 fields pub additions: usize, pub subtractions: usize, pub multiplications: usize, pub divisions: usize, pub powers: usize, pub exponentials: usize, pub logarithms: usize, pub square_roots: usize, pub absolute_values: usize, pub negations: usize, pub comparisons: usize, pub logical_ands: usize, pub logical_ors: usize, pub logical_nots: usize, pub existential_quantifiers: usize, pub universal_quantifiers: usize, pub conditionals: usize, pub predicates: usize, pub constants: usize, pub variables: usize, pub min_operations: usize, pub max_operations: usize, pub max_depth: usize, pub unique_variables: usize, pub unique_predicates: usize,
}
Expand description

Detailed complexity analysis of an expression.

Fields§

§additions: usize

Number of addition operations

§subtractions: usize

Number of subtraction operations

§multiplications: usize

Number of multiplication operations

§divisions: usize

Number of division operations

§powers: usize

Number of power operations

§exponentials: usize

Number of exponential operations

§logarithms: usize

Number of logarithm operations

§square_roots: usize

Number of square root operations

§absolute_values: usize

Number of absolute value operations

§negations: usize

Number of negation operations

§comparisons: usize

Number of comparison operations

§logical_ands: usize

Number of logical AND operations

§logical_ors: usize

Number of logical OR operations

§logical_nots: usize

Number of logical NOT operations

§existential_quantifiers: usize

Number of existential quantifiers

§universal_quantifiers: usize

Number of universal quantifiers

§conditionals: usize

Number of conditional expressions

§predicates: usize

Number of predicate applications

§constants: usize

Number of constants

§variables: usize

Number of variables

§min_operations: usize

Number of min operations

§max_operations: usize

Number of max operations

§max_depth: usize

Maximum nesting depth

§unique_variables: usize

Number of unique variable names

§unique_predicates: usize

Number of unique predicate names

Implementations§

Source§

impl ExpressionComplexity

Source

pub fn arithmetic_operations(&self) -> usize

Get total number of arithmetic operations.

Source

pub fn logical_operations(&self) -> usize

Get total number of logical operations.

Source

pub fn total_operations(&self) -> usize

Get total number of operations.

Source

pub fn total_cost(&self) -> f64

Calculate total weighted cost using default weights.

Source

pub fn total_cost_with_weights(&self, weights: &CostWeights) -> f64

Calculate total weighted cost using custom weights.

Source

pub fn leaf_count(&self) -> usize

Get the number of leaf nodes (constants, variables, predicates).

Source

pub fn cse_potential(&self) -> bool

Estimate if this expression would benefit from CSE.

Source

pub fn strength_reduction_potential(&self) -> bool

Estimate if this expression would benefit from strength reduction.

Source

pub fn complexity_level(&self) -> &'static str

Estimate relative complexity as a string descriptor.

Trait Implementations§

Source§

impl Clone for ExpressionComplexity

Source§

fn clone(&self) -> ExpressionComplexity

Returns a duplicate 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 Debug for ExpressionComplexity

Source§

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

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

impl Default for ExpressionComplexity

Source§

fn default() -> ExpressionComplexity

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

impl Display for ExpressionComplexity

Source§

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

Formats the value using the given formatter. 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
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> 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> 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.