pub struct TropicalPolynomial { /* private fields */ }Expand description
Tropical polynomial: max_i(a_i + i*x)
Represents a piecewise linear convex function.
Implementations§
Source§impl TropicalPolynomial
impl TropicalPolynomial
Sourcepub fn from_coeffs(coeffs: &[f64]) -> Self
pub fn from_coeffs(coeffs: &[f64]) -> Self
Create polynomial from coefficients (index = exponent)
Sourcepub fn from_monomials(terms: Vec<TropicalMonomial>) -> Self
pub fn from_monomials(terms: Vec<TropicalMonomial>) -> Self
Create from explicit monomials
Sourcepub fn roots(&self) -> Vec<f64>
pub fn roots(&self) -> Vec<f64>
Find roots (bend points) of the tropical polynomial These are x values where two linear pieces meet
Sourcepub fn num_linear_regions(&self) -> usize
pub fn num_linear_regions(&self) -> usize
Count linear regions (pieces) of the tropical polynomial This equals 1 + number of roots
Trait Implementations§
Source§impl Clone for TropicalPolynomial
impl Clone for TropicalPolynomial
Source§fn clone(&self) -> TropicalPolynomial
fn clone(&self) -> TropicalPolynomial
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TropicalPolynomial
impl RefUnwindSafe for TropicalPolynomial
impl Send for TropicalPolynomial
impl Sync for TropicalPolynomial
impl Unpin for TropicalPolynomial
impl UnwindSafe for TropicalPolynomial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more