Changeset 850277 in git
- Timestamp:
- Mar 20, 2014, 3:27:31 PM (10 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 82393119769dfceb9f02d05dfaae6504348f93a4
- Parents:
- fb036e76ce9df79bac9d8b045ed2dee38b69a463
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-03-20 15:27:31+01:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-03-20 15:28:38+01:00
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Makefile.am
rfb036e r850277 86 86 scanner.cc\ 87 87 sdb.cc\ 88 links/s_buff.cc\89 88 links/silink.cc\ 90 89 links/sing_dbm.cc\ … … 141 140 sdb.h \ 142 141 links/silink.h \ 143 links/s_buff.h \144 142 links/sing_dbm.h \ 145 143 sing_win.h \ … … 147 145 links/ssiLink.h \ 148 146 links/simpleipc.h \ 149 si_signals.h \150 147 stype.h \ 151 148 subexpr.h \ -
Singular/cntrlc.cc
rfb036e r850277 31 31 #include <Singular/feOpt.h> 32 32 #include <Singular/misc_ip.h> 33 #include < Singular/si_signals.h>33 #include <reporter/si_signals.h> 34 34 #include <Singular/links/silink.h> 35 35 #include <Singular/links/ssiLink.h> -
Singular/fehelp.cc
rfb036e r850277 26 26 #include <resources/omFindExec.h> 27 27 28 #include < Singular/si_signals.h>28 #include <reporter/si_signals.h> 29 29 30 30 #include "ipid.h" -
Singular/iparith.cc
rfb036e r850277 80 80 //#include <kernel/mpr_inout.h> 81 81 82 #include < Singular/si_signals.h>82 #include <reporter/si_signals.h> 83 83 84 84 -
Singular/links/ndbm.cc
rfb036e r850277 17 17 #include "singularconfig.h" 18 18 #endif /* HAVE_CONFIG_H */ 19 #include < Singular/si_signals.h>19 #include <reporter/si_signals.h> 20 20 #include <kernel/mod2.h> 21 21 #ifdef HAVE_DBM -
Singular/links/pipeLink.cc
rfb036e r850277 29 29 #include "lists.h" 30 30 #include "pipeLink.h" 31 #include < Singular/si_signals.h>31 #include <reporter/si_signals.h> 32 32 33 33 typedef struct -
Singular/links/semaphore.c
rfb036e r850277 10 10 11 11 #include <Singular/cntrlc.h> 12 #include < Singular/si_signals.h>12 #include <reporter/si_signals.h> 13 13 14 14 #include <semaphore.h> -
Singular/links/silink.cc
rfb036e r850277 34 34 #include <Singular/links/ssiLink.h> 35 35 #include <Singular/links/pipeLink.h> 36 #include < Singular/si_signals.h>36 #include <reporter/si_signals.h> 37 37 #include "feOpt.h" 38 38 -
Singular/links/ssiLink.cc
rfb036e r850277 22 22 23 23 #include <kernel/mod2.h> 24 #include < Singular/si_signals.h>24 #include <reporter/si_signals.h> 25 25 // #include "mod2.h" 26 26 … … 46 46 #include <Singular/lists.h> 47 47 #include <Singular/blackbox.h> 48 #include < Singular/links/s_buff.h>48 #include <libpolys/reporter/s_buff.h> 49 49 #include <Singular/links/ssiLink.h> 50 50 … … 52 52 #include <Singular/links/simpleipc.h> 53 53 #endif 54 55 #include <Singular/si_signals.h>56 54 57 55 #define SSI_VERSION 6 … … 151 149 // or 3 6 <mpz_t raw nom.> <mpz_t raw denom.> 152 150 // or 3 7 <mpz_t raw nom.> 153 if(getCoeffType(cf)==n_Zp) 154 { 155 fprintf(d->f_write,"%d ",(int)(long)n); 156 //if (d->f_debug!=NULL) fprintf(d->f_debug,"number: \"%ld\" ",(int)(long)n); 157 } 158 else if (getCoeffType(cf)==n_Q) 159 { 160 if(SR_HDL(n) & SR_INT) 161 { 162 #if SIZEOF_LONG == 4 163 fprintf(d->f_write,"4 %ld ",SR_TO_INT(n)); 164 #else 165 long nn=SR_TO_INT(n); 166 if ((nn<POW_2_28)||(nn>= -POW_2_28)) 167 fprintf(d->f_write,"4 %ld ",nn); 168 else 169 { 170 mpz_t tmp; 171 mpz_init_set_si(tmp,nn); 172 fputs("8 ",d->f_write); 173 mpz_out_str (d->f_write,SSI_BASE, tmp); 174 fputc(' ',d->f_write); 175 mpz_clear(tmp); 176 } 177 #endif 178 //if (d->f_debug!=NULL) fprintf(d->f_debug,"number: short \"%ld\" ",SR_TO_INT(n)); 179 } 180 else if (n->s<2) 181 { 182 //gmp_fprintf(d->f_write,"%d %Zd %Zd ",n->s,n->z,n->n); 183 fprintf(d->f_write,"%d ",n->s+5); 184 mpz_out_str (d->f_write,SSI_BASE, n->z); 185 fputc(' ',d->f_write); 186 mpz_out_str (d->f_write,SSI_BASE, n->n); 187 fputc(' ',d->f_write); 188 189 //if (d->f_debug!=NULL) gmp_fprintf(d->f_debug,"number: s=%d gmp/gmp \"%Zd %Zd\" ",n->s,n->z,n->n); 190 } 191 else /*n->s==3*/ 192 { 193 //gmp_fprintf(d->f_write,"3 %Zd ",n->z); 194 fputs("8 ",d->f_write); 195 mpz_out_str (d->f_write,SSI_BASE, n->z); 196 fputc(' ',d->f_write); 197 198 //if (d->f_debug!=NULL) gmp_fprintf(d->f_debug,"number: gmp \"%Zd\" ",n->z); 199 } 200 } 201 else if (getCoeffType(cf)==n_transExt) 151 if (getCoeffType(cf)==n_transExt) 202 152 { 203 153 fraction f=(fraction)n; … … 209 159 ssiWritePoly_R(d,POLY_CMD,(poly)n,cf->extRing); 210 160 } 161 else if (cf->cfWriteFd!=NULL) 162 { 163 cf->cfWriteFd(n,d->f_write,cf); 164 } 211 165 else WerrorS("coeff field not implemented"); 212 166 } … … 214 168 void ssiWriteNumber(const ssiInfo *d, const number n) 215 169 { 216 // syntax is as follows: 217 // case 1 Z/p: 3 <int> 218 // case 2 Q: 3 4 <int> 219 // or 3 0 <mpz_t nominator> <mpz_t denominator> 220 // or 3 1 dto. 221 // or 3 3 <mpz_t nominator> 222 // or 3 5 <mpz_t raw nom.> <mpz_t raw denom.> 223 // or 3 6 <mpz_t raw nom.> <mpz_t raw denom.> 224 // or 3 7 <mpz_t raw nom.> 225 if(rField_is_Zp(d->r)) 226 { 227 fprintf(d->f_write,"%d ",(int)(long)n); 228 //if (d->f_debug!=NULL) fprintf(d->f_debug,"number: \"%ld\" ",(int)(long)n); 229 } 230 else if (rField_is_Q(d->r)) 231 { 232 if(SR_HDL(n) & SR_INT) 233 { 234 #if SIZEOF_LONG == 4 235 fprintf(d->f_write,"4 %ld ",SR_TO_INT(n)); 236 #else 237 long nn=SR_TO_INT(n); 238 if ((nn<POW_2_28)||(nn>= -POW_2_28)) 239 fprintf(d->f_write,"4 %ld ",nn); 240 else 241 { 242 mpz_t tmp; 243 mpz_init_set_si(tmp,nn); 244 fputs("8 ",d->f_write); 245 mpz_out_str (d->f_write,SSI_BASE, tmp); 246 fputc(' ',d->f_write); 247 mpz_clear(tmp); 248 } 249 #endif 250 //if (d->f_debug!=NULL) fprintf(d->f_debug,"number: short \"%ld\" ",SR_TO_INT(n)); 251 } 252 else if (n->s<2) 253 { 254 //gmp_fprintf(d->f_write,"%d %Zd %Zd ",n->s,n->z,n->n); 255 fprintf(d->f_write,"%d ",n->s+5); 256 mpz_out_str (d->f_write,SSI_BASE, n->z); 257 fputc(' ',d->f_write); 258 mpz_out_str (d->f_write,SSI_BASE, n->n); 259 fputc(' ',d->f_write); 260 261 //if (d->f_debug!=NULL) gmp_fprintf(d->f_debug,"number: s=%d gmp/gmp \"%Zd %Zd\" ",n->s,n->z,n->n); 262 } 263 else /*n->s==3*/ 264 { 265 //gmp_fprintf(d->f_write,"3 %Zd ",n->z); 266 fputs("8 ",d->f_write); 267 mpz_out_str (d->f_write,SSI_BASE, n->z); 268 fputc(' ',d->f_write); 269 270 //if (d->f_debug!=NULL) gmp_fprintf(d->f_debug,"number: gmp \"%Zd\" ",n->z); 271 } 272 } 273 else WerrorS("coeff field not implemented"); 170 ssiWriteNumber_CF(d,n,d->r->cf); 274 171 } 275 172 … … 571 468 number ssiReadNumber_CF(ssiInfo *d, const coeffs cf) 572 469 { 573 if (getCoeffType(cf) == n_Q) 574 { 575 return ssiReadQNumber(d); 576 } 577 else if (getCoeffType(cf) == n_Zp) 578 { 579 // read int 580 int dd; 581 dd=s_readint(d->f_read); 582 return (number)(long)dd; 470 if (cf->cfReadFd!=NULL) 471 { 472 return cf->cfReadFd(d->f_read,cf); 583 473 } 584 474 else if (getCoeffType(cf) == n_transExt) … … 602 492 number ssiReadNumber(ssiInfo *d) 603 493 { 604 if (rField_is_Q(d->r)) 605 { 606 return ssiReadQNumber(d); 607 } 608 else if (rField_is_Zp(d->r)) 609 { 610 // read int 611 int dd; 612 dd=s_readint(d->f_read); 613 return (number)(long)dd; 614 } 615 else Werror("coeffs not implemented"); 616 return NULL; 494 return ssiReadNumber_CF(d,d->r->cf); 617 495 } 618 496 -
Singular/misc_ip.cc
rfb036e r850277 18 18 #include <misc/auxiliary.h> 19 19 #include <kernel/mod2.h> 20 #include < Singular/si_signals.h>20 #include <reporter/si_signals.h> 21 21 22 22 #include <factory/factory.h> -
Singular/sdb.cc
rfb036e r850277 19 19 #include <Singular/ipid.h> 20 20 #include <Singular/sdb.h> 21 #include < Singular/si_signals.h>21 #include <reporter/si_signals.h> 22 22 23 23 #ifdef HAVE_SDB -
libpolys/coeffs/coeffs.h
rfb036e r850277 11 11 /* for assume: */ 12 12 #include <reporter/reporter.h> 13 #include <reporter/s_buff.h> 13 14 14 15 #include <coeffs/si_gmp.h> … … 179 180 void (*cfDelete)(number * a, const coeffs r); 180 181 nMapFunc (*cfSetMap)(const coeffs src, const coeffs dst); 182 183 /// io via ssi: 184 void (*cfWriteFd)(number a, FILE *f, const coeffs r); 185 number (*cfReadFd)( s_buff f, const coeffs r); 181 186 182 187 /// For extensions (writes into global string buffer) -
libpolys/coeffs/longrat.cc
rfb036e r850277 2651 2651 return; 2652 2652 } 2653 2653 2654 2654 // all coeffs are given by integers!!! 2655 2655 … … 2667 2667 nlNormalize(n, cf); ++normalcount; 2668 2668 cand1 = n; 2669 2669 2670 2670 if (SR_HDL(cand1)&SR_INT) { cand=cand1; break; } 2671 assume(cand1->s==3); // all coeffs should be integers // ==0?!! after printing 2671 assume(cand1->s==3); // all coeffs should be integers // ==0?!! after printing 2672 2672 s1=mpz_size1(cand1->z); 2673 2673 if (s>s1) … … 2684 2684 2685 2685 numberCollectionEnumerator.Reset(); 2686 2686 2687 2687 while (numberCollectionEnumerator.MoveNext() ) 2688 2688 { … … 2695 2695 2696 2696 assume( nlGreaterZero(cand,cf) ); 2697 2697 2698 2698 if(nlIsOne(cand,cf)) 2699 2699 { … … 2705 2705 c = nlNeg(c, cf); 2706 2706 numberCollectionEnumerator.Reset(); 2707 2707 2708 2708 while (numberCollectionEnumerator.MoveNext() ) 2709 2709 { … … 2714 2714 return; 2715 2715 } 2716 } 2716 } 2717 2717 2718 2718 // part3: all coeffs = all coeffs / cand 2719 2719 if (!lc_is_pos) 2720 2720 cand = nlNeg(cand,cf); 2721 2721 2722 2722 c = cand; 2723 2723 numberCollectionEnumerator.Reset(); … … 2738 2738 2739 2739 numberCollectionEnumerator.Reset(); 2740 2740 2741 2741 if( !numberCollectionEnumerator.MoveNext() ) // empty zero polynomial? 2742 2742 { … … 2757 2757 2758 2758 int s=0; 2759 2759 2760 2760 const BOOLEAN lc_is_pos=nlGreaterZero(numberCollectionEnumerator.Current(),cf); 2761 2761 … … 2783 2783 } 2784 2784 while (numberCollectionEnumerator.MoveNext() ); 2785 2785 2786 2786 2787 2787 if (s==0) // nothing to do, all coeffs are already integers … … 2802 2802 number& n = numberCollectionEnumerator.Current(); 2803 2803 n = nlNeg(n, cf); 2804 } 2804 } 2805 2805 } 2806 2806 // assume( n_GreaterZero(c, cf) ); … … 2813 2813 // make the lead coeff positive 2814 2814 numberCollectionEnumerator.Reset(); 2815 2815 2816 2816 if (!lc_is_pos) 2817 2817 cand = nlNeg(cand, cf); 2818 2818 2819 2819 c = cand; 2820 2820 2821 2821 while (numberCollectionEnumerator.MoveNext() ) 2822 2822 { … … 2830 2830 { 2831 2831 return omStrDup("0"); 2832 } 2833 2834 #define SSI_BASE 16 2835 2836 static void nlWriteFd(number n,FILE* f, const coeffs) 2837 { 2838 if(SR_HDL(n) & SR_INT) 2839 { 2840 #if SIZEOF_LONG == 4 2841 fprintf(f,"4 %ld ",SR_TO_INT(n)); 2842 #else 2843 long nn=SR_TO_INT(n); 2844 if ((nn<POW_2_28)||(nn>= -POW_2_28)) 2845 fprintf(f,"4 %ld ",nn); 2846 else 2847 { 2848 mpz_t tmp; 2849 mpz_init_set_si(tmp,nn); 2850 fputs("8 ",f); 2851 mpz_out_str (f,SSI_BASE, tmp); 2852 fputc(' ',f); 2853 mpz_clear(tmp); 2854 } 2855 #endif 2856 } 2857 else if (n->s<2) 2858 { 2859 //gmp_fprintf(f,"%d %Zd %Zd ",n->s,n->z,n->n); 2860 fprintf(f,"%d ",n->s+5); 2861 mpz_out_str (f,SSI_BASE, n->z); 2862 fputc(' ',f); 2863 mpz_out_str (f,SSI_BASE, n->n); 2864 fputc(' ',f); 2865 2866 //if (d->f_debug!=NULL) gmp_fprintf(d->f_debug,"number: s=%d gmp/gmp \"%Zd %Zd\" ",n->s,n->z,n->n); 2867 } 2868 else /*n->s==3*/ 2869 { 2870 //gmp_fprintf(d->f_write,"3 %Zd ",n->z); 2871 fputs("8 ",f); 2872 mpz_out_str (f,SSI_BASE, n->z); 2873 fputc(' ',f); 2874 2875 //if (d->f_debug!=NULL) gmp_fprintf(d->f_debug,"number: gmp \"%Zd\" ",n->z); 2876 } 2877 } 2878 2879 static number nlReadFd(s_buff f, const coeffs) 2880 { 2881 int sub_type=-1; 2882 sub_type=s_readint(f); 2883 switch(sub_type) 2884 { 2885 case 0: 2886 case 1: 2887 {// read mpz_t, mpz_t 2888 number n=nlRInit(0); 2889 mpz_init(n->n); 2890 s_readmpz(f,n->z); 2891 s_readmpz(f,n->n); 2892 n->s=sub_type; 2893 return n; 2894 } 2895 2896 case 3: 2897 {// read mpz_t 2898 number n=nlRInit(0); 2899 s_readmpz(f,n->z); 2900 n->s=3; /*sub_type*/ 2901 return n; 2902 } 2903 case 4: 2904 { 2905 LONG dd=s_readlong(f); 2906 //#if SIZEOF_LONG == 8 2907 return INT_TO_SR(dd); 2908 //#else 2909 //return nlInit(dd,NULL); 2910 //#endif 2911 } 2912 case 5: 2913 case 6: 2914 {// read raw mpz_t, mpz_t 2915 number n=nlRInit(0); 2916 mpz_init(n->n); 2917 s_readmpz_base (f,n->z, SSI_BASE); 2918 s_readmpz_base (f,n->n, SSI_BASE); 2919 n->s=sub_type-5; 2920 return n; 2921 } 2922 case 8: 2923 {// read raw mpz_t 2924 number n=nlRInit(0); 2925 s_readmpz_base (f,n->z, SSI_BASE); 2926 n->s=sub_type=3; /*subtype-5*/ 2927 return n; 2928 } 2929 2930 default: Werror("error in reading number: invalid subtype %d",sub_type); 2931 return NULL; 2932 } 2933 return NULL; 2832 2934 } 2833 2935 … … 2901 3003 r->convFactoryNSingN=nlConvFactoryNSingN; 2902 3004 3005 // io via ssi 3006 r->cfWriteFd=nlWriteFd; 3007 r->cfReadFd=nlReadFd; 3008 2903 3009 // the variables: general stuff (required) 2904 3010 r->nNULL = INT_TO_SR(0); -
libpolys/coeffs/modulop.cc
rfb036e r850277 430 430 snprintf(s,11,"%d",r->ch); 431 431 return s; 432 } 433 434 static void npWriteFd(number n, FILE* f, const coeffs r) 435 { 436 fprintf(f,"%d ",(int)(long)n); 437 } 438 439 static number npReadFd(s_buff f, const coeffs r) 440 { 441 // read int 442 int dd; 443 dd=s_readint(f); 444 return (number)(long)dd; 432 445 } 433 446 … … 509 522 r->convFactoryNSingN=npConvFactoryNSingN; 510 523 524 // io via ssi 525 r->cfWriteFd=npWriteFd; 526 r->cfReadFd=npReadFd; 527 511 528 // the variables: 512 529 r->nNULL = (number)0; -
libpolys/reporter/Makefile.am
rfb036e r850277 6 6 #### libreporterdir = $(libdir)/singular 7 7 8 libreporter_la_SOURCES = dError.cc reporter.cc 8 libreporter_la_SOURCES = dError.cc reporter.cc s_buff.cc 9 9 ## libreporter_la_LDFLAGS = -release ${PACKAGE_VERSION} 10 10 ## libreporter_la_LIBADD = ${top_builddir}/misc/libmisc.la 11 11 12 12 libreporter_la_includedir =$(includedir)/singular/reporter 13 libreporter_la_include_HEADERS = reporter.h 13 libreporter_la_include_HEADERS = reporter.h s_buff.h si_signals.h 14 14 15 15 -
libpolys/reporter/s_buff.cc
rfb036e r850277 8 8 9 9 #include <kernel/mod2.h> 10 #include < coeffs/si_gmp.h>10 #include <gmp.h> 11 11 12 12 #include <omalloc/omalloc.h> 13 #include < Singular/links/s_buff.h>14 #include < Singular/si_signals.h>13 #include <reporter/s_buff.h> 14 #include <reporter/si_signals.h> 15 15 16 16 //struct s_buff_s -
libpolys/reporter/s_buff.h
rfb036e r850277 3 3 4 4 #include<signal.h> 5 #include<gmp.h> 5 6 6 7 struct s_buff_s
Note: See TracChangeset
for help on using the changeset viewer.