Ignore:
Timestamp:
Jul 17, 2012, 8:05:19 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'c987db42cd2ec943b97ac5746c99892ceddf909c')
Children:
98474f69bc5c570dd7cb85f5f8a0b2164abccb91
Parents:
644f813f8a73f38c6448af263a3ee11e37731a67
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-17 20:05:19+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-17 21:33:55+02:00
Message:
improved (standalone!) header for polynomials (polys/monomials/monomials.h)

chg: moved the basic primitives for accessing and setting fields of a poly from p_polys.h into monomials.h
NOTE: these basic functions either do NOT need a ring or are macros (or both)

chg: no need to include coeffs/coeffs.h and polys/monomials/ring.h in polys/monomials/monomials.h
NOTE: just forward-declare structures and typedef pointers at them.

chg: minor cleanup of includes in p_polys.cc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/monomials.h

    r644f81 r805d0b1  
    1010
    1111#include <omalloc/omalloc.h>
    12 #include <coeffs/coeffs.h>
    13 #include <polys/monomials/ring.h>
     12
     13struct snumber;
     14typedef struct snumber *   number;
     15
     16struct ip_sring;
     17typedef struct ip_sring *         ring;
     18typedef struct ip_sring const *   const_ring;
    1419
    1520/***************************************************************
     
    2126struct spolyrec;
    2227typedef struct spolyrec *          poly;
     28
    2329struct  spolyrec
    2430{
     
    2733  unsigned long exp[1];     // make sure that exp is aligned
    2834};
     35
     36/***************************************************************
     37 *
     38 * Primitives for accessing and setting fields of a poly
     39 * poly must be != NULL
     40 *
     41 ***************************************************************/
     42// next
     43#define pNext(p)            ((p)->next)
     44#define pIter(p)            ((p) = (p)->next)
     45
     46// coeff
     47// #define pGetCoeff(p)        ((p)->coef)
     48/// return an alias to the leading coefficient of p
     49/// assumes that p != NULL
     50/// NOTE: not copy
     51static inline number& pGetCoeff(poly p)
     52{
     53  assume(p != NULL);
     54  return p->coef;
     55}
     56
     57#define p_GetCoeff(p,r)     pGetCoeff(p)
     58//static inline number& p_GetCoeff(poly p, const ring r)
     59//{
     60//  assume(r != NULL);
     61//  return pGetCoeff(p);
     62//}
     63
     64
     65//
     66// deletes old coeff before setting the new one???
     67#define pSetCoeff0(p,n)     (p)->coef=(n)
     68#define p_SetCoeff0(p,n,r)  pSetCoeff0(p,n)
     69
     70
     71#define __p_GetComp(p, r)   (p)->exp[r->pCompIndex]
     72#define p_GetComp(p, r)    ((long) (r->pCompIndex >= 0 ? __p_GetComp(p, r) : 0))
     73
    2974
    3075/***************************************************************
Note: See TracChangeset for help on using the changeset viewer.