Changeset e44367 in git


Ignore:
Timestamp:
Jul 9, 2009, 8:56:40 AM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
2ecec2578a1e225cf98e6ae55a47d2c5df57da4a
Parents:
f7feb7574af32456270414d62231a335ffa15060
Message:
first implementation of classes Label, CPair and RuleAndShort


git-svn-id: file:///usr/local/Singular/svn/trunk@11964 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/F5cData.cc

    rf7feb7 re44367  
    22 * \file F5cData.cc
    33 * \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,
     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,
    78 * representing the labels in the F5C Algorithm. In this file the handling of
    89 * these data types is defined.
     
    2930#include "F5cLists.h"
    3031
    31 /*
    32  * CONSTRUCTOR / DESTRUCTOR of class Label
    33  */
    3432
    35 Label::Label(int* expVec)
    36 {
     33// IMPLEMENTATIONS OF METHODS OF CLASS LABEL
     34
     35
     36// constructor / destructor of class Label
     37Label::Label(unsigned int* expVec) {
    3738  m_pExpVec       = expVec;
    3839  m_nShortExpVec  = computeShortExpVec(m_pExpVec);
    3940}
    4041
    41 Label::~Label()
    42 {
     42Label::~Label() {
    4343  delete &m_nShortExpVec;
    4444  delete [] m_pExpVec;
    4545}
    4646
    47 /*
    48  * GETTER of class Label
    49  */
    50 inline int* Label::getExpVec()
    51 {
     47
     48// GETTER of class Label
     49unsigned int* Label::getExpVec() {
    5250  return m_pExpVec;
    5351}
    5452
    55 inline unsigned long Label::getShortExpVec()
    56 {
     53unsigned long Label::getShortExpVec() {
    5754  return m_nShortExpVec;
    5855}
    5956
    60 /*
    61  * SETTER of class Label
    62  */
     57
     58// SETTER of class Label
    6359
    6460
    65 /*
    66  * MISC of class Label
    67  */
    68 inline unsigned long Label::computeShortExpVec(int* expVec)
    69 {
     61// MISC of class Label
     62unsigned long Label::computeShortExpVec(unsigned int* expVec) {
    7063  //if (p == NULL) return 0;
    7164  unsigned long ev = 0; // short exponent vector
     
    7467  unsigned int i = 0, j=1;
    7568
    76   if (n == 0)
    77   {
    78     if (currRing->N <2*BIT_SIZEOF_LONG)
    79     {
     69  if (n == 0) {
     70    if (currRing->N <2*BIT_SIZEOF_LONG) {
    8071      n=1;
    8172      m1=0;
    8273    }
    83     else
    84     {
    85       for (; j<=(unsigned long) currRing->N; j++)
    86       {
     74    else {
     75      for (; j<=(unsigned long) currRing->N; j++) {
    8776        if (expVec[j] > 0) i++;
    8877        if (i == BIT_SIZEOF_LONG) break;
     
    9382    }
    9483  }
    95   else
    96   {
     84  else {
    9785    m1 = (n+1)*(BIT_SIZEOF_LONG - n*currRing->N);
    9886  }
    9987
    10088  n++;
    101   while (i<m1)
    102   {
     89  while (i<m1) {
    10390    ev |= getBitFields(expVec[j], i, n);
    10491    i += n;
     
    10794
    10895  n--;
    109   while (i<BIT_SIZEOF_LONG)
    110   {
     96  while (i<BIT_SIZEOF_LONG) {
    11197    ev |= getBitFields(expVec[j], i, n);
    11298    i += n;
     
    116102}
    117103
    118 inline unsigned long Label::getBitFields(int e, unsigned int s, unsigned int n)
    119 {
     104unsigned long Label::getBitFields(unsigned int e, unsigned int s, unsigned int n) {
    120105#define Sy_bit_L(x)     (((unsigned long)1L)<<(x))
    121106  unsigned int i = 0;
    122107  unsigned long  ev = 0L;
    123108  assume(n > 0 && s < BIT_SIZEOF_LONG);
    124   do
    125   {
     109  do {
    126110    assume(s+i < BIT_SIZEOF_LONG);
    127111    if (e > (int) i) ev |= Sy_bit_L(s+i);
     
    133117}
    134118
    135 
     119// END IMPLEMENTATIONS OF METHODS OF CLASS LABEL
    136120
    137121#endif
  • kernel/F5cData.h

    rf7feb7 re44367  
    2121class CPair;
    2222class Label;
    23 
     23class PolyAndShort;
    2424
    2525/*!
     
    3434  public:
    3535
    36 };
    37 // end CPair
     36}; // end CPair
    3837
    3938
     
    4746class Label {
    4847  private:
    49     int*              m_pExpVec;
    50     unsigned long     m_nShortExpVec;
     48    unsigned int* m_pExpVec;
     49    unsigned long m_nShortExpVec;
    5150  public:
    5251    /*!
     
    5554     * \brief Constructor of an object of class \c Label
    5655     */
    57     Label(int* expVec);
     56    Label(unsigned int* expVec);
    5857    /*!
    5958     * \fn ~Label();
     
    6665     * \brief Getter of the \c integer vector at the address \c m_pExpVec
    6766     */
    68     inline int* getExpVec();
     67    inline unsigned int* getExpVec();
    6968    /*!
    7069     * \fn static inline long getShortExpVec();
     
    7372     *
    7473     */
    75     inline unsigned long getShortExpVec();
     74    inline unsigned long getShortExpVec(); 
    7675    /*!
    7776     * \fn static inline unsigned long computeShortExpVec(int* expVec);
     
    8483     * polys as input data.
    8584     */
    86     static inline unsigned long computeShortExpVec(int* expVec);
     85    inline unsigned long computeShortExpVec(unsigned int* expVec);
    8786    /*!
    8887     * \fn static inline unsigned long getBitFields(int e, unsigned int s,
     
    102101     * polys as input data.
    103102     */
    104     static inline unsigned long getBitFields(int e, unsigned int s, unsigned int n);
    105 };
    106 // end Label
     103    inline unsigned long getBitFields(unsigned int e, unsigned int s, unsigned int n);
     104}; // end Label
    107105
     106/*!
     107 * \class PolyAndShort
     108 * \author Christian Eder
     109 * \brief This is the data structure of a polynomial together with the short
     110 * exponent vector of its leading monomial in F5C
     111 * \details
     112 */
     113class PolyAndShort {
     114  private:
     115    poly          m_poly;
     116    unsigned long m_nShortExpVec;
     117  public:
     118    /*!
     119     * \fn PolyAndShort(poly p);
     120     * \param[in] p The polynomial to be stored
     121     * \brief Constructor of an object of class \c PolyAndShort
     122     * \details Constructor of an object of class \c PolyAndShort used when
     123     * inserting an element generating the input ideal \c I of the F5C Algorithm
     124     */
     125    PolyAndShort(poly p);
     126    /*!
     127     * \fn ~Label();
     128     * \brief Destructor of an object of class \c Label
     129     */
     130    ~PolyAndShort();
     131    /*!
     132     * \fn static inline int getExpVec();
     133     * \return The first entry of the \c integer vector at the address \c m_pExpVec
     134     * \brief Getter of the \c integer vector at the address \c m_pExpVec
     135     */
     136    inline unsigned int* getExpVec();
     137    /*!
     138     * \fn static inline long getShortExpVec();
     139     * \return The short exponent vector \c m_nShortExpVec of the label
     140     * \brief Getter of the \code unsigned long m_nShortExpVec \endcode
     141     *
     142     */
     143
     144}; // end LPoly
    108145#endif
    109146// HAVE_F5C
  • kernel/f5c.cc

    rf7feb7 re44367  
    2626*/
    2727ideal f5cMain(ideal id, ring r) {
    28     return id;
     28  Print("SHORT EXP VECTOR 1:  %ld\n", pGetShortExpVector(id->m[0]));
     29  int* expVec   = new int[(r->N)+1];
     30  pGetExpV(id->m[0],expVec);
     31  Print("EXP VECTOR 1: %d\n",expVec[1]);
     32  Label* label  = new Label(expVec);
     33  Print("EXP VECTOR 2: %d\n", label->getExpVec()[1]);
     34  Print("SHORT EXP VECTOR 2:  %ld\n", label->getShortExpVec());
     35  //Print("%ld\n", label->computeShortExpVec(expVec));
     36  Print("SHORT EXP VECTOR 1:  %ld\n", pGetShortExpVector(id->m[1]));
     37  //int* expVec   = new int[(r->N)+1];
     38  pGetExpV(id->m[1],expVec);
     39  Print("EXP VECTOR 1: %d\n",expVec[1]);
     40  Label* label2  = new Label(expVec);
     41  Print("EXP VECTOR 2: %d\n", label2->getExpVec()[1]);
     42  Print("SHORT EXP VECTOR 2:  %ld\n", label2->getShortExpVec());
     43
     44  return id;
    2945}
    3046
  • kernel/f5c.h

    rf7feb7 re44367  
    1616
    1717#endif
     18// HAVE_F5C
    1819#endif
    1920// F5C_HEADER
Note: See TracChangeset for help on using the changeset viewer.