Treat degree 1 polynomials as a separate case for derivative evaluation.
This commit is contained in:
parent
66c8e81146
commit
bde0120212
@ -240,6 +240,12 @@ T Polynomial<T>::diffX (const T &x, const T &y) const {
|
||||
// sets output to 0+0i
|
||||
T rop;
|
||||
|
||||
if (this->degree == 1){
|
||||
|
||||
rop = (this->coef)[1];
|
||||
return rop;
|
||||
}
|
||||
|
||||
// compute all powers of x and y
|
||||
// (from 0 to degree-1) (from 0 to degree) resp
|
||||
T xPower[this->degree], yPower[this->degree+1];
|
||||
@ -272,6 +278,12 @@ T Polynomial<T>::evalPolYClassic (const T &x, const T &y) const {
|
||||
// sets output to 0+0i
|
||||
T rop;
|
||||
|
||||
if (this->degree == 1){
|
||||
rop = (this->coef)[2];
|
||||
return rop;
|
||||
|
||||
}
|
||||
|
||||
// compute all powers of x and y
|
||||
// (from 0 to degree) (from 0 to degree-1) resp
|
||||
T xPower[this->degree], yPower[this->degree];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user