Treat degree 1 polynomials as a separate case for derivative evaluation.

This commit is contained in:
Miguel Marco 2017-03-07 12:09:54 +01:00
parent 66c8e81146
commit bde0120212
Signed by: mmarco
GPG Key ID: DD0114EDB7410592

View File

@ -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];