| Crates.io | polynomial-ring |
| lib.rs | polynomial-ring |
| version | 0.5.1 |
| created_at | 2020-04-05 04:54:02.289392+00 |
| updated_at | 2025-04-11 17:33:34.781962+00 |
| description | A polynomial implementation |
| homepage | |
| repository | https://gitlab.com/Toru3/polynomial-ring |
| max_upload_size | |
| id | 226493 |
| size | 46,024 |
A polynomial implementation.
use num::Rational64;
use polynomial_ring::Polynomial;
let f = Polynomial::new(vec![3, 1, 4, 1, 5].into_iter().map(|x| Rational64::from_integer(x)).collect());
let g = Polynomial::new(vec![2, 7, 1].into_iter().map(|x| Rational64::from_integer(x)).collect());
let mut r = f.clone();
let q = r.division(&g);
assert_eq!(f, q * g + r);
let f = Polynomial::new(vec![3, 1, 4, 1, 5].into_iter().map(|x| rug::Rational::from(x)).collect());
let g = Polynomial::new(vec![2, 7, 1].into_iter().map(|x| rug::Rational::from(x)).collect());
let mut r = f.clone();
let q = r.division(&g);
assert_eq!(f, q * g + r);
The Add, Sub, Mul, Div, and Rem traits are implemented for polynomials.
Polynomials also support computing derivative, square free, pseudo division, and resultant.
AGPL-3.0-or-later