Minor corrections in README.md

This commit is contained in:
Miguel Marco 2017-03-20 13:47:37 +01:00
parent bde0120212
commit 56e328f1d6
Signed by: mmarco
GPG Key ID: DD0114EDB7410592
2 changed files with 9 additions and 16 deletions

View File

@ -3,7 +3,7 @@
## General description. ## General description.
This is a library for computing homotopy continuation of a given root of one This is a library for computing homotopy continuation of a given root of one
dimensional sections of bivariate complex polynomials (of degree greater than 2). dimensional sections of bivariate complex polynomials.
The output is a piecewise linear aproximation of the path followed by the root, The output is a piecewise linear aproximation of the path followed by the root,
with the property that there is a tubular neighborhood, with square transversal with the property that there is a tubular neighborhood, with square transversal
section, that contains the actual path, and there is a three times thicker tubular section, that contains the actual path, and there is a three times thicker tubular
@ -25,7 +25,7 @@ the [MPFR](http://www.mpfr.org/) and [GMP](https://gmplib.org/) libraries.
## Usage: ## Usage:
After installing the library, you can call it from any .cpp program by calling After installing the library, you can call it from any .cpp program by calling
the homotopyPath or homotopyPath_mp functions. In the file tests/sirocco_test.cpp the `homotopyPath` or `homotopyPath_mp` functions. In the file tests/sirocco_test.cpp
you can see a simple example you can see a simple example
### Double precission: ### Double precission:

View File

@ -20,13 +20,6 @@ cdef extern from "sirocco.h":
def devuelve(RealNumber a):
cdef mpfr_prec_t ap = mpfr_get_prec(a.value)
cdef RealNumber my_number = RealField(ap)()
mpfr_set(my_number.value, a.value, MPFR_RNDN)
return my_number
def contpath_mp(deg, values, RealNumber y0r, RealNumber y0i, int prec): def contpath_mp(deg, values, RealNumber y0r, RealNumber y0i, int prec):
cdef int cdeg = deg cdef int cdeg = deg
cdef mpfr_t* cvalues = <mpfr_t*> sage_malloc(sizeof(mpfr_t)*len(values)) cdef mpfr_t* cvalues = <mpfr_t*> sage_malloc(sizeof(mpfr_t)*len(values))
@ -39,7 +32,7 @@ def contpath_mp(deg, values, RealNumber y0r, RealNumber y0i, int prec):
mpfr_set(cvalues[j], (<RealNumber>values[j]).value, MPFR_RNDN) mpfr_set(cvalues[j], (<RealNumber>values[j]).value, MPFR_RNDN)
sig_off() sig_off()
cdef mpfr_t y0R cdef mpfr_t y0R
cdef mpfr_t y0I cdef mpfr_t y0I
sig_on() sig_on()
mpfr_init2(y0R, prec) mpfr_init2(y0R, prec)
mpfr_set(y0R, (<RealNumber>y0r).value, MPFR_RNDN) mpfr_set(y0R, (<RealNumber>y0r).value, MPFR_RNDN)
@ -56,11 +49,11 @@ def contpath_mp(deg, values, RealNumber y0r, RealNumber y0i, int prec):
if rop == NULL: if rop == NULL:
raise ValueError("libsirocco could not guarantee one step") raise ValueError("libsirocco could not guarantee one step")
cdef int n = mpfr_get_si(rop[0], MPFR_RNDN) cdef int n = mpfr_get_si(rop[0], MPFR_RNDN)
#cdef RealNumber res = RealField(53)() #cdef RealNumber res = RealField(53)()
cdef double res cdef double res
l = [] l = []
for i in range(1, 3*n+1): for i in range(1, 3*n+1):
RN = RealField(prec)() RN = RealField(prec)()
sig_on() sig_on()
@ -70,7 +63,7 @@ def contpath_mp(deg, values, RealNumber y0r, RealNumber y0i, int prec):
l.append(RN) l.append(RN)
free(rop) free(rop)
return [(l[3*i], l[3*i+1], l[3*i+2]) for i in range(len(l)/3)] return [(l[3*i], l[3*i+1], l[3*i+2]) for i in range(len(l)/3)]
@ -80,9 +73,9 @@ def contpath(deg,values,y0r,y0i):
cdef int clen = <int> len(values) cdef int clen = <int> len(values)
for i,v in enumerate(values): for i,v in enumerate(values):
c_values[i] = values[i] c_values[i] = values[i]
cdef double y0R = y0r cdef double y0R = y0r
cdef double y0I = y0i cdef double y0I = y0i
sig_on() sig_on()