Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jauslin <ian.jauslin@roma1.infn.it>2015-10-07 12:51:41 +0000
committerIan Jauslin <ian.jauslin@roma1.infn.it>2015-10-07 13:00:23 +0000
commit469bdc80712dbf9c12562059dc4594620b59a076 (patch)
treec6da40a884899110d102d82a7a778f2b3afae702 /src/grouped_polynomial.c
parente7aa6859f08565d58684fa4b9c40fed716f0ba17 (diff)
Support MPFR floats in numkondov1.4
Remove '-D' option (error tolerance) in numkondo
Diffstat (limited to 'src/grouped_polynomial.c')
-rw-r--r--src/grouped_polynomial.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/grouped_polynomial.c b/src/grouped_polynomial.c
index b7bea42..0d4d75d 100644
--- a/src/grouped_polynomial.c
+++ b/src/grouped_polynomial.c
@@ -732,7 +732,7 @@ int char_array_to_Grouped_Polynomial(Char_Array str, Grouped_Polynomial* output)
}
-// evaluate an equation on a vector
+// eValuate an equation on a vector
int evaleq(RCC* rccs, Grouped_Polynomial poly){
int i;
long double* res=calloc((*rccs).length,sizeof(long double));
@@ -762,4 +762,32 @@ int evaleq(RCC* rccs, Grouped_Polynomial poly){
return(0);
}
+// evaluate an equation on a vector (using mpfr floats)
+int evaleq_mpfr(RCC_mpfr* rccs, Grouped_Polynomial poly){
+ int i;
+ mpfr_t* res;
+
+ if((*rccs).length!=poly.length){
+ fprintf(stderr, "error: trying to evaluate an flow equation with %d components on an rcc with %d\n",poly.length,(*rccs).length);
+ exit(-1);
+ }
+
+ res=calloc((*rccs).length,sizeof(mpfr_t));
+
+ // for each equation
+ for(i=0;i<poly.length;i++){
+ evalcoef_mpfr(*rccs, poly.coefs[i], res[i]);
+ }
+
+ // copy res to rccs
+ for(i=0;i<(*rccs).length;i++){
+ mpfr_set((*rccs).values[i], res[i], MPFR_RNDN);
+ mpfr_clear(res[i]);
+ }
+
+ // free memory
+ free(res);
+ return(0);
+}
+