pub struct PartialDerivPlan { /* private fields */ }
Expand description
Plan for computing coefficients for partial derivatives.
This struct holds a plan for efficiently evaluating the partial derivative of polynomials.
§Examples
The partial derivative of $f(x, y) = x y - x^2 + 2$ (coefficients: [0, 1, 0, -1, 0, 2]
) to the first variable, $x$:
use nutils_poly::PartialDerivPlan;
use sqnc::traits::*;
let f = [0, 1, 0, -1, 0, 2];
let plan = PartialDerivPlan::new(
2, // number of variables
2, // degree
0, // variable to compute the partial derivative to
).unwrap();
assert!(Iterator::eq(
plan.apply(f)?.iter(),
[1, -2, 0],
));
Implementations§
Source§impl PartialDerivPlan
impl PartialDerivPlan
Sourcepub fn new(nvars: usize, degree: Power, var: usize) -> Option<Self>
pub fn new(nvars: usize, degree: Power, var: usize) -> Option<Self>
Plan the partial derivative of a polynomial.
Sourcepub fn apply<Coeffs>(
&self,
coeffs: Coeffs,
) -> Result<PartialDeriv<'_, Coeffs>, Error>where
Coeffs: Sequence,
pub fn apply<Coeffs>(
&self,
coeffs: Coeffs,
) -> Result<PartialDeriv<'_, Coeffs>, Error>where
Coeffs: Sequence,
Returns the partial derivative of a polynomial.
§Errors
If the number of coefficients of the input doesn’t match
PartialDerivPlan::ncoeffs_input()
then this function returns an
error.
Sourcepub fn ncoeffs_input(&self) -> usize
pub fn ncoeffs_input(&self) -> usize
Returns the number of coefficients for the input polynomial.
Sourcepub fn ncoeffs_output(&self) -> usize
pub fn ncoeffs_output(&self) -> usize
Returns the number of coefficients for the partial derivative.
Sourcepub fn degree_output(&self) -> Power
pub fn degree_output(&self) -> Power
Returns the degree of the partial derivative.
Trait Implementations§
Source§impl Clone for PartialDerivPlan
impl Clone for PartialDerivPlan
Source§fn clone(&self) -> PartialDerivPlan
fn clone(&self) -> PartialDerivPlan
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 PartialDerivPlan
impl RefUnwindSafe for PartialDerivPlan
impl Send for PartialDerivPlan
impl Sync for PartialDerivPlan
impl Unpin for PartialDerivPlan
impl UnwindSafe for PartialDerivPlan
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