- Timestamp:
- Mar 20, 2014, 3:27:31 PM (10 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- 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
- Location:
- libpolys
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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.