Changeset 38f32d in git for Singular/misc_ip.cc


Ignore:
Timestamp:
Jul 13, 2010, 4:08:38 PM (14 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
512f05c5a1ab245e49d1b2471320fe775eba0d43
Parents:
2545e05be20341593d047f69dc1f2f4d599ec80f
Message:
primefactors

git-svn-id: file:///usr/local/Singular/svn/trunk@12999 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/misc_ip.cc

    r2545e0 r38f32d  
    282282  {
    283283    mpz_tdiv_qr_ui (q, r, t, 3);
    284     if (mpz_cmp_ui (r, 0) != 0) break;
     284    if (mpz_cmp_ui (r, 0) != 0)  break;
    285285    mpz_set (t, q);
    286286    if ((L_ind>0) && (L[L_ind-1]==3)) ex[L_ind-1]++;
     
    323323    {
    324324      mpz_swap (t, q);
     325      //gmp_printf("%d: %Zd\n",f,t);
    325326      // here: f in 0,,2^28-1:
    326327      if ((L_ind>0) && (L[L_ind-1]==(int)f)) ex[L_ind-1]++;
     
    463464  if (mpz_cmp_ui (t, 1) != 0)
    464465  {
    465     if (mpz_probab_prime_p (t, 3))
    466     {
    467       if ((L_ind>0) && (mpz_cmp_si(t,L[L_ind-1])==0))
    468       {
    469         ex[L_ind-1]++;
    470       }
    471       else
     466    if (mpz_probab_prime_p (t, 10))
     467    {
     468      int tt=mpz_get_si(t);
     469      // check if t fits into int:
     470      if ((mpz_size1(t)==1)&&(mpz_cmp_si(t,tt)==0))
    472471      {
    473472        L[L_ind]=mpz_get_si(t);
    474473        L_ind++;
    475       }
    476       mpz_set_si(t,1);
     474        mpz_set_si(t,1);
     475      }
    477476    }
    478477    else
     
    496495  else
    497496  {
    498     mpz_init_set(t,(mpz_ptr)nn);
     497    mpz_init_set(t,(mpz_ptr)nn->z);
    499498  }
    500499  int *LL=(int*)omAlloc0(1000*sizeof(int));
     
    504503
    505504  nnAsInt = mpz_get_si(t);
    506   nlDelete(&nn,NULL);
    507   if (mpz_cmp_si(t,nnAsInt)==0)
    508   {
     505  if ((mpz_size1(t)==1) && (mpz_cmp_si(t,nnAsInt)==0))
     506  {
     507    nlDelete(&nn,NULL);
    509508    L->m[0].rtyp = INT_CMD;
    510509    L->m[0].data = (void *)nnAsInt;
     
    512511  else
    513512  {
     513    mpz_set(nn->z,t);
    514514    L->m[0].rtyp = BIGINT_CMD;
    515     L->m[0].data = (void *)t;
    516   }
     515    L->m[0].data = (void *)nn;
     516  }
     517  mpz_clear(t);
    517518  int i;
    518519  for(i=0;i<L_ind;i++) ex[i]++;
Note: See TracChangeset for help on using the changeset viewer.