diff --git a/include/polynomial.hpp b/include/polynomial.hpp index 11202fc..5d8194f 100644 --- a/include/polynomial.hpp +++ b/include/polynomial.hpp @@ -309,6 +309,16 @@ T Polynomial::diffXX (const T &x, const T &y) const { // sets output to 0+0i T rop; + + if (this->degree == 1){ + + return rop; + } + if (this->degree == 2) + { + rop = T(2)*(this->coef)[3]; + return rop; + } // compute all powers of x and y // (from 0 to degree-2) (from 0 to degree-2) resp @@ -340,6 +350,17 @@ T Polynomial::diffXY (const T &x, const T &y) const { // sets output to 0+0i T rop; + + if (this->degree == 1){ + + return rop; + } + if (this->degree == 2) + { + rop = T(2)*(this->coef)[4]; + return rop; + } + // compute all powers of x and y // (from 0 to degree-2) (from 0 to degree-2) resp @@ -372,6 +393,16 @@ T Polynomial::diffYY (const T &x, const T &y) const { // sets output to 0+0i T rop; + + if (this->degree == 1){ + + return rop; + } + if (this->degree == 2) + { + rop = T(2)*(this->coef)[5]; + return rop; + } // compute all powers of x and y // (from 0 to degree-2) (from 0 to degree-2) resp diff --git a/tests/sirocco_minimal_test.cpp b/tests/sirocco_minimal_test.cpp index bd45ac2..5c6e083 100644 --- a/tests/sirocco_minimal_test.cpp +++ b/tests/sirocco_minimal_test.cpp @@ -6,38 +6,27 @@ int main(int argc, char const *argv[]) { mpfr_set_default_prec (162); - double testCoefs[] = {0.000000000000000, -0.000000000000000, 0.000000000000000, --0.000000000000000, 0.000000000000000, -0.000000000000000, -0.000000000000000, -0.000000000000000, -128.000000000000, --128.000000000000, -96.0000000000000, -96.0000000000000, -0.000000000000000, -0.000000000000000, 0.000000000000000, --0.000000000000000, 72.0000000000000, 72.0000000000000, -304.000000000000, 304.000000000000, 12.0000000000000, -12.0000000000000, 180.000000000000, 180.000000000000, -0.000000000000000, -0.000000000000000, 0.000000000000000, --0.000000000000000, 90.0000000000000, 90.0000000000000, --182.500000000000, -182.500000000000, 133.500000000000, -133.500000000000, -190.500000000000, -190.500000000000, -42.0000000000000, 42.0000000000000, -44.0000000000000, --44.0000000000000, 0.000000000000000, -0.000000000000000, -0.000000000000000, -0.000000000000000, -40.2500000000000, --40.2500000000000, 18.2500000000000, 18.2500000000000, --72.0000000000000, -72.0000000000000, 21.0000000000000, -21.0000000000000, -38.5000000000000, -38.5000000000000, -5.50000000000000, 5.50000000000000, -6.00000000000000, --6.00000000000000, -0.000000000000000, 0.000000000000000}; + double testCoefs[] = { +-2.000000000000000, -2.000000000000000, 0.000000000000000, 0.000000000000000, +0.000000000000000, 0.000000000000000, 0.000000000000000, -0.000000000000000, +0.000000000000, 0.000000000000, 0.0000000000000, 0.0000000000000, +1.000000000000000, 1.000000000000000, 0.000000000000000, -0.000000000000000, +0.00000000000000, 0.000000000000000, 0.000000000000000, 0.0000000000000000, +1.0000000000000, 1.000000000000000, 0.000000000000000, 0.0000000000000000 +}; - double y0R = 4.0; - double y0I = -4.0; - double *rop = homotopyPath (4, testCoefs, y0R, y0I); + + double y0R = 1.414; + double y0I = 0.0; + double *rop = homotopyPath (2, testCoefs, y0R, y0I); int len = (int) rop[0]; int i; delete [] rop; - mpfr_t mp_testCoefs[60]; - for (int i=0; i<60; ++i) { + mpfr_t mp_testCoefs[24]; + for (int i=0; i<24; ++i) { mpfr_init_set_d (mp_testCoefs[i], testCoefs[i], (i%2)? MPFR_RNDU : MPFR_RNDD); } @@ -45,7 +34,7 @@ int main(int argc, char const *argv[]) { mpfr_init_set_d (mp_y0R, y0R, MPFR_RNDN); mpfr_init_set_d (mp_y0I, y0I, MPFR_RNDN); - mpfr_t *mp_rop = homotopyPath_mp (4, mp_testCoefs, mp_y0R, mp_y0I, 5300); + mpfr_t *mp_rop = homotopyPath_mp (2, mp_testCoefs, mp_y0R, mp_y0I, 106); int size = mpfr_get_si (mp_rop[0], MPFR_RNDN); @@ -54,7 +43,7 @@ int main(int argc, char const *argv[]) { delete [] mp_rop; - for (int i=0; i<60; ++i) { + for (int i=0; i<24; ++i) { mpfr_clear (mp_testCoefs[i]); }