pub fn primitive(self) -> Self {
        if self.is_zero() {
            return self;
        }
        let largest_gcd = self
            .vec
            .iter()
            .fold(self.vec[0].abs() as usize, |largest_gcd, item| {
                gcd(item.abs() as usize, largest_gcd)
            }) as isize;

        if largest_gcd == 1 {
            self
        } else {
            Poly::new(self.vec.iter().map(|e| e / largest_gcd).collect())
        }
    }
/// Returns the [primitive polynomial] of `self` over the integers.
///
/// # Examples:
///
/// ```ignore
/// // 6x^2 + 4x + 2 -> 3x^2 + 2x + 1
/// assert_eq!(poly![2, 4, 6], poly![1, 2, 3]);
/// ```
///
/// [primitive polynomial]: https://en.wikipedia.org/wiki/Primitive_part_and_content
Returns the [primitive polynomial] of `self` over the integers.
Returns the [ primitive polynomial ] of ` self ` over the integers .
pub fn primitive(self) -> Self {
        if self.is_zero() {
            return self;
        }
        let largest_gcd = self
            .vec
            .iter()
            .fold(self.vec[0].abs() as usize, |largest_gcd, item| {
                gcd(item.abs() as usize, largest_gcd)
            }) as isize;
        if largest_gcd == 1 {
            self
        } else {
            Poly::new(self.vec.iter().map(|e| e / largest_gcd).collect())
        }
    }
pub fn primitive ( self ) -> Self { if self . is_zero ( ) { return self ; } let largest_gcd = self . vec . iter ( ) . fold ( self . vec [ 0 ] . abs ( ) as usize , | largest_gcd , item | { gcd ( item . abs ( ) as usize , largest_gcd ) } ) as isize ; if largest_gcd == 1 { self } else { Poly :: new ( self . vec . iter ( ) . map ( | e | e / largest_gcd ) . collect ( ) ) } }
Returns the [primitive polynomial] of `self` over the integers.
Returns the [ primitive polynomial ] of ` self ` over the integers .
self
self
examples:
None