Trait relp_num::NonZeroFactorizable [−][src]
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; 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.
Associated Types
Some number greater than 1, probably a prime but not necessarily.
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
fn 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.