Changeset 7e29aa in git


Ignore:
Timestamp:
Feb 23, 2018, 5:33:43 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
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
Message:
Merge pull request #856 from kabouzeid/fix-ivMaxIdeal

Add missing return statement in ivMaxIdeal() proc from fpadim.lib
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    r619862 r7e29aa  
    23852385  ivMaxIdeal(2,0);
    23862386  ivMaxIdeal(2,1);
    2387   ivMaxIdeal(4,0);
    2388   ivMaxIdeal(4,1);
    23892387}
    23902388
     
    23992397  "
    24002398{
    2401   ivL2lpI(ivMaxIdeal(d, donly));
     2399  return(ivL2lpI(ivMaxIdeal(d, donly)));
    24022400}
    24032401example {
     
    24082406  lpMaxIdeal(2,0);
    24092407  lpMaxIdeal(2,1);
    2410   lpMaxIdeal(4,0);
    2411   lpMaxIdeal(4,1);
    24122408}
    24132409
  • Singular/links/asciiLink.cc

    r6cfe0d r7e29aa  
    426426  {
    427427    #define MAX_LIBS 256
    428     (*list_of_libs)=(char**)omalloc0(MAX_LIBS*sizeof(char**));
     428    (*list_of_libs)=(char**)omAlloc0(MAX_LIBS*sizeof(char**));
    429429    (*list_of_libs)[0]=name;
    430430    (*list_of_libs)[MAX_LIBS-1]=(char*)1;
  • Singular/misc_ip.cc

    r6cfe0d r7e29aa  
    7474
    7575#ifdef HAVE_NTL
    76 #include<NTL/version.h>
    77 #include<NTL/tools.h>
     76#include <NTL/version.h>
     77#include <NTL/tools.h>
    7878#ifdef NTL_CLIENT
    7979NTL_CLIENT
  • Singular/tesths.cc

    r6cfe0d r7e29aa  
    3636
    3737#include <unistd.h>
     38#ifdef HAVE_NTL
     39#include <NTL/config.h>
     40#endif
    3841
    3942
     
    6770  siInit(argv[0]);
    6871  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
    6979
    7080  // parse command line options
  • factory/cf_factory.h

    r6cfe0d r7e29aa  
    1616
    1717#include "factory/cf_gmp.h"
    18 #include "factory/cf_assert.h"
     18#include "cf_assert.h"
    1919
    2020class InternalCF;
  • kernel/GBEngine/janet.cc

    r6cfe0d r7e29aa  
    237237    {
    238238      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 */
    240241    }
    241242  }
  • kernel/GBEngine/kInline.h

    r6cfe0d r7e29aa  
    207207    if (p != NULL) /* and t_p!=NULL*/
    208208    {
    209       p = p_Head(p, currRing);
    210       n_Delete(&pGetCoeff(p),currRing->cf);
     209      p = p_LmInit(p, currRing);
    211210      pGetCoeff(p)=pGetCoeff(t_p);
    212211      pNext(p) = pNext(t_p);
  • kernel/GBEngine/kstdfac.cc

    r6cfe0d r7e29aa  
    7979    else
    8080    {
    81       l[j].p=p_LmHead(o->L[j].p,currRing);
     81      l[j].p=p_LmInit(o->L[j].p,currRing);
    8282      if (pGetCoeff(o->L[j].p)!=NULL) pSetCoeff0(l[j].p,nCopy(pGetCoeff(o->L[j].p)));
    8383      pNext(l[j].p)=n->tail;
  • kernel/GBEngine/tgb.cc

    r6cfe0d r7e29aa  
    793793    p[a[i] + i] = q[i];
    794794  }
    795   omfree (a);
     795  omFree (a);
    796796  return p;
    797797}
     
    900900    }
    901901  }
    902   omfree (i_con);
     902  omFree (i_con);
    903903
    904904  return FALSE;
     
    11571157            connected[connected_length] = -1;
    11581158          }
    1159           omfree (cans);
     1159          omFree (cans);
    11601160          return connected;
    11611161        }
     
    11981198    connected[connected_length] = -1;
    11991199  }
    1200   omfree (cans);
     1200  omFree (cans);
    12011201  return connected;
    12021202}
     
    12851285
    12861286  //can also try dependend search
    1287   omfree (i_con);
    1288   omfree (j_con);
     1287  omFree (i_con);
     1288  omFree (j_con);
    12891289  return;
    12901290}
     
    17541754
    17551755  assume (spc_final <= spc);
    1756   omfree (nodes);
     1756  omFree (nodes);
    17571757  nodes = NULL;
    17581758
     
    18261826    c->pair_top += spc_final;
    18271827    clean_top_of_pair_list (c);
    1828     omfree (nodes_final);
     1828    omFree (nodes_final);
    18291829    return NULL;
    18301830  }
     
    21742174  c->pair_top += sum;
    21752175  clean_top_of_pair_list (c);
    2176   omfree (big_sbuf);
    2177   omfree (sbuf);
    2178   omfree (ibuf);
     2176  omFree (big_sbuf);
     2177  omFree (sbuf);
     2178  omFree (ibuf);
    21792179  //omfree(buf);
    21802180#ifdef TGB_DEBUG
     
    26642664  int rank = reduced_c;
    26652665  linalg_step_modp (reduced, p, rank, terms, nterms, c);
    2666   omfree (terms);
     2666  omFree (terms);
    26672667
    26682668  pn = rank;
    2669   omfree (reduced);
     2669  omFree (reduced);
    26702670
    26712671  if(TEST_OPT_PROT)
     
    27002700    max_pairs = bundle_size_noro;
    27012701#endif
    2702   poly *p = (poly *) omalloc ((max_pairs + 1) * sizeof (poly)); //nullterminated
     2702  poly *p = (poly *) omAlloc ((max_pairs + 1) * sizeof (poly)); //nullterminated
    27032703
    27042704  int curr_deg = -1;
     
    27752775  if(i == 0)
    27762776  {
    2777     omfree (p);
     2777    omFree (p);
    27782778    return;
    27792779  }
     
    27932793    if(pn == 0)
    27942794    {
    2795       omfree (p);
     2795      omFree (p);
    27962796      return;
    27972797    }
     
    28192819    //}
    28202820    mass_add (p, pn, c);
    2821     omfree (p);
     2821    omFree (p);
    28222822    return;
    28232823    /*if (TEST_OPT_PROT)
     
    28282828  }
    28292829#endif
    2830   red_object *buf = (red_object *) omalloc (i * sizeof (red_object));
     2830  red_object *buf = (red_object *) omAlloc (i * sizeof (red_object)); /*i>0*/
    28312831  for(j = 0; j < i; j++)
    28322832  {
     
    28412841    assume (buf[j].initial_quality >= 0);
    28422842  }
    2843   omfree (p);
     2843  omFree (p);
    28442844  qsort (buf, i, sizeof (red_object), red_object_better_gen);
    28452845//    Print("\ncurr_deg:%i\n",curr_deg);
     
    29192919  }
    29202920  mass_add (add_those, i, c);
    2921   omfree (add_those);
    2922   omfree (buf);
     2921  omFree (add_those);
     2922  omFree (buf);
    29232923
    29242924  if(TEST_OPT_PROT)
     
    31073107    return;
    31083108  sorted_pair_node **si_array =
    3109     (sorted_pair_node **) omalloc (s * sizeof (sorted_pair_node *));
     3109    (sorted_pair_node **) omAlloc (s * sizeof (sorted_pair_node *));
    31103110
    31113111  for(int i = 0; i < s; i++)
    31123112  {
    31133113    sorted_pair_node *si =
    3114       (sorted_pair_node *) omalloc (sizeof (sorted_pair_node));
     3114      (sorted_pair_node *) omAlloc (sizeof (sorted_pair_node));
    31153115    si->i = -1;
    31163116    si->j = -2;
     
    31353135  apairs = spn_merge (apairs, pair_top + 1, si_array, s, this);
    31363136  pair_top += s;
    3137   omfree (si_array);
     3137  omFree (si_array);
    31383138}
    31393139
     
    32033203
    32043204  apairs =
    3205     (sorted_pair_node **) omalloc (sizeof (sorted_pair_node *) * max_pairs);
     3205    (sorted_pair_node **) omAlloc (sizeof (sorted_pair_node *) * max_pairs);
    32063206  pair_top = -1;
    32073207
     
    32123212  i = 0;
    32133213  this->n = 0;
    3214   T_deg = (int *) omalloc (n * sizeof (int));
     3214  T_deg = (int *) omAlloc (n * sizeof (int));
    32153215  if(eliminationProblem)
    3216     T_deg_full = (int *) omalloc (n * sizeof (int));
     3216    T_deg_full = (int *) omAlloc (n * sizeof (int));
    32173217  else
    32183218    T_deg_full = NULL;
    3219   tmp_pair_lm = (poly *) omalloc (n * sizeof (poly));
    3220   tmp_spn = (sorted_pair_node **) omalloc (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 *));
    32213221  lm_bin = omGetSpecBin (POLYSIZE + (r->ExpL_Size) * sizeof (long));
    32223222#ifdef HEAD_BIN
     
    32273227#ifdef USE_STDVECBOOL
    32283228#else
    3229   h = omalloc (n * sizeof (char *));
     3229  h = omAlloc (n * sizeof (char *));
    32303230
    32313231  states = (char **) h;
    32323232#endif
    32333233#endif
    3234   h = omalloc (n * sizeof (int));
     3234  h = omAlloc (n * sizeof (int));
    32353235  lengths = (int *) h;
    32363236  weighted_lengths = (wlen_type *) omAllocAligned (n * sizeof (wlen_type));
    32373237  gcd_of_terms = (poly *) omAlloc (n * sizeof (poly));
    32383238
    3239   short_Exps = (long *) omalloc (n * sizeof (long));
     3239  short_Exps = (long *) omAlloc (n * sizeof (long));
    32403240  if(F4_mode)
    32413241    S = idInit (n, I->rank);
     
    33313331  if(!(completed))
    33323332  {
    3333     poly *add = (poly *) omalloc ((pair_top + 2) * sizeof (poly));
     3333    poly *add = (poly *) omAlloc ((pair_top + 2) * sizeof (poly));
    33343334    int piter;
    33353335    int pos = 0;
     
    33743374    poly_list_node *old = c->to_destroy;
    33753375    c->to_destroy = c->to_destroy->next;
    3376     omfree (old);
     3376    omFree (old);
    33773377  }
    33783378  while(c->F)
     
    33823382      pDelete (&(c->F->mp[i].m));
    33833383    }
    3384     omfree (c->F->mp);
     3384    omFree (c->F->mp);
    33853385    c->F->mp = NULL;
    33863386    mp_array_list *old = c->F;
    33873387    c->F = c->F->next;
    3388     omfree (old);
     3388    omFree (old);
    33893389  }
    33903390  while(c->F_minus)
     
    33943394      pDelete (&(c->F_minus->p[i]));
    33953395    }
    3396     omfree (c->F_minus->p);
     3396    omFree (c->F_minus->p);
    33973397    c->F_minus->p = NULL;
    33983398    poly_array_list *old = c->F_minus;
    33993399    c->F_minus = c->F_minus->next;
    3400     omfree (old);
     3400    omFree (old);
    34013401  }
    34023402#ifndef HAVE_BOOST
     
    34043404  for(int z = 1 /* zero length at 0 */ ; z < c->n; z++)
    34053405  {
    3406     omfree (c->states[z]);
    3407   }
    3408   omfree (c->states);
    3409 #endif
    3410 #endif
    3411 
    3412   omfree (c->lengths);
    3413   omfree (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);
    34143414  for(int z = 0; z < c->n; z++)
    34153415  {
    34163416    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*/
    34253424
    34263425  omFree (c->strat->ecartS);
     
    34403439      pDelete (&(c->gcd_of_terms[i]));
    34413440  }
    3442   omfree (c->gcd_of_terms);
    3443 
    3444   omfree (c->apairs);
     3441  omFree (c->gcd_of_terms);
     3442
     3443  omFree (c->apairs);
    34453444  if(TEST_OPT_PROT)
    34463445  {
     
    35083507    }
    35093508  }
    3510   omfree (c->short_Exps);
     3509  omFree (c->short_Exps);
    35113510
    35123511  ideal I = c->S;
     
    39173916}
    39183917
    3919 void free_sorted_pair_node (sorted_pair_node * s, ring r)
     3918void free_sorted_pair_node (sorted_pair_node * s, const ring r)
    39203919{
    39213920  if(s->i >= 0)
    39223921    p_Delete (&s->lcm_of_lm, r);
    3923   omfree (s);
     3922  omFree (s);
    39243923}
    39253924
     
    46284627    }
    46294628  }
    4630   omfree (los_region);
    4631   omfree (new_indices);
     4629  omFree (los_region);
     4630  omFree (new_indices);
    46324631}
    46334632
     
    46354634static void multi_reduction (red_object * los, int &losl, slimgb_alg * c)
    46364635{
    4637   poly *delay = (poly *) omalloc (losl * sizeof (poly));
     4636  poly *delay = (poly *) omAlloc (losl * sizeof (poly));
    46384637  int delay_s = 0;
    46394638  //initialize;
     
    46654664    {
    46664665      int pn_noro = curr_pos + 1;
    4667       poly *p_noro = (poly *) omalloc (pn_noro * sizeof (poly));
     4666      poly *p_noro = (poly *) omAlloc (pn_noro * sizeof (poly));
    46684667      for(i = 0; i < pn_noro; i++)
    46694668      {
     
    48114810     c->apairs=spn_merge(c->apairs,c->pair_top+1,pairs,delay_s,c);
    48124811     c->pair_top+=delay_s; */
    4813   omfree (delay);
     4812  omFree (delay);
    48144813  //omfree(pairs);
    48154814  return;
  • kernel/GBEngine/tgb_internal.h

    r6cfe0d r7e29aa  
    1414//#define TGB_DEBUG
    1515#define FULLREDUCTIONS
    16 #define HANS_IDEA
    1716//#define HALFREDUCTIONS
    1817//#define HEAD_BIN
     
    328327  };
    329328template <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);
     329void free_sorted_pair_node(sorted_pair_node* s, const ring r);
    331330ideal do_t_rep_gb(ring r,ideal arg_I, int syz_comp, BOOLEAN F4_mode,int deg_pos);
    332331void now_t_rep(const int & arg_i, const int & arg_j, slimgb_alg* c);
     
    14231422  bool dense=true;
    14241423  if (max_density<0.3) dense=false;
    1425   if (dense){
     1424  if (dense)
     1425  {
    14261426    SparseRow<number_type>* res=noro_red_to_non_poly_dense(mon,len,cache);
    14271427    omfree(mon);
    14281428    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  }
    14341436  //in the loop before nIrreducibleMonomials increases, so position here is important
    14351437
  • kernel/combinatorics/hilb.cc

    r6cfe0d r7e29aa  
    21502150  if(!mgrad)
    21512151  {
    2152     tt=(char**)omalloc(sizeof(char*));
     2152    tt=(char**)omAlloc(sizeof(char*));
    21532153    tt[0] = omStrDup("t");
    21542154    npar = 1;
     
    21592159    for(is = 0; is < lV; is++)
    21602160    {
    2161       tt[is] = (char*)omalloc(7*sizeof(char)); //if required enlarge it later
     2161      tt[is] = (char*)omAlloc(7*sizeof(char)); //if required enlarge it later
    21622162      sprintf (tt[is], "t%d", is+1);
    21632163    }
     
    21672167  p.r = rDefault(0, npar, tt);
    21682168  coeffs cf = nInitChar(n_transExt, &p);
    2169   char** xx = (char**)omalloc(sizeof(char*));
     2169  char** xx = (char**)omAlloc(sizeof(char*));
    21702170  xx[0] = omStrDup("x");
    21712171  ring R = rDefault(cf, 1, xx);
  • kernel/ideals.cc

    r6cfe0d r7e29aa  
    14271427      if (h4->m[i-1]!=NULL)
    14281428      {
    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*/
    14301430        p_Shift(&p,1,currRing);
    14311431        h4->m[i] = p;
  • libpolys/polys/kbuckets.cc

    r6cfe0d r7e29aa  
    55#include "omalloc/omalloc.h"
    66#include "misc/auxiliary.h"
     7#include "misc/options.h"
    78
    89#include "polys/monomials/p_polys.h"
    910#include "coeffs/coeffs.h"
     11#include "coeffs/numbers.h"
    1012#include "polys/monomials/ring.h"
    1113#include "polys/kbuckets.h"
     
    102104  #endif
    103105  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]))
    105107  {
    106108    dReportError("Bucket %d lengths difference should:%d has:%d",
     
    223225  for (i=0; i<= bucket->buckets_used; i++)
    224226  {
    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);
    229228#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
    234231  }
    235232  omFreeBin(bucket, kBucket_bin);
     
    337334  //assume(false);
    338335  assume(bucket != NULL);
    339   assume(length <= 0 || length == pLength(lm));
     336  assume(length <= 0 || (unsigned)length == pLength(lm));
    340337  assume(kBucketIsCleared(bucket));
    341338
     
    437434    assume(bucket->coef[i]==NULL);
    438435  #endif
    439   assume(pLength(p) == (int) pl);
     436  assume(pLength(p) == (unsigned)pl);
    440437  //if (TEST_OPT_PROT) { Print("C(%d)",pl); }
    441438  kbTest(bucket);
     
    737734    if ((i <= bucket->buckets_used) && (bucket->buckets[i] != NULL))
    738735    {
    739       assume(pLength(bucket->buckets[i])==bucket->buckets_length[i]);
     736      assume(pLength(bucket->buckets[i])==(unsigned)bucket->buckets_length[i]);
    740737//#ifdef USE_COEF_BUCKETS
    741738//     if(bucket->coef[i]!=NULL)
     
    807804{
    808805    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);
    810807  int i, l1;
    811808  poly p1 = p;
     
    975972  }
    976973
    977   if ((p1==NULL) && (bucket->coef[i]!=NULL))
     974  if (p1==NULL)
    978975    p_Delete(&bucket->coef[i],r);
    979976#endif
     
    10381035      if (q != NULL)
    10391036      {
    1040         assume(pLength(q) == lq);
     1037        assume(pLength(q) == (unsigned)lq);
    10411038        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]);
    10431040        p = p_Add_q(p, q, lp, lq, bucket->bucket_ring);
    10441041      }
     
    10701067  assume(p1 != NULL &&
    10711068         p_DivisibleBy(p1,  kBucketGetLm(bucket), r));
    1072   assume(pLength(p1) == (int) l1);
     1069  assume(pLength(p1) == (unsigned) l1);
    10731070
    10741071  poly a1 = pNext(p1), lm = kBucketExtractLm(bucket);
     
    11281125  l1--;
    11291126
    1130   assume(l1==pLength(a1));
     1127  assume((unsigned)l1==pLength(a1));
    11311128#if 0
    11321129  BOOLEAN backuped=FALSE;
     
    11631160
    11641161#ifndef USE_COEF_BUCKETS
    1165 void kBucketSimpleContent(kBucket_pt) {}
     1162void 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}
    11661240#else
    11671241static BOOLEAN nIsPseudoUnit(number n, ring r)
  • libpolys/polys/monomials/p_polys.cc

    r6cfe0d r7e29aa  
    22342234/* --------------------------------------------------------------------------------*/
    22352235/* content suff                                                                   */
    2236 static number p_InitContent(poly ph, const ring r);
     2236//number p_InitContent(poly ph, const ring r);
    22372237
    22382238void p_Content(poly ph, const ring r)
     
    25432543#endif
    25442544
    2545 static number p_InitContent(poly ph, const ring r)
     2545number p_InitContent(poly ph, const ring r)
    25462546// only for coefficients in Q and rational functions
    25472547#if 0
  • libpolys/polys/monomials/p_polys.h

    r6cfe0d r7e29aa  
    213213// currently only used by Singular/janet
    214214void      p_SimpleContent(poly p, int s, const ring r);
     215number    p_InitContent(poly ph, const ring r);
    215216#endif
    216217
     
    798799static inline poly p_Copy_noCheck(poly p, const ring r)
    799800{
    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);
    801805  return r->p_Procs->p_Copy(p, r);
    802806}
     
    805809static inline poly p_Copy(poly p, const ring r)
    806810{
    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;
    811820}
    812821
     
    824833}
    825834
    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 
    838835// returns a copy of p with Lm(p) from lmRing and Tail(p) from tailRing
    839836static inline poly p_Copy(poly p, const ring lmRing, const ring tailRing)
     
    846843#endif
    847844    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);
    849847    return pres;
    850848  }
     
    858856  assume( p!= NULL );
    859857  assume( r!= NULL );
    860   r->p_Procs->p_Delete(p, r);
     858  if ((*p)!=NULL) r->p_Procs->p_Delete(p, r);
    861859}
    862860
     
    918916  else if (n_IsZero(n, r->cf))
    919917  {
    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!
    921919    return NULL;
    922920  }
     
    10531051  if (p == NULL)
    10541052  {
    1055     r->p_Procs->p_Delete(&q, r);
     1053    p_Delete(&q, r);
    10561054    return NULL;
    10571055  }
    10581056  if (q == NULL)
    10591057  {
    1060     r->p_Procs->p_Delete(&p, r);
     1058    p_Delete(&p, r);
    10611059    return NULL;
    10621060  }
     
    10711069      q = r->p_Procs->p_Mult_mm(q, p, r);
    10721070
    1073     r->p_Procs->p_Delete(&p, r);
     1071    p_LmDelete(&p, r);
    10741072    return q;
    10751073  }
     
    10781076  {
    10791077    p = r->p_Procs->p_Mult_mm(p, q, r);
    1080     r->p_Procs->p_Delete(&q, r);
     1078    p_LmDelete(&q, r);
    10811079    return p;
    10821080  }
  • libpolys/polys/pDebug.cc

    r6cfe0d r7e29aa  
    9090    #ifndef X_OMALLOC
    9191    {
    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);
    9394      return TRUE;
    9495    }
  • libpolys/polys/sbuckets.cc

    r6cfe0d r7e29aa  
    117117  for (i=0; i<= bucket->max_bucket; i++)
    118118  {
    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);
    124120  }
    125121  omFreeBin(bucket, sBucket_bin);
Note: See TracChangeset for help on using the changeset viewer.