Changeset 00f64a in git


Ignore:
Timestamp:
Apr 28, 2014, 8:51:02 PM (10 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '6e5adcba05493683b94648c659a729c189812c77')
Children:
443b19314835facbdbe5cfa061a4c8b9e5f9dfe5
Parents:
14814e396e2e71a6313759aa91824d349e14bb30
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-04-28 20:51:02+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-04-30 17:09:44+02:00
Message:
p_GetShortExpVector for products (in order to avoid the actual multiplication)
Location:
libpolys/polys/monomials
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.cc

    r14814e3 r00f64a  
    46204620}
    46214621
     4622
     4623unsigned long p_GetShortExpVector(const poly p, const poly pp, const ring r)
     4624{
     4625  assume(p != NULL);
     4626  assume(pp != NULL);
     4627  if (p == NULL || pp == NULL) return 0;
     4628 
     4629  unsigned long ev = 0; // short exponent vector
     4630  unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp
     4631  unsigned int m1; // highest bit which is filled with (n+1)
     4632  unsigned int i = 0, j=1;
     4633
     4634  if (n == 0)
     4635  {
     4636    if (r->N <2*BIT_SIZEOF_LONG)
     4637    {
     4638      n=1;
     4639      m1=0;
     4640    }
     4641    else
     4642    {
     4643      for (; j<=(unsigned long) r->N; j++)
     4644      {
     4645        if (p_GetExp(p,j,r) > 0 || p_GetExp(pp,j,r) > 0) i++;
     4646        if (i == BIT_SIZEOF_LONG) break;
     4647      }
     4648      if (i>0)
     4649        ev = ~((unsigned long)0) >> ((unsigned long) (BIT_SIZEOF_LONG - i));
     4650      return ev;
     4651    }
     4652  }
     4653  else
     4654  {
     4655    m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);
     4656  }
     4657
     4658  n++;
     4659  while (i<m1)
     4660  {
     4661    ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
     4662    i += n;
     4663    j++;
     4664  }
     4665
     4666  n--;
     4667  while (i<BIT_SIZEOF_LONG)
     4668  {
     4669    ev |= GetBitFields(p_GetExp(p, j,r) + p_GetExp(pp, j,r), i, n);
     4670    i += n;
     4671    j++;
     4672  }
     4673  return ev;
     4674}
     4675
     4676
     4677
    46224678/***************************************************************
    46234679 *
  • libpolys/polys/monomials/p_polys.h

    r14814e3 r00f64a  
    5252 ***************************************************************/
    5353unsigned long p_GetShortExpVector(poly a, const ring r);
     54
     55/// p_GetShortExpVector of p * pp
     56unsigned long p_GetShortExpVector(const poly p, const poly pp, const ring r);
    5457
    5558#ifdef HAVE_RINGS
Note: See TracChangeset for help on using the changeset viewer.