Changeset b7e5d0 in git


Ignore:
Timestamp:
Oct 3, 2012, 2:43:02 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
e2207eba351aca1bc6ad9378cbc90bce52ff1fc3
Parents:
65b813a15472ad024e1b30ff11d4f966ec98b53a
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2012-10-03 14:43:02+02:00
git-committer:
Martin Lee <martinlee84@web.de>2013-01-23 11:27:17+01:00
Message:
fix: primeFactorization: bound
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/misc_ip.cc

    r65b813 rb7e5d0  
    6969}
    7070
    71 
    7271/* Factoring with Pollard's rho method. stolen from GMP/demos */
    7372static unsigned add[] = {4, 2, 4, 2, 4, 6, 2, 6};
    7473
    75 int factor_using_division (mpz_t t, unsigned int limit,lists primes, int *multiplicities,int &index, unsigned long bound)
     74static int factor_using_division (mpz_t t, unsigned int limit,lists primes, int *multiplicities,int &index, unsigned long bound)
    7675{
    7776  mpz_t q, r;
     
    167166}
    168167
    169 void factor_using_pollard_rho (mpz_t n, unsigned long a, lists primes, int * multiplicities,int &index)
     168static void factor_using_pollard_rho (mpz_t n, unsigned long a, lists primes, int * multiplicities,int &index)
    170169{
    171170  mpz_t x, x1, y, P;
     
    284283}
    285284
    286 void factor (mpz_t t,lists primes,int *multiplicities,int &index,unsigned long bound)
     285static void factor_gmp (mpz_t t,lists primes,int *multiplicities,int &index,unsigned long bound)
    287286{
    288287  unsigned int division_limit;
     
    306305        setListEntry(primes, index, t);
    307306        multiplicities[index++] = 1;
    308         mpz_set_ui(t,1);
     307        mpz_set_ui(t,1);
    309308      }
    310309      else
     
    330329      mpz_neg(nn,nn);
    331330    }
    332     factor(nn,primes,multiplicities,index,pBound);
     331    factor_gmp(nn,primes,multiplicities,index,pBound);
    333332  }
    334333
     
    350349    multiplicitiesL->m[i].data = (void*)multiplicities[i];
    351350  }
    352   delete[] multiplicities;
     351  omFree(multiplicities);
    353352
    354353  lists L=(lists)omAllocBin(slists_bin);
Note: See TracChangeset for help on using the changeset viewer.