Changeset f5bef2 in git
- Timestamp:
- Aug 12, 2011, 9:11:26 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- 736288b17e091e09b40a78ee266cf94e73f9005f
- Parents:
- e7e815050f6c74d4fc691c162a9a76687b36c5c3
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-12 21:11:26+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:12:18+01:00
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
re7e815 rf5bef2 56 56 #include <polys/ext_fields/algext.h> 57 57 #include <coeffs/mpr_complex.h> 58 //////#include <coeffs/longrat.h>58 #include <coeffs/longrat.h> 59 59 #include <numeric/mpr_base.h> 60 60 #include <numeric/mpr_numeric.h> … … 706 706 } 707 707 tmpW.data=IDDATA(w); 708 708 #if 0 709 709 if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w))) 710 710 { … … 713 713 } 714 714 else 715 716 { 717 718 if ((tmpW.rtyp==IDEAL_CMD) && (nMap ==nCopy)719 715 #endif 716 { 717 #ifdef FAST_MAP 718 if ((tmpW.rtyp==IDEAL_CMD) && (nMap == ndCopyMap) 719 #ifdef HAVE_PLURAL 720 720 && (!rIsPluralRing(currRing)) 721 721 #endif 722 722 ) 723 723 { … … 726 726 } 727 727 else 728 728 #endif 729 729 if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,IDRING(r),NULL,NULL,0,nMap)) 730 730 { … … 1652 1652 // 3: qideal 1653 1653 L->m[3].rtyp=IDEAL_CMD; 1654 if ( R->minpoly==NULL)1654 if (rMinpolyIsNULL(R)) 1655 1655 L->m[3].data=(void *)idInit(1,1); 1656 1656 else 1657 1657 { 1658 ideal I=idInit(1,1); 1659 L->m[3].data=(void *)I; 1660 I->m[0]=pNSet(R->minpoly); 1658 const ring RR = R->cf->extRing; 1659 1660 L->m[3].data=(void *) idCopy(RR->minideal, RR); 1661 // I->m[0] = pNSet(R->minpoly); 1661 1662 } 1662 1663 // ---------------------------------------- … … 1730 1731 { 1731 1732 // sanity check: require currRing==r for rings with polynomial data 1732 if ((r!=currRing) 1733 && ((r->minpoly!=NULL) || (r->qideal!=NULL) || (r->minideal!=NULL) 1733 if ( (r!=currRing) && (!rMinpolyIsNULL(r) 1734 1734 #ifdef HAVE_PLURAL 1735 1735 || (rIsPluralRing(r)) … … 2124 2124 if (LL->m[0].Typ()==INT_CMD) 2125 2125 { 2126 ch = (int)(long)LL->m[0].Data();2126 int ch = (int)(long)LL->m[0].Data(); 2127 2127 2128 2128 if( ch != 0 ) // TODO: GF-Test ch! … … 2158 2158 extRing->qideal = NULL; // ??? 2159 2159 2160 R->cf = nInitChar( type, (void*)&extParam);2160 R->cf = nInitChar(n_algExt, (void*)&extParam); 2161 2161 } else // Transcendental extension 2162 2162 { 2163 2163 TransExtInfo extParam; 2164 extParam.r = r;2164 extParam.r = extRing; 2165 2165 2166 2166 R->cf = nInitChar(n_transExt, &extParam); … … 2388 2388 2389 2389 // currently, coefficients which are ring elements require a global ordering: 2390 if (rField_is_Ring(R) && (R-> pOrdSgn==-1))2390 if (rField_is_Ring(R) && (R->OrdSgn==-1)) 2391 2391 { 2392 2392 WerrorS("global ordering required for these coefficients"); … … 2435 2435 par_perm_size=rPar(orig_ring); 2436 2436 BITSET save_test=test; 2437 if ((orig_ring->minpoly != NULL) || (orig_ring->minideal != NULL)) 2438 naSetChar(rInternalChar(orig_ring),orig_ring); 2439 else naSetChar(rInternalChar(orig_ring),orig_ring); 2437 2438 // if ((orig_ring->minpoly != NULL) || (orig_ring->minideal != NULL)) 2439 // naSetChar(rInternalChar(orig_ring),orig_ring); 2440 // else ntSetChar(rInternalChar(orig_ring),orig_ring); 2441 2440 2442 nSetChar(currRing->cf); 2441 2443 test=save_test; … … 3030 3032 }; 3031 3033 3034 // from splist.cc 3035 // ---------------------------------------------------------------------------- 3036 // Compute the spectrum of a spectrumPolyList 3037 // ---------------------------------------------------------------------------- 3038 3039 /* former spectrumPolyList::spectrum ( lists*, int) */ 3040 spectrumState spectrumStateFromList( spectrumPolyList& speclist, lists *L,int fast ) 3041 { 3042 spectrumPolyNode **node = &speclist.root; 3043 spectrumPolyNode *search; 3044 3045 poly f,tmp; 3046 int found,cmp; 3047 3048 Rational smax( ( fast==0 ? 0 : rVar(currRing) ), 3049 ( fast==2 ? 2 : 1 ) ); 3050 3051 Rational weight_prev( 0,1 ); 3052 3053 int mu = 0; // the milnor number 3054 int pg = 0; // the geometrical genus 3055 int n = 0; // number of different spectral numbers 3056 int z = 0; // number of spectral number equal to smax 3057 3058 int k = 0; 3059 3060 while( (*node)!=(spectrumPolyNode*)NULL && 3061 ( fast==0 || (*node)->weight<=smax ) ) 3062 { 3063 // --------------------------------------- 3064 // determine the first normal form which 3065 // contains the monomial node->mon 3066 // --------------------------------------- 3067 3068 found = FALSE; 3069 search = *node; 3070 3071 while( search!=(spectrumPolyNode*)NULL && found==FALSE ) 3072 { 3073 if( search->nf!=(poly)NULL ) 3074 { 3075 f = search->nf; 3076 3077 do 3078 { 3079 // -------------------------------- 3080 // look for (*node)->mon in f 3081 // -------------------------------- 3082 3083 cmp = pCmp( (*node)->mon,f ); 3084 3085 if( cmp<0 ) 3086 { 3087 f = pNext( f ); 3088 } 3089 else if( cmp==0 ) 3090 { 3091 // ----------------------------- 3092 // we have found a normal form 3093 // ----------------------------- 3094 3095 found = TRUE; 3096 3097 // normalize coefficient 3098 3099 number inv = nInvers( pGetCoeff( f ) ); 3100 pMult_nn( search->nf,inv ); 3101 nDelete( &inv ); 3102 3103 // exchange normal forms 3104 3105 tmp = (*node)->nf; 3106 (*node)->nf = search->nf; 3107 search->nf = tmp; 3108 } 3109 } 3110 while( cmp<0 && f!=(poly)NULL ); 3111 } 3112 search = search->next; 3113 } 3114 3115 if( found==FALSE ) 3116 { 3117 // ------------------------------------------------ 3118 // the weight of node->mon is a spectrum number 3119 // ------------------------------------------------ 3120 3121 mu++; 3122 3123 if( (*node)->weight<=(Rational)1 ) pg++; 3124 if( (*node)->weight==smax ) z++; 3125 if( (*node)->weight>weight_prev ) n++; 3126 3127 weight_prev = (*node)->weight; 3128 node = &((*node)->next); 3129 } 3130 else 3131 { 3132 // ----------------------------------------------- 3133 // determine all other normal form which contain 3134 // the monomial node->mon 3135 // replace for node->mon its normal form 3136 // ----------------------------------------------- 3137 3138 while( search!=(spectrumPolyNode*)NULL ) 3139 { 3140 if( search->nf!=(poly)NULL ) 3141 { 3142 f = search->nf; 3143 3144 do 3145 { 3146 // -------------------------------- 3147 // look for (*node)->mon in f 3148 // -------------------------------- 3149 3150 cmp = pCmp( (*node)->mon,f ); 3151 3152 if( cmp<0 ) 3153 { 3154 f = pNext( f ); 3155 } 3156 else if( cmp==0 ) 3157 { 3158 search->nf = pSub( search->nf, 3159 ppMult_nn( (*node)->nf,pGetCoeff( f ) ) ); 3160 pNorm( search->nf ); 3161 } 3162 } 3163 while( cmp<0 && f!=(poly)NULL ); 3164 } 3165 search = search->next; 3166 } 3167 speclist.delete_node( node ); 3168 } 3169 3170 } 3171 3172 // -------------------------------------------------------- 3173 // fast computation exploits the symmetry of the spectrum 3174 // -------------------------------------------------------- 3175 3176 if( fast==2 ) 3177 { 3178 mu = 2*mu - z; 3179 n = ( z > 0 ? 2*n - 1 : 2*n ); 3180 } 3181 3182 // -------------------------------------------------------- 3183 // compute the spectrum numbers with their multiplicities 3184 // -------------------------------------------------------- 3185 3186 intvec *nom = new intvec( n ); 3187 intvec *den = new intvec( n ); 3188 intvec *mult = new intvec( n ); 3189 3190 int count = 0; 3191 int multiplicity = 1; 3192 3193 for( search=speclist.root; search!=(spectrumPolyNode*)NULL && 3194 ( fast==0 || search->weight<=smax ); 3195 search=search->next ) 3196 { 3197 if( search->next==(spectrumPolyNode*)NULL || 3198 search->weight<search->next->weight ) 3199 { 3200 (*nom) [count] = search->weight.get_num_si( ); 3201 (*den) [count] = search->weight.get_den_si( ); 3202 (*mult)[count] = multiplicity; 3203 3204 multiplicity=1; 3205 count++; 3206 } 3207 else 3208 { 3209 multiplicity++; 3210 } 3211 } 3212 3213 // -------------------------------------------------------- 3214 // fast computation exploits the symmetry of the spectrum 3215 // -------------------------------------------------------- 3216 3217 if( fast==2 ) 3218 { 3219 int n1,n2; 3220 for( n1=0, n2=n-1; n1<n2; n1++, n2-- ) 3221 { 3222 (*nom) [n2] = rVar(currRing)*(*den)[n1]-(*nom)[n1]; 3223 (*den) [n2] = (*den)[n1]; 3224 (*mult)[n2] = (*mult)[n1]; 3225 } 3226 } 3227 3228 // ----------------------------------- 3229 // test if the spectrum is symmetric 3230 // ----------------------------------- 3231 3232 if( fast==0 || fast==1 ) 3233 { 3234 int symmetric=TRUE; 3235 3236 for( int n1=0, n2=n-1 ; n1<n2 && symmetric==TRUE; n1++, n2-- ) 3237 { 3238 if( (*mult)[n1]!=(*mult)[n2] || 3239 (*den) [n1]!= (*den)[n2] || 3240 (*nom)[n1]+(*nom)[n2]!=rVar(currRing)*(*den) [n1] ) 3241 { 3242 symmetric = FALSE; 3243 } 3244 } 3245 3246 if( symmetric==FALSE ) 3247 { 3248 // --------------------------------------------- 3249 // the spectrum is not symmetric => degenerate 3250 // principal part 3251 // --------------------------------------------- 3252 3253 *L = (lists)omAllocBin( slists_bin); 3254 (*L)->Init( 1 ); 3255 (*L)->m[0].rtyp = INT_CMD; // milnor number 3256 (*L)->m[0].data = (void*)mu; 3257 3258 return spectrumDegenerate; 3259 } 3260 } 3261 3262 *L = (lists)omAllocBin( slists_bin); 3263 3264 (*L)->Init( 6 ); 3265 3266 (*L)->m[0].rtyp = INT_CMD; // milnor number 3267 (*L)->m[1].rtyp = INT_CMD; // geometrical genus 3268 (*L)->m[2].rtyp = INT_CMD; // number of spectrum values 3269 (*L)->m[3].rtyp = INTVEC_CMD; // nominators 3270 (*L)->m[4].rtyp = INTVEC_CMD; // denomiantors 3271 (*L)->m[5].rtyp = INTVEC_CMD; // multiplicities 3272 3273 (*L)->m[0].data = (void*)mu; 3274 (*L)->m[1].data = (void*)pg; 3275 (*L)->m[2].data = (void*)n; 3276 (*L)->m[3].data = (void*)nom; 3277 (*L)->m[4].data = (void*)den; 3278 (*L)->m[5].data = (void*)mult; 3279 3280 return spectrumOK; 3281 } 3282 3032 3283 spectrumState spectrumCompute( poly h,lists *L,int fast ) 3033 3284 { … … 3310 3561 // compute the spectrum of h 3311 3562 // ---------------------------- 3312 3313 return NF.spectrum( L,fast ); 3563 // spectrumState spectrumStateFromList( spectrumPolyList& speclist, lists *L, int fast ); 3564 3565 return spectrumStateFromList(NF, L, fast ); 3314 3566 } 3315 3567 … … 3778 4030 3779 4031 return semicProc3(res,u,v,&tmp); 3780 }3781 // from splist.cc3782 // ----------------------------------------------------------------------------3783 // Compute the spectrum of a spectrumPolyList3784 // ----------------------------------------------------------------------------3785 3786 /* former spectrumPolyList::spectrum ( lists*, int) */3787 spectrumState spectrumStateFromList( spectrumPolyList& speclist, lists *L,int fast )3788 {3789 spectrumPolyNode **node = &speclist.root;3790 spectrumPolyNode *search;3791 3792 poly f,tmp;3793 int found,cmp;3794 3795 Rational smax( ( fast==0 ? 0 : rVar(currRing) ),3796 ( fast==2 ? 2 : 1 ) );3797 3798 Rational weight_prev( 0,1 );3799 3800 int mu = 0; // the milnor number3801 int pg = 0; // the geometrical genus3802 int n = 0; // number of different spectral numbers3803 int z = 0; // number of spectral number equal to smax3804 3805 int k = 0;3806 3807 while( (*node)!=(spectrumPolyNode*)NULL &&3808 ( fast==0 || (*node)->weight<=smax ) )3809 {3810 // ---------------------------------------3811 // determine the first normal form which3812 // contains the monomial node->mon3813 // ---------------------------------------3814 3815 found = FALSE;3816 search = *node;3817 3818 while( search!=(spectrumPolyNode*)NULL && found==FALSE )3819 {3820 if( search->nf!=(poly)NULL )3821 {3822 f = search->nf;3823 3824 do3825 {3826 // --------------------------------3827 // look for (*node)->mon in f3828 // --------------------------------3829 3830 cmp = pCmp( (*node)->mon,f );3831 3832 if( cmp<0 )3833 {3834 f = pNext( f );3835 }3836 else if( cmp==0 )3837 {3838 // -----------------------------3839 // we have found a normal form3840 // -----------------------------3841 3842 found = TRUE;3843 3844 // normalize coefficient3845 3846 number inv = nInvers( pGetCoeff( f ) );3847 pMult_nn( search->nf,inv );3848 nDelete( &inv );3849 3850 // exchange normal forms3851 3852 tmp = (*node)->nf;3853 (*node)->nf = search->nf;3854 search->nf = tmp;3855 }3856 }3857 while( cmp<0 && f!=(poly)NULL );3858 }3859 search = search->next;3860 }3861 3862 if( found==FALSE )3863 {3864 // ------------------------------------------------3865 // the weight of node->mon is a spectrum number3866 // ------------------------------------------------3867 3868 mu++;3869 3870 if( (*node)->weight<=(Rational)1 ) pg++;3871 if( (*node)->weight==smax ) z++;3872 if( (*node)->weight>weight_prev ) n++;3873 3874 weight_prev = (*node)->weight;3875 node = &((*node)->next);3876 }3877 else3878 {3879 // -----------------------------------------------3880 // determine all other normal form which contain3881 // the monomial node->mon3882 // replace for node->mon its normal form3883 // -----------------------------------------------3884 3885 while( search!=(spectrumPolyNode*)NULL )3886 {3887 if( search->nf!=(poly)NULL )3888 {3889 f = search->nf;3890 3891 do3892 {3893 // --------------------------------3894 // look for (*node)->mon in f3895 // --------------------------------3896 3897 cmp = pCmp( (*node)->mon,f );3898 3899 if( cmp<0 )3900 {3901 f = pNext( f );3902 }3903 else if( cmp==0 )3904 {3905 search->nf = pSub( search->nf,3906 ppMult_nn( (*node)->nf,pGetCoeff( f ) ) );3907 pNorm( search->nf );3908 }3909 }3910 while( cmp<0 && f!=(poly)NULL );3911 }3912 search = search->next;3913 }3914 speclist.delete_node( node );3915 }3916 3917 }3918 3919 // --------------------------------------------------------3920 // fast computation exploits the symmetry of the spectrum3921 // --------------------------------------------------------3922 3923 if( fast==2 )3924 {3925 mu = 2*mu - z;3926 n = ( z > 0 ? 2*n - 1 : 2*n );3927 }3928 3929 // --------------------------------------------------------3930 // compute the spectrum numbers with their multiplicities3931 // --------------------------------------------------------3932 3933 intvec *nom = new intvec( n );3934 intvec *den = new intvec( n );3935 intvec *mult = new intvec( n );3936 3937 int count = 0;3938 int multiplicity = 1;3939 3940 for( search=speclist.root; search!=(spectrumPolyNode*)NULL &&3941 ( fast==0 || search->weight<=smax );3942 search=search->next )3943 {3944 if( search->next==(spectrumPolyNode*)NULL ||3945 search->weight<search->next->weight )3946 {3947 (*nom) [count] = search->weight.get_num_si( );3948 (*den) [count] = search->weight.get_den_si( );3949 (*mult)[count] = multiplicity;3950 3951 multiplicity=1;3952 count++;3953 }3954 else3955 {3956 multiplicity++;3957 }3958 }3959 3960 // --------------------------------------------------------3961 // fast computation exploits the symmetry of the spectrum3962 // --------------------------------------------------------3963 3964 if( fast==2 )3965 {3966 int n1,n2;3967 for( n1=0, n2=n-1; n1<n2; n1++, n2-- )3968 {3969 (*nom) [n2] = rVar(currRing)*(*den)[n1]-(*nom)[n1];3970 (*den) [n2] = (*den)[n1];3971 (*mult)[n2] = (*mult)[n1];3972 }3973 }3974 3975 // -----------------------------------3976 // test if the spectrum is symmetric3977 // -----------------------------------3978 3979 if( fast==0 || fast==1 )3980 {3981 int symmetric=TRUE;3982 3983 for( int n1=0, n2=n-1 ; n1<n2 && symmetric==TRUE; n1++, n2-- )3984 {3985 if( (*mult)[n1]!=(*mult)[n2] ||3986 (*den) [n1]!= (*den)[n2] ||3987 (*nom)[n1]+(*nom)[n2]!=rVar(currRing)*(*den) [n1] )3988 {3989 symmetric = FALSE;3990 }3991 }3992 3993 if( symmetric==FALSE )3994 {3995 // ---------------------------------------------3996 // the spectrum is not symmetric => degenerate3997 // principal part3998 // ---------------------------------------------3999 4000 *L = (lists)omAllocBin( slists_bin);4001 (*L)->Init( 1 );4002 (*L)->m[0].rtyp = INT_CMD; // milnor number4003 (*L)->m[0].data = (void*)mu;4004 4005 return spectrumDegenerate;4006 }4007 }4008 4009 *L = (lists)omAllocBin( slists_bin);4010 4011 (*L)->Init( 6 );4012 4013 (*L)->m[0].rtyp = INT_CMD; // milnor number4014 (*L)->m[1].rtyp = INT_CMD; // geometrical genus4015 (*L)->m[2].rtyp = INT_CMD; // number of spectrum values4016 (*L)->m[3].rtyp = INTVEC_CMD; // nominators4017 (*L)->m[4].rtyp = INTVEC_CMD; // denomiantors4018 (*L)->m[5].rtyp = INTVEC_CMD; // multiplicities4019 4020 (*L)->m[0].data = (void*)mu;4021 (*L)->m[1].data = (void*)pg;4022 (*L)->m[2].data = (void*)n;4023 (*L)->m[3].data = (void*)nom;4024 (*L)->m[4].data = (void*)den;4025 (*L)->m[5].data = (void*)mult;4026 4027 return spectrumOK;4028 4032 } 4029 4033 … … 5146 5150 #ifdef HABE_RINGS 5147 5151 // currently, coefficients which are ring elements require a global ordering: 5148 if (rField_is_Ring(R) && (R-> pOrdSgn==-1))5152 if (rField_is_Ring(R) && (R->OrdSgn==-1)) 5149 5153 { 5150 5154 WerrorS("global ordering required for these coefficients"); -
Singular/makefile
re7e815 rf5bef2 117 117 pcv.cc\ 118 118 pipeLink.cc\ 119 pyobject.cc\120 pyobject_setup.cc\121 119 scanner.cc\ 122 120 sdb.cc\ … … 133 131 walk_ip.cc\ 134 132 wrapper.cc 133 134 # pyobject.cc pyobject_setup.cc 135 135 136 136 CXXSOURCES2 = SingularBuilder.cpp … … 221 221 all: Singular 222 222 223 Singular: ${OBJS} 223 Singular: ${OBJS} 224 $(CXX) ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${OBJS} -o $@ -L. -L../kernel -lkernel ${LIBPOLYS_LIBS} -lntl -ldl -lgmp 225 224 226 225 227 ## … … 303 305 $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@ 304 306 305 libkernel_g.a: ${OBJG} ${OBJSG2}306 -rm -f libkernel_g.a307 ar cr $@ ${OBJG}308 309 310 307 311 308 ## … … 344 341 $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@ 345 342 346 libkernel_p.a: ${OBJP} ${OBJSP2}347 -rm -f libkernel_p.a348 ar cr $@ ${OBJP}349 350 343 ## 351 344 ## dependencies … … 370 363 # My headers test 371 364 # test: test.o 372 373 test.o: test.cc feOpt.inc374 $(CXXG) ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} -c $< -o $@375 365 376 366 feOpt.inc: feOpt.cc
Note: See TracChangeset
for help on using the changeset viewer.