Changeset 642e65 in git for kernel/F5cData.cc


Ignore:
Timestamp:
Jul 7, 2009, 8:54:56 PM (14 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
ab3db62fd566bf974e5dcf6da2405b18b464b0c4
Parents:
e9f5b23f3e4572bcb33e40a8f5debc2ca9bd11a6
Message:
implementation of classes Label and CPair in F5cData.*


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

Legend:

Unmodified
Added
Removed
  • kernel/F5cData.cc

    re9f5b2 r642e65  
     1/*!
     2 * \file F5cData.cc
     3 * \author Christian Eder
     4 * \brief This file includes the inlined methods of the classes CPair and Rule.
     5 * \details This file include the inlined methods of the class CPair,
     6 * representing critical pairs in the F5C Algorithm, and the class Rule,
     7 * representing the labels in the F5C Algorithm. In this file the handling of
     8 * these data types is defined.
     9 */
     10
    111#include "mod2.h"
    212
     
    1828#include "F5cData.h"
    1929#include "F5cLists.h"
     30
    2031/*
    21 =====================
    22 everything is inlined
    23 =====================
    24 */
     32 * CONSTRUCTOR / DESTRUCTOR of class Label
     33 */
     34
     35Label::Label(int* expVec)
     36{
     37  m_pExpVec       = expVec;
     38  m_nShortExpVec  = computeShortExpVec(m_pExpVec);
     39}
     40
     41Label::~Label()
     42{
     43  delete &m_nShortExpVec;
     44  delete [] m_pExpVec;
     45}
     46
     47/*
     48 * GETTER of class Label
     49 */
     50inline int* Label::getExpVec()
     51{
     52  return m_pExpVec;
     53}
     54
     55inline unsigned long Label::getShortExpVec()
     56{
     57  return m_nShortExpVec;
     58}
     59
     60/*
     61 * SETTER of class Label
     62 */
     63
     64
     65/*
     66 * MISC of class Label
     67 */
     68inline unsigned long Label::computeShortExpVec(int* expVec)
     69{
     70  //if (p == NULL) return 0;
     71  unsigned long ev = 0; // short exponent vector
     72  unsigned int n = BIT_SIZEOF_LONG / currRing->N; // number of bits per exp
     73  unsigned int m1; // highest bit which is filled with (n+1)
     74  unsigned int i = 0, j=1;
     75
     76  if (n == 0)
     77  {
     78    if (currRing->N <2*BIT_SIZEOF_LONG)
     79    {
     80      n=1;
     81      m1=0;
     82    }
     83    else
     84    {
     85      for (; j<=(unsigned long) currRing->N; j++)
     86      {
     87        if (expVec[j] > 0) i++;
     88        if (i == BIT_SIZEOF_LONG) break;
     89      }
     90      if (i>0)
     91      ev = ~((unsigned long)0) >> ((unsigned long) (BIT_SIZEOF_LONG - i));
     92      return ev;
     93    }
     94  }
     95  else
     96  {
     97    m1 = (n+1)*(BIT_SIZEOF_LONG - n*currRing->N);
     98  }
     99
     100  n++;
     101  while (i<m1)
     102  {
     103    ev |= getBitFields(expVec[j], i, n);
     104    i += n;
     105    j++;
     106  }
     107
     108  n--;
     109  while (i<BIT_SIZEOF_LONG)
     110  {
     111    ev |= getBitFields(expVec[j], i, n);
     112    i += n;
     113    j++;
     114  }
     115  return ev;
     116}
     117
     118inline unsigned long Label::getBitFields(int e, unsigned int s, unsigned int n)
     119{
     120#define Sy_bit_L(x)     (((unsigned long)1L)<<(x))
     121  unsigned int i = 0;
     122  unsigned long  ev = 0L;
     123  assume(n > 0 && s < BIT_SIZEOF_LONG);
     124  do
     125  {
     126    assume(s+i < BIT_SIZEOF_LONG);
     127    if (e > (int) i) ev |= Sy_bit_L(s+i);
     128    else break;
     129    i++;
     130  }
     131  while (i < n);
     132  return ev;
     133}
     134
     135
     136
    25137#endif
    26 // HAVE_F5c
     138// HAVE_F5C
Note: See TracChangeset for help on using the changeset viewer.