source: git/kernel/F5cData.cc @ 9e8da7

spielwiese
Last change on this file since 9e8da7 was 599326, checked in by Kai Krüger <krueger@…>, 14 years ago
Anne, Kai, Frank: - changes to #include "..." statements to allow cleaner build structure - affected directories: omalloc, kernel, Singular - not yet done: IntergerProgramming git-svn-id: file:///usr/local/Singular/svn/trunk@13032 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*!
2 * \file F5cData.cc
3 * \author Christian Eder
4 * \brief This file includes the inlined methods of the classes \c CPair
5 * and \c Label.
6 * \details This file includes the inlined methods of the class \c CPair,
7 * representing critical pairs in the F5C Algorithm, and the class \c Label,
8 * representing the labels in the F5C Algorithm. In this file the handling of
9 * these data types is defined.
10 */
11
12#include <kernel/mod2.h>
13
14#ifdef HAVE_F5C
15#include <kernel/kutil.h>
16#include <kernel/structs.h>
17#include <omalloc.h>
18#include <kernel/polys.h>
19#include <kernel/p_polys.h>
20#include <kernel/ideals.h>
21#include <kernel/febase.h>
22#include <kernel/kstd1.h>
23#include <kernel/khstd.h>
24#include <kernel/kbuckets.h>
25#include <kernel/weight.h>
26#include <kernel/intvec.h>
27#include <kernel/pInline1.h>
28#include <kernel/f5c.h>
29#include <kernel/F5cData.h>
30#include <kernel/F5cLists.h>
31
32
33// IMPLEMENTATIONS OF METHODS OF CLASS LABEL
34
35
36// constructor / destructor of class Label
37Label::Label(int* expVec) {
38  m_pExpVec       = expVec;
39  m_nShortExpVec  = computeShortExpVec(m_pExpVec);
40}
41
42Label::~Label() {
43  delete &m_nShortExpVec;
44  delete [] m_pExpVec;
45}
46
47
48
49// MISC of class Label
50unsigned long Label::computeShortExpVec(int* expVec) {
51  //if (p == NULL) return 0;
52  unsigned long ev = 0; // short exponent vector
53  unsigned int n = BIT_SIZEOF_LONG / currRing->N; // number of bits per exp
54  unsigned int m1; // highest bit which is filled with (n+1)
55  unsigned int i = 0, j=1;
56
57  if (n == 0) {
58    if (currRing->N <2*BIT_SIZEOF_LONG) {
59      n=1;
60      m1=0;
61    }
62    else {
63      for (; j<=(unsigned long) currRing->N; j++) {
64        if (expVec[j] > 0) i++;
65        if (i == BIT_SIZEOF_LONG) break;
66      }
67      if (i>0)
68      ev = ~((unsigned long)0) >> ((unsigned long) (BIT_SIZEOF_LONG - i));
69      return ev;
70    }
71  }
72  else {
73    m1 = (n+1)*(BIT_SIZEOF_LONG - n*currRing->N);
74  }
75
76  n++;
77  while (i<m1) {
78    ev |= getBitFields(expVec[j], i, n);
79    i += n;
80    j++;
81  }
82
83  n--;
84  while (i<BIT_SIZEOF_LONG) {
85    ev |= getBitFields(expVec[j], i, n);
86    i += n;
87    j++;
88  }
89  return ev;
90}
91
92unsigned long Label::getBitFields(int e, unsigned int s, unsigned int n) {
93#define Sy_bit_L(x)     (((unsigned long)1L)<<(x))
94  unsigned int i = 0;
95  unsigned long  ev = 0L;
96  assume(n > 0 && s < BIT_SIZEOF_LONG);
97  do {
98    assume(s+i < BIT_SIZEOF_LONG);
99    if (e > (int) i) ev |= Sy_bit_L(s+i);
100    else break;
101    i++;
102  }
103  while (i < n);
104  return ev;
105}
106
107// END IMPLEMENTATIONS OF METHODS OF CLASS LABEL
108
109#endif
110// HAVE_F5C
Note: See TracBrowser for help on using the repository browser.