Changeset 7e29aa in git
- Timestamp:
- Feb 23, 2018, 5:33:43 PM (6 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 0277c5dd6af4f887925e06b299068d0c17f5d324f604741c372d3b9a9e1e1d8f7ab9e71e18f5ae74
- Parents:
- 6198629402663b11697d755d8512ff5ca032226c6cfe0d505bc5446671956e0849011c8be946d571
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2018-02-23 17:33:43+01:00
- git-committer:
- GitHub <noreply@github.com>2018-02-23 17:33:43+01:00
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/fpadim.lib
r619862 r7e29aa 2385 2385 ivMaxIdeal(2,0); 2386 2386 ivMaxIdeal(2,1); 2387 ivMaxIdeal(4,0);2388 ivMaxIdeal(4,1);2389 2387 } 2390 2388 … … 2399 2397 " 2400 2398 { 2401 ivL2lpI(ivMaxIdeal(d, donly));2399 return(ivL2lpI(ivMaxIdeal(d, donly))); 2402 2400 } 2403 2401 example { … … 2408 2406 lpMaxIdeal(2,0); 2409 2407 lpMaxIdeal(2,1); 2410 lpMaxIdeal(4,0);2411 lpMaxIdeal(4,1);2412 2408 } 2413 2409 -
Singular/links/asciiLink.cc
r6cfe0d r7e29aa 426 426 { 427 427 #define MAX_LIBS 256 428 (*list_of_libs)=(char**)om alloc0(MAX_LIBS*sizeof(char**));428 (*list_of_libs)=(char**)omAlloc0(MAX_LIBS*sizeof(char**)); 429 429 (*list_of_libs)[0]=name; 430 430 (*list_of_libs)[MAX_LIBS-1]=(char*)1; -
Singular/misc_ip.cc
r6cfe0d r7e29aa 74 74 75 75 #ifdef HAVE_NTL 76 #include <NTL/version.h>77 #include <NTL/tools.h>76 #include <NTL/version.h> 77 #include <NTL/tools.h> 78 78 #ifdef NTL_CLIENT 79 79 NTL_CLIENT -
Singular/tesths.cc
r6cfe0d r7e29aa 36 36 37 37 #include <unistd.h> 38 #ifdef HAVE_NTL 39 #include <NTL/config.h> 40 #endif 38 41 39 42 … … 67 70 siInit(argv[0]); 68 71 init_signals(); 72 #ifdef HAVE_NTL 73 #if NTL_MAJOR_VERSION>=10 74 #ifdef NTL_THREAD_BOOST 75 SetNumThreads(feOptValue(FE_OPT_CPUS)); 76 #endif 77 #endif 78 #endif 69 79 70 80 // parse command line options -
factory/cf_factory.h
r6cfe0d r7e29aa 16 16 17 17 #include "factory/cf_gmp.h" 18 #include " factory/cf_assert.h"18 #include "cf_assert.h" 19 19 20 20 class InternalCF; -
kernel/GBEngine/janet.cc
r6cfe0d r7e29aa 237 237 { 238 238 pLmFree(&f->history); 239 f->history=p_Copy_noCheck(p->history,currRing); /* cf of p->history is NULL */ 239 if (p->history!=NULL) 240 f->history=p_Copy_noCheck(p->history,currRing); /* cf of p->history is NULL */ 240 241 } 241 242 } -
kernel/GBEngine/kInline.h
r6cfe0d r7e29aa 207 207 if (p != NULL) /* and t_p!=NULL*/ 208 208 { 209 p = p_Head(p, currRing); 210 n_Delete(&pGetCoeff(p),currRing->cf); 209 p = p_LmInit(p, currRing); 211 210 pGetCoeff(p)=pGetCoeff(t_p); 212 211 pNext(p) = pNext(t_p); -
kernel/GBEngine/kstdfac.cc
r6cfe0d r7e29aa 79 79 else 80 80 { 81 l[j].p=p_Lm Head(o->L[j].p,currRing);81 l[j].p=p_LmInit(o->L[j].p,currRing); 82 82 if (pGetCoeff(o->L[j].p)!=NULL) pSetCoeff0(l[j].p,nCopy(pGetCoeff(o->L[j].p))); 83 83 pNext(l[j].p)=n->tail; -
kernel/GBEngine/tgb.cc
r6cfe0d r7e29aa 793 793 p[a[i] + i] = q[i]; 794 794 } 795 om free (a);795 omFree (a); 796 796 return p; 797 797 } … … 900 900 } 901 901 } 902 om free (i_con);902 omFree (i_con); 903 903 904 904 return FALSE; … … 1157 1157 connected[connected_length] = -1; 1158 1158 } 1159 om free (cans);1159 omFree (cans); 1160 1160 return connected; 1161 1161 } … … 1198 1198 connected[connected_length] = -1; 1199 1199 } 1200 om free (cans);1200 omFree (cans); 1201 1201 return connected; 1202 1202 } … … 1285 1285 1286 1286 //can also try dependend search 1287 om free (i_con);1288 om free (j_con);1287 omFree (i_con); 1288 omFree (j_con); 1289 1289 return; 1290 1290 } … … 1754 1754 1755 1755 assume (spc_final <= spc); 1756 om free (nodes);1756 omFree (nodes); 1757 1757 nodes = NULL; 1758 1758 … … 1826 1826 c->pair_top += spc_final; 1827 1827 clean_top_of_pair_list (c); 1828 om free (nodes_final);1828 omFree (nodes_final); 1829 1829 return NULL; 1830 1830 } … … 2174 2174 c->pair_top += sum; 2175 2175 clean_top_of_pair_list (c); 2176 om free (big_sbuf);2177 om free (sbuf);2178 om free (ibuf);2176 omFree (big_sbuf); 2177 omFree (sbuf); 2178 omFree (ibuf); 2179 2179 //omfree(buf); 2180 2180 #ifdef TGB_DEBUG … … 2664 2664 int rank = reduced_c; 2665 2665 linalg_step_modp (reduced, p, rank, terms, nterms, c); 2666 om free (terms);2666 omFree (terms); 2667 2667 2668 2668 pn = rank; 2669 om free (reduced);2669 omFree (reduced); 2670 2670 2671 2671 if(TEST_OPT_PROT) … … 2700 2700 max_pairs = bundle_size_noro; 2701 2701 #endif 2702 poly *p = (poly *) om alloc ((max_pairs + 1) * sizeof (poly)); //nullterminated2702 poly *p = (poly *) omAlloc ((max_pairs + 1) * sizeof (poly)); //nullterminated 2703 2703 2704 2704 int curr_deg = -1; … … 2775 2775 if(i == 0) 2776 2776 { 2777 om free (p);2777 omFree (p); 2778 2778 return; 2779 2779 } … … 2793 2793 if(pn == 0) 2794 2794 { 2795 om free (p);2795 omFree (p); 2796 2796 return; 2797 2797 } … … 2819 2819 //} 2820 2820 mass_add (p, pn, c); 2821 om free (p);2821 omFree (p); 2822 2822 return; 2823 2823 /*if (TEST_OPT_PROT) … … 2828 2828 } 2829 2829 #endif 2830 red_object *buf = (red_object *) om alloc (i * sizeof (red_object));2830 red_object *buf = (red_object *) omAlloc (i * sizeof (red_object)); /*i>0*/ 2831 2831 for(j = 0; j < i; j++) 2832 2832 { … … 2841 2841 assume (buf[j].initial_quality >= 0); 2842 2842 } 2843 om free (p);2843 omFree (p); 2844 2844 qsort (buf, i, sizeof (red_object), red_object_better_gen); 2845 2845 // Print("\ncurr_deg:%i\n",curr_deg); … … 2919 2919 } 2920 2920 mass_add (add_those, i, c); 2921 om free (add_those);2922 om free (buf);2921 omFree (add_those); 2922 omFree (buf); 2923 2923 2924 2924 if(TEST_OPT_PROT) … … 3107 3107 return; 3108 3108 sorted_pair_node **si_array = 3109 (sorted_pair_node **) om alloc (s * sizeof (sorted_pair_node *));3109 (sorted_pair_node **) omAlloc (s * sizeof (sorted_pair_node *)); 3110 3110 3111 3111 for(int i = 0; i < s; i++) 3112 3112 { 3113 3113 sorted_pair_node *si = 3114 (sorted_pair_node *) om alloc (sizeof (sorted_pair_node));3114 (sorted_pair_node *) omAlloc (sizeof (sorted_pair_node)); 3115 3115 si->i = -1; 3116 3116 si->j = -2; … … 3135 3135 apairs = spn_merge (apairs, pair_top + 1, si_array, s, this); 3136 3136 pair_top += s; 3137 om free (si_array);3137 omFree (si_array); 3138 3138 } 3139 3139 … … 3203 3203 3204 3204 apairs = 3205 (sorted_pair_node **) om alloc (sizeof (sorted_pair_node *) * max_pairs);3205 (sorted_pair_node **) omAlloc (sizeof (sorted_pair_node *) * max_pairs); 3206 3206 pair_top = -1; 3207 3207 … … 3212 3212 i = 0; 3213 3213 this->n = 0; 3214 T_deg = (int *) om alloc (n * sizeof (int));3214 T_deg = (int *) omAlloc (n * sizeof (int)); 3215 3215 if(eliminationProblem) 3216 T_deg_full = (int *) om alloc (n * sizeof (int));3216 T_deg_full = (int *) omAlloc (n * sizeof (int)); 3217 3217 else 3218 3218 T_deg_full = NULL; 3219 tmp_pair_lm = (poly *) om alloc (n * sizeof (poly));3220 tmp_spn = (sorted_pair_node **) om alloc (n * sizeof (sorted_pair_node *));3219 tmp_pair_lm = (poly *) omAlloc (n * sizeof (poly)); 3220 tmp_spn = (sorted_pair_node **) omAlloc (n * sizeof (sorted_pair_node *)); 3221 3221 lm_bin = omGetSpecBin (POLYSIZE + (r->ExpL_Size) * sizeof (long)); 3222 3222 #ifdef HEAD_BIN … … 3227 3227 #ifdef USE_STDVECBOOL 3228 3228 #else 3229 h = om alloc (n * sizeof (char *));3229 h = omAlloc (n * sizeof (char *)); 3230 3230 3231 3231 states = (char **) h; 3232 3232 #endif 3233 3233 #endif 3234 h = om alloc (n * sizeof (int));3234 h = omAlloc (n * sizeof (int)); 3235 3235 lengths = (int *) h; 3236 3236 weighted_lengths = (wlen_type *) omAllocAligned (n * sizeof (wlen_type)); 3237 3237 gcd_of_terms = (poly *) omAlloc (n * sizeof (poly)); 3238 3238 3239 short_Exps = (long *) om alloc (n * sizeof (long));3239 short_Exps = (long *) omAlloc (n * sizeof (long)); 3240 3240 if(F4_mode) 3241 3241 S = idInit (n, I->rank); … … 3331 3331 if(!(completed)) 3332 3332 { 3333 poly *add = (poly *) om alloc ((pair_top + 2) * sizeof (poly));3333 poly *add = (poly *) omAlloc ((pair_top + 2) * sizeof (poly)); 3334 3334 int piter; 3335 3335 int pos = 0; … … 3374 3374 poly_list_node *old = c->to_destroy; 3375 3375 c->to_destroy = c->to_destroy->next; 3376 om free (old);3376 omFree (old); 3377 3377 } 3378 3378 while(c->F) … … 3382 3382 pDelete (&(c->F->mp[i].m)); 3383 3383 } 3384 om free (c->F->mp);3384 omFree (c->F->mp); 3385 3385 c->F->mp = NULL; 3386 3386 mp_array_list *old = c->F; 3387 3387 c->F = c->F->next; 3388 om free (old);3388 omFree (old); 3389 3389 } 3390 3390 while(c->F_minus) … … 3394 3394 pDelete (&(c->F_minus->p[i])); 3395 3395 } 3396 om free (c->F_minus->p);3396 omFree (c->F_minus->p); 3397 3397 c->F_minus->p = NULL; 3398 3398 poly_array_list *old = c->F_minus; 3399 3399 c->F_minus = c->F_minus->next; 3400 om free (old);3400 omFree (old); 3401 3401 } 3402 3402 #ifndef HAVE_BOOST … … 3404 3404 for(int z = 1 /* zero length at 0 */ ; z < c->n; z++) 3405 3405 { 3406 om free (c->states[z]);3407 } 3408 om free (c->states);3409 #endif 3410 #endif 3411 3412 om free (c->lengths);3413 om free (c->weighted_lengths);3406 omFree (c->states[z]); 3407 } 3408 omFree (c->states); 3409 #endif 3410 #endif 3411 3412 omFree (c->lengths); 3413 omFree (c->weighted_lengths); 3414 3414 for(int z = 0; z < c->n; z++) 3415 3415 { 3416 3416 pDelete (&c->tmp_pair_lm[z]); 3417 omfree (c->tmp_spn[z]); 3418 } 3419 omfree (c->tmp_pair_lm); 3420 omfree (c->tmp_spn); 3421 3422 omfree (c->T_deg); 3423 if(c->T_deg_full) 3424 omfree (c->T_deg_full); 3417 omFree (c->tmp_spn[z]); 3418 } 3419 omFree (c->tmp_pair_lm); 3420 omFree (c->tmp_spn); 3421 3422 omFree (c->T_deg); 3423 omfree (c->T_deg_full); /*c->T_deg_full my be NULL*/ 3425 3424 3426 3425 omFree (c->strat->ecartS); … … 3440 3439 pDelete (&(c->gcd_of_terms[i])); 3441 3440 } 3442 om free (c->gcd_of_terms);3443 3444 om free (c->apairs);3441 omFree (c->gcd_of_terms); 3442 3443 omFree (c->apairs); 3445 3444 if(TEST_OPT_PROT) 3446 3445 { … … 3508 3507 } 3509 3508 } 3510 om free (c->short_Exps);3509 omFree (c->short_Exps); 3511 3510 3512 3511 ideal I = c->S; … … 3917 3916 } 3918 3917 3919 void free_sorted_pair_node (sorted_pair_node * s, ring r)3918 void free_sorted_pair_node (sorted_pair_node * s, const ring r) 3920 3919 { 3921 3920 if(s->i >= 0) 3922 3921 p_Delete (&s->lcm_of_lm, r); 3923 om free (s);3922 omFree (s); 3924 3923 } 3925 3924 … … 4628 4627 } 4629 4628 } 4630 om free (los_region);4631 om free (new_indices);4629 omFree (los_region); 4630 omFree (new_indices); 4632 4631 } 4633 4632 … … 4635 4634 static void multi_reduction (red_object * los, int &losl, slimgb_alg * c) 4636 4635 { 4637 poly *delay = (poly *) om alloc (losl * sizeof (poly));4636 poly *delay = (poly *) omAlloc (losl * sizeof (poly)); 4638 4637 int delay_s = 0; 4639 4638 //initialize; … … 4665 4664 { 4666 4665 int pn_noro = curr_pos + 1; 4667 poly *p_noro = (poly *) om alloc (pn_noro * sizeof (poly));4666 poly *p_noro = (poly *) omAlloc (pn_noro * sizeof (poly)); 4668 4667 for(i = 0; i < pn_noro; i++) 4669 4668 { … … 4811 4810 c->apairs=spn_merge(c->apairs,c->pair_top+1,pairs,delay_s,c); 4812 4811 c->pair_top+=delay_s; */ 4813 om free (delay);4812 omFree (delay); 4814 4813 //omfree(pairs); 4815 4814 return; -
kernel/GBEngine/tgb_internal.h
r6cfe0d r7e29aa 14 14 //#define TGB_DEBUG 15 15 #define FULLREDUCTIONS 16 #define HANS_IDEA17 16 //#define HALFREDUCTIONS 18 17 //#define HEAD_BIN … … 328 327 }; 329 328 template <class len_type, class set_type> int pos_helper(kStrategy strat, poly p, len_type len, set_type setL, polyset set); 330 void free_sorted_pair_node(sorted_pair_node* s, ring r);329 void free_sorted_pair_node(sorted_pair_node* s, const ring r); 331 330 ideal do_t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode,int deg_pos); 332 331 void now_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c); … … 1423 1422 bool dense=true; 1424 1423 if (max_density<0.3) dense=false; 1425 if (dense){ 1424 if (dense) 1425 { 1426 1426 SparseRow<number_type>* res=noro_red_to_non_poly_dense(mon,len,cache); 1427 1427 omfree(mon); 1428 1428 return res; 1429 } else { 1430 SparseRow<number_type>* res=noro_red_to_non_poly_sparse(mon,len,cache); 1431 omfree(mon); 1432 return res; 1433 } 1429 } 1430 else 1431 { 1432 SparseRow<number_type>* res=noro_red_to_non_poly_sparse(mon,len,cache); 1433 omfree(mon); 1434 return res; 1435 } 1434 1436 //in the loop before nIrreducibleMonomials increases, so position here is important 1435 1437 -
kernel/combinatorics/hilb.cc
r6cfe0d r7e29aa 2150 2150 if(!mgrad) 2151 2151 { 2152 tt=(char**)om alloc(sizeof(char*));2152 tt=(char**)omAlloc(sizeof(char*)); 2153 2153 tt[0] = omStrDup("t"); 2154 2154 npar = 1; … … 2159 2159 for(is = 0; is < lV; is++) 2160 2160 { 2161 tt[is] = (char*)om alloc(7*sizeof(char)); //if required enlarge it later2161 tt[is] = (char*)omAlloc(7*sizeof(char)); //if required enlarge it later 2162 2162 sprintf (tt[is], "t%d", is+1); 2163 2163 } … … 2167 2167 p.r = rDefault(0, npar, tt); 2168 2168 coeffs cf = nInitChar(n_transExt, &p); 2169 char** xx = (char**)om alloc(sizeof(char*));2169 char** xx = (char**)omAlloc(sizeof(char*)); 2170 2170 xx[0] = omStrDup("x"); 2171 2171 ring R = rDefault(cf, 1, xx); -
kernel/ideals.cc
r6cfe0d r7e29aa 1427 1427 if (h4->m[i-1]!=NULL) 1428 1428 { 1429 p = p_Copy_noCheck(h4->m[i-1], currRing); 1429 p = p_Copy_noCheck(h4->m[i-1], currRing); /*h4->m[i-1]!=NULL*/ 1430 1430 p_Shift(&p,1,currRing); 1431 1431 h4->m[i] = p; -
libpolys/polys/kbuckets.cc
r6cfe0d r7e29aa 5 5 #include "omalloc/omalloc.h" 6 6 #include "misc/auxiliary.h" 7 #include "misc/options.h" 7 8 8 9 #include "polys/monomials/p_polys.h" 9 10 #include "coeffs/coeffs.h" 11 #include "coeffs/numbers.h" 10 12 #include "polys/monomials/ring.h" 11 13 #include "polys/kbuckets.h" … … 102 104 #endif 103 105 pFalseReturn(p_Test(bucket->buckets[i], bucket->bucket_ring)); 104 if ( bucket->buckets_length[i] != pLength(bucket->buckets[i]))106 if ((unsigned)bucket->buckets_length[i] != pLength(bucket->buckets[i])) 105 107 { 106 108 dReportError("Bucket %d lengths difference should:%d has:%d", … … 223 225 for (i=0; i<= bucket->buckets_used; i++) 224 226 { 225 226 if (bucket->buckets[i] != NULL) 227 { 228 p_Delete(&(bucket->buckets[i]), bucket->bucket_ring); 227 p_Delete(&(bucket->buckets[i]), bucket->bucket_ring); 229 228 #ifdef USE_COEF_BUCKETS 230 if (bucket->coef[i]!=NULL) 231 p_Delete(&(bucket->coef[i]), bucket->bucket_ring); 232 #endif 233 } 229 p_Delete(&(bucket->coef[i]), bucket->bucket_ring); 230 #endif 234 231 } 235 232 omFreeBin(bucket, kBucket_bin); … … 337 334 //assume(false); 338 335 assume(bucket != NULL); 339 assume(length <= 0 || length == pLength(lm));336 assume(length <= 0 || (unsigned)length == pLength(lm)); 340 337 assume(kBucketIsCleared(bucket)); 341 338 … … 437 434 assume(bucket->coef[i]==NULL); 438 435 #endif 439 assume(pLength(p) == ( int)pl);436 assume(pLength(p) == (unsigned)pl); 440 437 //if (TEST_OPT_PROT) { Print("C(%d)",pl); } 441 438 kbTest(bucket); … … 737 734 if ((i <= bucket->buckets_used) && (bucket->buckets[i] != NULL)) 738 735 { 739 assume(pLength(bucket->buckets[i])== bucket->buckets_length[i]);736 assume(pLength(bucket->buckets[i])==(unsigned)bucket->buckets_length[i]); 740 737 //#ifdef USE_COEF_BUCKETS 741 738 // if(bucket->coef[i]!=NULL) … … 807 804 { 808 805 assume((!rIsPluralRing(bucket->bucket_ring))||p_IsConstant(m, bucket->bucket_ring)); 809 assume(l <= 0 || pLength(p) == l);806 assume(l <= 0 || pLength(p) == (unsigned)l); 810 807 int i, l1; 811 808 poly p1 = p; … … 975 972 } 976 973 977 if ( (p1==NULL) && (bucket->coef[i]!=NULL))974 if (p1==NULL) 978 975 p_Delete(&bucket->coef[i],r); 979 976 #endif … … 1038 1035 if (q != NULL) 1039 1036 { 1040 assume(pLength(q) == lq);1037 assume(pLength(q) == (unsigned)lq); 1041 1038 bucket->buckets_length[i] -= lq; 1042 assume(pLength(bucket->buckets[i]) == bucket->buckets_length[i]);1039 assume(pLength(bucket->buckets[i]) == (unsigned)bucket->buckets_length[i]); 1043 1040 p = p_Add_q(p, q, lp, lq, bucket->bucket_ring); 1044 1041 } … … 1070 1067 assume(p1 != NULL && 1071 1068 p_DivisibleBy(p1, kBucketGetLm(bucket), r)); 1072 assume(pLength(p1) == ( int) l1);1069 assume(pLength(p1) == (unsigned) l1); 1073 1070 1074 1071 poly a1 = pNext(p1), lm = kBucketExtractLm(bucket); … … 1128 1125 l1--; 1129 1126 1130 assume( l1==pLength(a1));1127 assume((unsigned)l1==pLength(a1)); 1131 1128 #if 0 1132 1129 BOOLEAN backuped=FALSE; … … 1163 1160 1164 1161 #ifndef USE_COEF_BUCKETS 1165 void kBucketSimpleContent(kBucket_pt) {} 1162 void kBucketSimpleContent(kBucket_pt bucket) 1163 { 1164 if (bucket->buckets[0]==NULL) return; 1165 1166 ring r=bucket->bucket_ring; 1167 if (rField_is_Ring(r)) return; 1168 1169 coeffs cf=r->cf; 1170 if (cf->cfSubringGcd==ndGcd) /* trivial gcd*/ return; 1171 1172 number nn=pGetCoeff(bucket->buckets[0]); 1173 //if ((bucket->buckets_used==0) 1174 //&&(!n_IsOne(nn,cf))) 1175 //{ 1176 // if (TEST_OPT_PROT) PrintS("@"); 1177 // p_SetCoeff(bucket->buckets[0],n_Init(1,cf),r); 1178 // return; 1179 //} 1180 1181 if (n_Size(nn,cf)<2) return; 1182 1183 //kBucketAdjustBucketsUsed(bucket); 1184 number coef=n_Copy(nn,cf); 1185 // find an initial guess of a gcd 1186 for (int i=1; i<=bucket->buckets_used;i++) 1187 { 1188 if (bucket->buckets[i]!=NULL) 1189 { 1190 number t=p_InitContent(bucket->buckets[i],r); 1191 if (n_Size(t,cf)<2) 1192 { 1193 n_Delete(&t,cf); 1194 n_Delete(&coef,cf); 1195 return; 1196 } 1197 number t2=n_SubringGcd(coef,t,cf); 1198 n_Delete(&t,cf); 1199 n_Delete(&coef,cf); 1200 coef=t2; 1201 if (n_Size(coef,cf)<2) { n_Delete(&coef,cf);return;} 1202 } 1203 } 1204 // find the gcd 1205 for (int i=0; i<=bucket->buckets_used;i++) 1206 { 1207 if (bucket->buckets[i]!=NULL) 1208 { 1209 poly p=bucket->buckets[i]; 1210 while(p!=NULL) 1211 { 1212 number t=n_SubringGcd(coef,pGetCoeff(p),cf); 1213 if (n_Size(t,cf)<2) 1214 { 1215 n_Delete(&t,cf); 1216 n_Delete(&coef,cf); 1217 return; 1218 } 1219 pIter(p); 1220 } 1221 } 1222 } 1223 // divided by the gcd 1224 if (TEST_OPT_PROT) PrintS("@"); 1225 for (int i=bucket->buckets_used;i>=0;i--) 1226 { 1227 if (bucket->buckets[i]!=NULL) 1228 { 1229 poly p=bucket->buckets[i]; 1230 while(p!=NULL) 1231 { 1232 number d = n_ExactDiv(pGetCoeff(p),coef,cf); 1233 p_SetCoeff(p,d,r); 1234 pIter(p); 1235 } 1236 } 1237 } 1238 n_Delete(&coef,cf); 1239 } 1166 1240 #else 1167 1241 static BOOLEAN nIsPseudoUnit(number n, ring r) -
libpolys/polys/monomials/p_polys.cc
r6cfe0d r7e29aa 2234 2234 /* --------------------------------------------------------------------------------*/ 2235 2235 /* content suff */ 2236 staticnumber p_InitContent(poly ph, const ring r);2236 //number p_InitContent(poly ph, const ring r); 2237 2237 2238 2238 void p_Content(poly ph, const ring r) … … 2543 2543 #endif 2544 2544 2545 staticnumber p_InitContent(poly ph, const ring r)2545 number p_InitContent(poly ph, const ring r) 2546 2546 // only for coefficients in Q and rational functions 2547 2547 #if 0 -
libpolys/polys/monomials/p_polys.h
r6cfe0d r7e29aa 213 213 // currently only used by Singular/janet 214 214 void p_SimpleContent(poly p, int s, const ring r); 215 number p_InitContent(poly ph, const ring r); 215 216 #endif 216 217 … … 798 799 static inline poly p_Copy_noCheck(poly p, const ring r) 799 800 { 800 assume(r != NULL); assume(r->p_Procs != NULL); assume(r->p_Procs->p_Copy != NULL); 801 /*assume(p!=NULL);*/ 802 assume(r != NULL); 803 assume(r->p_Procs != NULL); 804 assume(r->p_Procs->p_Copy != NULL); 801 805 return r->p_Procs->p_Copy(p, r); 802 806 } … … 805 809 static inline poly p_Copy(poly p, const ring r) 806 810 { 807 p_Test(p,r); 808 const poly pp = p_Copy_noCheck(p, r); 809 p_Test(pp,r); 810 return pp; 811 if (p!=NULL) 812 { 813 p_Test(p,r); 814 const poly pp = p_Copy_noCheck(p, r); 815 p_Test(pp,r); 816 return pp; 817 } 818 else 819 return NULL; 811 820 } 812 821 … … 824 833 } 825 834 826 static inline poly p_LmHead(poly p, const ring r)827 {828 p_LmCheckPolyRing1(p, r);829 poly np;830 omTypeAllocBin(poly, np, r->PolyBin);831 p_SetRingOfLm(np, r);832 memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));833 pNext(np) = NULL;834 pSetCoeff0(np, NULL);835 return np;836 }837 838 835 // returns a copy of p with Lm(p) from lmRing and Tail(p) from tailRing 839 836 static inline poly p_Copy(poly p, const ring lmRing, const ring tailRing) … … 846 843 #endif 847 844 poly pres = p_Head(p, lmRing); 848 pNext(pres) = p_Copy_noCheck(pNext(p), tailRing); 845 if (pNext(p)!=NULL) 846 pNext(pres) = p_Copy_noCheck(pNext(p), tailRing); 849 847 return pres; 850 848 } … … 858 856 assume( p!= NULL ); 859 857 assume( r!= NULL ); 860 r->p_Procs->p_Delete(p, r);858 if ((*p)!=NULL) r->p_Procs->p_Delete(p, r); 861 859 } 862 860 … … 918 916 else if (n_IsZero(n, r->cf)) 919 917 { 920 r->p_Procs->p_Delete(&p, r); // NOTE: without p_Delete - memory leak!918 p_Delete(&p, r); // NOTE: without p_Delete - memory leak! 921 919 return NULL; 922 920 } … … 1053 1051 if (p == NULL) 1054 1052 { 1055 r->p_Procs->p_Delete(&q, r);1053 p_Delete(&q, r); 1056 1054 return NULL; 1057 1055 } 1058 1056 if (q == NULL) 1059 1057 { 1060 r->p_Procs->p_Delete(&p, r);1058 p_Delete(&p, r); 1061 1059 return NULL; 1062 1060 } … … 1071 1069 q = r->p_Procs->p_Mult_mm(q, p, r); 1072 1070 1073 r->p_Procs->p_Delete(&p, r);1071 p_LmDelete(&p, r); 1074 1072 return q; 1075 1073 } … … 1078 1076 { 1079 1077 p = r->p_Procs->p_Mult_mm(p, q, r); 1080 r->p_Procs->p_Delete(&q, r);1078 p_LmDelete(&q, r); 1081 1079 return p; 1082 1080 } -
libpolys/polys/pDebug.cc
r6cfe0d r7e29aa 90 90 #ifndef X_OMALLOC 91 91 { 92 _pPolyAssumeReturn(omIsBinPageAddr(p) && omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin),p,r); 92 _pPolyAssumeReturn(omIsBinPageAddr(p),p,r); 93 _pPolyAssumeReturn(omSizeWOfAddr(p)==omSizeWOfBin(r->PolyBin),p,r); 93 94 return TRUE; 94 95 } -
libpolys/polys/sbuckets.cc
r6cfe0d r7e29aa 117 117 for (i=0; i<= bucket->max_bucket; i++) 118 118 { 119 120 if (bucket->buckets[i].p != NULL) 121 { 122 p_Delete(&(bucket->buckets[i].p), bucket->bucket_ring); 123 } 119 p_Delete(&(bucket->buckets[i].p), bucket->bucket_ring); 124 120 } 125 121 omFreeBin(bucket, sBucket_bin);
Note: See TracChangeset
for help on using the changeset viewer.