Struct rgsl::types::polynomial::PolyComplexWorkspace
source · [−]pub struct PolyComplexWorkspace { /* private fields */ }
Implementations
sourceimpl PolyComplexWorkspace
impl PolyComplexWorkspace
sourcepub fn new(n: usize) -> Option<Self>
pub fn new(n: usize) -> Option<Self>
This function allocates space for a gsl_poly_complex_workspace struct and a workspace suitable for solving a polynomial with n coefficients using the routine gsl_poly_complex_solve.
The function returns a pointer to the newly allocated gsl_poly_complex_workspace if no errors were detected, and a null pointer in the case of error.
sourcepub fn solve(&mut self, a: &[f64], z: &mut [f64]) -> Value
pub fn solve(&mut self, a: &[f64], z: &mut [f64]) -> Value
This function computes the roots of the general polynomial P(x) = a_0 + a_1 x + a_2 x^2 + … + a_{n-1} x^{n-1} using balanced-QR reduction of the companion matrix. The parameter n specifies the length of the coefficient array. The coefficient of the highest order term must be non-zero. The function requires a workspace w of the appropriate size. The n-1 roots are returned in the packed complex array z of length 2(n-1), alternating real and imaginary parts.
The function returns Success if all the roots are found. If the QR reduction does not converge, the error handler is invoked with an error code of Failed. Note that due to finite precision, roots of higher multiplicity are returned as a cluster of simple roots with reduced accuracy. The solution of polynomials with higher-order roots requires specialized algorithms that take the multiplicity structure into account (see e.g. Z. Zeng, Algorithm 835, ACM Transactions on Mathematical Software, Volume 30, Issue 2 (2004), pp 218–236).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PolyComplexWorkspace
impl !Send for PolyComplexWorkspace
impl !Sync for PolyComplexWorkspace
impl Unpin for PolyComplexWorkspace
impl UnwindSafe for PolyComplexWorkspace
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more