Changeset 8179468 in git


Ignore:
Timestamp:
Nov 21, 2012, 5:35:41 PM (10 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
e43dc39725c5d5b404d7ba9374a3c75ad9c923fb
Parents:
98b2b9136c4d2f2bb8cbfd626b15ec71f9a38552
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-11-21 17:35:41+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-11-22 20:43:02+01:00
Message:
Better forward declarations and includes for bucket-related stuff

TODO: refine?
Location:
libpolys/polys
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/kbuckets.h

    r98b2b91 r8179468  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 #include <polys/monomials/ring.h>
    7 #include <polys/templates/p_Procs.h>
    86
    97//#define HAVE_COEF_BUCKETS
     
    1513// define to not really use the bucket feature
    1614// #define HAVE_PSEUDO_BUCKETS
     15class  kBucket; typedef kBucket* kBucket_pt;
     16struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly;
     17struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring;
     18
     19#include <polys/monomials/ring.h> // for ring->p_Procs->p_kBucketSetLm!
     20#include <polys/templates/p_Procs.h> // for p_kBucketSetLm_Proc_Ptr
    1721
    1822//////////////////////////////////////////////////////////////////////////
     
    3741// i.e., afterwards Bpoly == 0
    3842void kBucketClear(kBucket_pt bucket, poly *p, int *length);
     43
    3944inline poly kBucketClear(kBucket_pt bucket)
    4045{
     
    124129///
    125130/// Bpoly == Bpoly - m*p; where m is a monom
    126 /// Does not destroy p and m
     131/// Does not destroy p and m (TODO: rename into kBucket_Minus_mm_Mult_pp!?)
    127132/// assume (*l <= 0 || pLength(p) == *l)
    128133void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l,
     
    200205// Returned monom is READ ONLY, i.e. no manipulations are allowed !!!!
    201206//
     207inline poly kBucketGetLm(kBucket_pt bucket, p_kBucketSetLm_Proc_Ptr _p_kBucketSetLm)
     208{
     209#ifdef   HAVE_COEF_BUCKETS
     210  assume(bucket->coef[0]==NULL);
     211#endif
     212
     213  poly& lead = bucket->buckets[0];
     214 
     215  if (lead == NULL)
     216    _p_kBucketSetLm(bucket);
     217
     218#ifdef  HAVE_COEF_BUCKETS
     219  assume(bucket->coef[0]==NULL);
     220#endif
     221 
     222  return lead;
     223}
     224
    202225inline poly kBucketGetLm(kBucket_pt bucket)
    203226{
    204   #ifdef   HAVE_COEF_BUCKETS
    205   assume(bucket->coef[0]==NULL);
    206   #endif
    207   if (bucket->buckets[0] == NULL)
    208     bucket->bucket_ring->p_Procs->p_kBucketSetLm(bucket);
    209   #ifdef  HAVE_COEF_BUCKETS
    210   assume(bucket->coef[0]==NULL);
    211   #endif
    212   return bucket->buckets[0];
    213 }
     227  return kBucketGetLm(bucket, bucket->bucket_ring->p_Procs->p_kBucketSetLm); // TODO: needs ring :(
     228}   
    214229
    215230inline poly kBucketExtractLm(kBucket_pt bucket)
  • libpolys/polys/nc/old.gring.cc

    r98b2b91 r8179468  
    2323
    2424# define PLURAL_INTERNAL_DECLARATIONS
    25 #include "nc/nc.h"
    26 #include "nc/sca.h"
    27 #include "nc/gb_hack.h"
    28 
    29 #include "monomials/ring.h"
     25#include "nc.h"
     26#include "sca.h"
     27#include "gb_hack.h"
     28
     29#include <polys/monomials/ring.h>
    3030   
    3131#include <coeffs/numbers.h>
    32 #include "coeffrings.h"
     32#include <polys/coeffrings.h>
    3333
    3434// #include <polys/febase.h>
    3535#include <misc/options.h>
    3636
    37 #include "monomials/ring.h"
    38 #include "monomials/p_polys.h"
    39 
    40 #include "simpleideals.h"
    41 #include "matpol.h"
    42 
    43 #include "kbuckets.h"
    44 #include "sbuckets.h"
     37#include <polys/monomials/ring.h>
     38#include <polys/monomials/p_polys.h>
     39
     40#include <polys/simpleideals.h>
     41#include <polys/matpol.h>
     42
     43#include <polys/kbuckets.h>
     44#include <polys/sbuckets.h>
    4545
    4646// #include <polys/kstd1.h>
    47 #include "prCopy.h"
    48 
    49 #include "operations/p_Mult_q.h"
     47#include <polys/prCopy.h>
     48
     49#include <polys/operations/p_Mult_q.h>
    5050// dirty tricks:
    51 #include "templates/p_MemAdd.h"
     51#include <polys/templates/p_MemAdd.h>
    5252
    5353// #include <polys/pInline1.h>
    5454
    5555
    56 
    57 #include "nc/summator.h"
    58 
    59 #include "nc/ncSAMult.h" // for CMultiplier etc classes
    60 #include "nc/ncSAFormula.h" // for CFormulaPowerMultiplier and enum Enum_ncSAType
     56#include "summator.h"
     57
     58#include "ncSAMult.h" // for CMultiplier etc classes
     59#include "ncSAFormula.h" // for CFormulaPowerMultiplier and enum Enum_ncSAType
    6160
    6261// #ifdef HAVE_RATGRING
  • libpolys/polys/nc/summator.cc

    r98b2b91 r8179468  
    1818#endif
    1919
     20#include "summator.h"
     21
     22#ifdef HAVE_SUMMATOR
     23
    2024#include "config.h"
    2125#include <misc/auxiliary.h>
    22 
    23 #ifdef HAVE_PLURAL
    2426#include <misc/options.h>
    2527
    26 #include "nc/summator.h"
    27 #include "monomials/ring.h"
    28 #include "monomials/p_polys.h"
    29 
    30 #include "sbuckets.h"
    31 
    32 
    33 CPolynomialSummator::CPolynomialSummator(ring rBaseRing, bool bUsePolynomial):
     28#include <polys/monomials/ring.h>
     29#include <polys/monomials/p_polys.h>
     30#include <polys/sbuckets.h>
     31
     32
     33
     34CPolynomialSummator::CPolynomialSummator(const ring& rBaseRing, bool bUsePolynomial):
    3435    m_basering(rBaseRing), m_bUsePolynomial(bUsePolynomial)
    3536{
     
    7879    sBucketDestroy(&m_temp.m_bucket);
    7980
     81    assume(out == NULL); // otherwise wrong usage pattern!
    8082    if(out != NULL)
    8183      p_Delete(&out, m_basering);
     
    8385  }
    8486  else
     87  {
     88    assume(m_temp.m_poly == NULL); // otherwise wrong usage pattern!   
    8589    if(m_temp.m_poly!=NULL)
    8690    {
     
    9195//      m_temp.m_poly = NULL;
    9296    }
     97  }
    9398}
    9499
     
    102107    m_temp.m_poly = p_Add_q(m_temp.m_poly, pSummand, m_basering);
    103108  else
    104     sBucket_Add_p(m_temp.m_bucket, pSummand, iLength);
     109    sBucket_Add_p(m_temp.m_bucket, pSummand, iLength); // sBucket_Merge_p???
    105110}
    106111
     
    114119    m_temp.m_poly = p_Add_q(m_temp.m_poly, pSummand, m_basering);
    115120  else
    116     sBucket_Add_p(m_temp.m_bucket, pSummand, 0);
     121    sBucket_Add_p(m_temp.m_bucket, pSummand, 0); // sBucket_Merge_p???
    117122}
    118123
     
    193198
    194199
    195 #endif
     200#endif // ifdef HAVE_SUMMATOR
  • libpolys/polys/nc/summator.h

    r98b2b91 r8179468  
    55****************************************/
    66
    7 // #include <summator.h> // for CPolynomialSummator class
     7// #include <polys/nc/summator.h> // for CPolynomialSummator class
    88
    9 #include <polys/monomials/ring.h>
    10 #include <polys/monomials/p_polys.h>
     9#define HAVE_SUMMATOR 1
     10
     11#ifdef HAVE_SUMMATOR
     12
     13// struct snumber; typedef struct snumber *   number;
     14
     15class  sBucket; typedef sBucket* sBucket_pt;
     16struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly;
     17struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring;
    1118
    1219
     20class  kBucket; typedef kBucket* kBucket_pt;
     21
     22// TODO: redesign into templates with no extra run-time cost!!!
     23// TODO: make several out of CPolynomialSummator with similar (?) usage
     24// pattern/interface!!!
     25
    1326// //////////////////////////////////////////////////////////////////////// //
    14 // CPolynomialSummator: unifies bucket and polynomial summation as the
    15 // later is brocken in buckets :(
    16 #ifdef HAVE_PLURAL
     27/// CPolynomialSummator: unifies bucket and polynomial summation as the
     28/// later is brocken in buckets :(
    1729class CPolynomialSummator
    1830{
    1931  private:
    20     ring m_basering;
    21     bool m_bUsePolynomial;
     32    const ring& m_basering;
     33    const bool m_bUsePolynomial;
    2234    union
    2335    {
    2436      sBucket_pt m_bucket;
     37//      kBucket_pt m_kbucket;
    2538      poly       m_poly;
    2639    } m_temp;
    2740  public:
    28     CPolynomialSummator(ring rBaseRing, bool bUsePolynomial = false);
     41    CPolynomialSummator(const ring& rBaseRing, bool bUsePolynomial = false);
    2942//    CPolynomialSummator(ring rBaseRing, poly pInitialSum, int iLength = 0, bool bUsePolynomial = false);
    3043    ~CPolynomialSummator();
     
    4962    /// Copy constructor
    5063    CPolynomialSummator(const CPolynomialSummator&);
    51 
    5264  private:
    5365
     
    5668};
    5769
    58 #endif
     70#endif // ifdef HAVE_SUMMATOR
    5971#endif // ifndef  SUMMATOR_H
    6072
  • libpolys/polys/operations/p_Mult_q.h

    r98b2b91 r8179468  
    1414
    1515#include <misc/auxiliary.h>
     16
     17struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly;
    1618
    1719// #include "config.h"
  • libpolys/polys/sbuckets.cc

    r98b2b91 r8179468  
    1212
    1313#include <polys/sbuckets.h>
     14
    1415#include <omalloc/omalloc.h>
    1516#include <polys/monomials/ring.h>
    1617//#include <kernel/p_Procs.h>
    17 #include <polys/monomials//p_polys.h>
     18#include <polys/monomials/p_polys.h>
    1819
    1920
  • libpolys/polys/sbuckets.h

    r98b2b91 r8179468  
    1414#define S_BUCKETS_H
    1515
    16 #include <polys/monomials/ring.h>
     16class sBucket; typedef sBucket*           sBucket_pt;
     17struct  spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly;
     18struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring;
    1719
    1820
    19 class sBucket;
    20 typedef sBucket*           sBucket_pt;
    2121//////////////////////////////////////////////////////////////////////////
    2222// Creation/Destruction of buckets
  • libpolys/polys/templates/p_Procs.h

    r98b2b91 r8179468  
    1111#ifndef P_PROCS_H
    1212#define P_PROCS_H
    13 #include <polys/monomials/ring.h>
     13
     14// #include <polys/monomials/ring.h>
    1415// #include <polys/structs.h>
     16#include <omalloc/omalloc.h>
     17
     18struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly;
     19struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring;
    1520
    1621/*------------- p_Proc stuff ----------------------*/
     
    2126typedef poly (*pp_Mult_nn_Proc_Ptr)(poly p, const number n, const ring r);
    2227typedef poly (*p_Mult_mm_Proc_Ptr)(poly p, const poly m, const ring r);
    23 typedef poly (*pp_Mult_mm_Proc_Ptr)(poly p, const poly m,
    24                                     const ring r);
     28typedef poly (*pp_Mult_mm_Proc_Ptr)(poly p, const poly m, const ring r);
    2529typedef poly (*pp_Mult_mm_Noether_Proc_Ptr)(poly p, const poly m,
    2630                                            const poly spNoether, int &ll,
Note: See TracChangeset for help on using the changeset viewer.