pub trait NonZeroFactorizable: NonZero + Clone {
type Factor: NonZero + Eq + PartialEq + Ord + PartialOrd + Hash + Clone + Debug;
type Power: Add<Output = Self::Power> + AddAssign + Sub<Output = Self::Power> + SubAssign + One + Signed + Eq + Copy + Clone + Debug;
// Required method
fn factorize(&self) -> NonZeroFactorization<Self::Factor, Self::Power>;
}Expand description
Creating a factorization of an integer or rational number.
This factorization does not necessarily consist of primes, as this can be computationally expensive.
Required Associated Types§
Sourcetype Factor: NonZero + Eq + PartialEq + Ord + PartialOrd + Hash + Clone + Debug
type Factor: NonZero + Eq + PartialEq + Ord + PartialOrd + Hash + Clone + Debug
Some number greater than 1, probably a prime but not necessarily.
Sourcetype Power: Add<Output = Self::Power> + AddAssign + Sub<Output = Self::Power> + SubAssign + One + Signed + Eq + Copy + Clone + Debug
type Power: Add<Output = Self::Power> + AddAssign + Sub<Output = Self::Power> + SubAssign + One + Signed + Eq + Copy + Clone + Debug
How often the factor appears in the number.
This is marked Copy, because a 64-bit power already allows for values up to 2^(2^64), which has about 5.6 * 10^18 decimal digits. Finding primes that are larger than that is too expensive.
Required Methods§
Sourcefn factorize(&self) -> NonZeroFactorization<Self::Factor, Self::Power>
fn factorize(&self) -> NonZeroFactorization<Self::Factor, Self::Power>
Decompose into factors.
Note that these factors will often be, but are not guaranteed to be, primes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.