Changeset cb66fa in git for Singular/pInline1.h


Ignore:
Timestamp:
Sep 14, 2000, 3:04:41 PM (24 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
45f38d6f3e40e1b9a2353cf58170baec48e127c6
Parents:
cba51679f82810c5f39ae893f98c5c62821f0297
Message:
* new implementation of PDEBUG stuff


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

Legend:

Unmodified
Added
Removed
  • Singular/pInline1.h

    rcba516 rcb66fa  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline1.h,v 1.1 2000-09-12 16:01:04 obachman Exp $
     9 *  Version: $Id: pInline1.h,v 1.2 2000-09-14 13:04:38 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE1_H
    1212#define PINLINE1_H
    1313
     14#ifndef PDIV_DEBUG
    1415// define to enable debugging/statistics of pShortDivisibleBy
    1516#undef PDIV_DEBUG
     17#endif
    1618
    1719#include "mod2.h"
     
    4951#include "omalloc.h"
    5052#include "numbers.h"
    51 #include "pInline2.h"
     53#include "polys.h"
    5254#include "p_MemAdd.h"
    5355#include "p_MemCopy.h"
    54 #include "polys.h"
    5556
    5657/***************************************************************
     
    6162PINLINE1 poly p_Init(ring r)
    6263{
    63   p_CheckRing(r);
     64  p_CheckRing1(r);
    6465  poly p;
    6566  omTypeAlloc0Bin(poly, p, r->PolyBin);
     
    6970PINLINE1 poly p_Init(poly p, ring r)
    7071{
    71   p_CheckPolyRing(p, r);
     72  p_CheckPolyRing1(p, r);
    7273  poly np;
    7374  omTypeAllocBin(poly, np, r->PolyBin);
     
    8889{
    8990  if (p == NULL) return NULL;
    90   p_CheckPolyRing(p, r);
     91  p_CheckPolyRing1(p, r);
    9192  poly np;
    9293  omTypeAllocBin(poly, np, r->PolyBin);
     
    105106PINLINE1 void p_ExpVectorCopy(poly d_p, poly s_p, ring r)
    106107{
    107   p_CheckPolyRing(d_p, r);
    108   p_CheckPolyRing(s_p, r);
     108  p_CheckPolyRing1(d_p, r);
     109  p_CheckPolyRing1(s_p, r);
    109110  p_MemCopy_LengthGeneral(d_p->exp, s_p->exp, r->ExpLSize);
    110111}
     
    112113PINLINE1 void p_ExpVectorAdd(poly p1, poly p2, ring r)
    113114{
    114   p_CheckPolyRing(p1, r);
    115   p_CheckPolyRing(p2, r);
    116 #if PDEBUG >= 2
     115  p_CheckPolyRing1(p1, r);
     116  p_CheckPolyRing1(p2, r);
     117#if PDEBUG >= 1
    117118  for (int i=1; i<=r->N; i++)
    118     passume2((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
    119   passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
     119    pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
     120  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
    120121#endif
    121122 
     
    125126PINLINE1 void p_ExpVectorSub(poly p1, poly p2, ring r)
    126127{
    127   p_CheckPolyRing(p1, r);
    128   p_CheckPolyRing(p2, r);
    129 #if PDEBUG >= 2
     128  p_CheckPolyRing1(p1, r);
     129  p_CheckPolyRing1(p2, r);
     130#if PDEBUG >= 1
    130131  for (int i=1; i<=r->N; i++)
    131     passume2(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
    132   passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
     132    pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
     133  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0 ||
     134          p_GetComp(p1, r) == p_GetComp(p2, r));
    133135#endif
    134136 
     
    138140PINLINE1 void p_ExpVectorSum(poly pr, poly p1, poly p2, ring r)
    139141{
    140   p_CheckPolyRing(p1, r);
    141   p_CheckPolyRing(p2, r);
    142   p_CheckPolyRing(pr, r);
     142  p_CheckPolyRing1(p1, r);
     143  p_CheckPolyRing1(p2, r);
     144  p_CheckPolyRing1(pr, r);
     145#if PDEBUG >= 1
     146  for (int i=1; i<=r->N; i++)
     147    pAssume1((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
     148  pAssume1(p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
     149#endif 
     150
     151  p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpLSize);
     152}
     153// ExpVector(pr) = ExpVector(p1) - ExpVector(p2)
     154PINLINE1 void p_ExpVectorDiff(poly pr, poly p1, poly p2, ring r)
     155{
     156  p_CheckPolyRing1(p1, r);
     157  p_CheckPolyRing1(p2, r);
     158  p_CheckPolyRing1(pr, r);
    143159#if PDEBUG >= 2
    144160  for (int i=1; i<=r->N; i++)
    145     passume2((unsigned long) (p_GetExp(p1, i, r) + p_GetExp(p2, i, r)) <= r->bitmask);
    146   passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == 0 || p_GetComp(p2, r) == 0);
    147 #endif 
    148 
    149   p_MemSum_LengthGeneral(pr->exp, p1->exp, p2->exp, r->ExpLSize);
    150 }
    151 // ExpVector(pr) = ExpVector(p1) - ExpVector(p2)
    152 PINLINE1 void p_ExpVectorDiff(poly pr, poly p1, poly p2, ring r)
    153 {
    154   p_CheckPolyRing(p1, r);
    155   p_CheckPolyRing(p2, r);
    156   p_CheckPolyRing(pr, r);
    157 #if PDEBUG >= 2
    158   for (int i=1; i<=r->N; i++)
    159     passume2(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
    160   passume2(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
     161    pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
     162  pAssume1(!rRing_has_Comp(r) || p_GetComp(p1, r) == p_GetComp(p2, r));
    161163#endif
    162164 
     
    166168PINLINE1 BOOLEAN p_ExpVectorEqual(poly p1, poly p2, ring r)
    167169{
    168   p_CheckPolyRing(p1, r);
    169   p_CheckPolyRing(p2, r);
     170  p_CheckPolyRing1(p1, r);
     171  p_CheckPolyRing1(p2, r);
    170172 
    171173  int i = r->ExpLSize;
     
    184186PINLINE1 unsigned long p_ExpVectorQuerSum(poly p, ring r)
    185187{
    186   p_CheckPolyRing(p, r);
     188  p_CheckPolyRing1(p, r);
    187189  unsigned long s = 0;
    188190  unsigned long i = r->N;
     
    199201PINLINE1 void p_GetExpV(poly p, Exponent_t *ev, ring r)
    200202{
    201   p_CheckPolyRing(p, r);
     203  p_CheckPolyRing1(p, r);
    202204  for (int j = r->N; j; j--)
    203205      ev[j] = p_GetExp(p, j, r);
     
    207209PINLINE1 void p_SetExpV(poly p, Exponent_t *ev, ring r)
    208210{
    209   p_CheckPolyRing(p, r);
     211  p_CheckPolyRing1(p, r);
    210212  for (int j = r->N; j; j--)
    211213      p_SetExp(p, j, ev[j], r);
     
    222224PINLINE1 int p_LmCmp(poly p, poly q, ring r)
    223225{
    224   p_CheckPolyRing(p, r);
    225   p_CheckPolyRing(q, r);
     226  p_CheckPolyRing1(p, r);
     227  p_CheckPolyRing1(q, r);
    226228
    227229  p_MemCmp_LengthGeneral_OrdGeneral(p->exp, q->exp, r->pCompLSize, r->ordsgn,
     
    231233PINLINE1 BOOLEAN p_LmEqual(poly p, poly q, ring r)
    232234{
    233   p_CheckPolyRing(p, r);
    234   p_CheckPolyRing(q, r);
     235  p_CheckPolyRing1(p, r);
     236  p_CheckPolyRing1(q, r);
    235237  int i = r->ExpLSize;
    236238  unsigned long *ep = p->exp;
     
    267269{
    268270  int i=r_a->N;
    269   passume1(r_a->N == r_b->N);
     271  pAssume1(r_a->N == r_b->N);
    270272
    271273  do
     
    278280  return TRUE;
    279281}
    280 PINLINE1 BOOLEAN p_DivisibleBy2(poly a, poly b, ring r)
    281 {
    282   p_CheckPolyRing(a, r);
    283   p_CheckPolyRing(b, r);
    284   return _p_DivisibleBy2(a, b, r);
    285 }
    286 PINLINE1 BOOLEAN p_DivisibleBy1(poly a, poly b, ring r)
    287 {
    288   p_CheckPolyRing(b, r);
    289   p_CheckIf(a != NULL, p_CheckPolyRing(b, r));
     282static inline BOOLEAN _p_DivisibleBy1(poly a, poly b, ring r)
     283{
    290284  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
    291285    return _p_DivisibleBy2(a, b, r);
    292286  return FALSE;
    293287}
     288static inline BOOLEAN _p_DivisibleBy1(poly a, ring r_a, poly b, ring r_b)
     289{
     290  if (p_GetComp(a, r_a) == 0 || p_GetComp(a,r_a) == p_GetComp(b,r_b))
     291    return _p_DivisibleBy2(a, r_a, b, r_b);
     292  return FALSE;
     293}
     294
     295PINLINE1 BOOLEAN p_DivisibleBy2(poly a, poly b, ring r)
     296{
     297  p_CheckPolyRing1(a, r);
     298  p_CheckPolyRing1(b, r);
     299  return _p_DivisibleBy2(a, b, r);
     300}
     301PINLINE1 BOOLEAN p_DivisibleBy1(poly a, poly b, ring r)
     302{
     303  p_CheckPolyRing1(b, r);
     304  pIfThen1(a != NULL, p_CheckPolyRing1(b, r));
     305  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
     306    return _p_DivisibleBy2(a, b, r);
     307  return FALSE;
     308}
    294309PINLINE1 BOOLEAN p_DivisibleBy(poly a, poly b, ring r)
    295310{
    296   p_CheckPolyRing(b, r);
    297   p_CheckIf(a!=NULL, p_CheckPolyRing(a, r));
     311  p_CheckPolyRing1(b, r);
     312  pIfThen1(a!=NULL, p_CheckPolyRing1(a, r));
    298313 
    299314  if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)))
     
    305320                                    poly b, unsigned long not_sev_b, ring r)
    306321{
    307   p_CheckPolyRing(a, r);
    308   p_CheckPolyRing(b, r);
     322  p_CheckPolyRing1(a, r);
     323  p_CheckPolyRing1(b, r);
    309324#ifndef PDIV_DEBUG
    310   passume2(p_GetShortExpVector(a, r) == sev_a);
    311   passume2(p_GetShortExpVector(b, r) == ~ not_sev_b);
     325  _pPolyAssume2(p_GetShortExpVector(a, r) == sev_a, a, r);
     326  _pPolyAssume2(p_GetShortExpVector(b, r) == ~ not_sev_b, b, r);
    312327 
    313328  if (sev_a & not_sev_b)
    314329  {
    315     passume2(p_DivisibleBy2(a, b, r) == FALSE);
     330    pAssume1(p_DivisibleBy2(a, b, r) == FALSE);
    316331    return FALSE;
    317332  }
     
    319334#else
    320335  return pDebugShortDivisibleBy(a, sev_a, r, b, not_sev_b, r);
     336#endif
     337}
     338
     339PINLINE1 BOOLEAN p_ShortDivisibleBy(poly a, unsigned long sev_a, ring r_a,
     340                                    poly b, unsigned long not_sev_b, ring r_b)
     341{
     342  p_CheckPolyRing1(a, r_a);
     343  p_CheckPolyRing1(b, r_b);
     344#ifndef PDIV_DEBUG
     345  _pPolyAssume2(p_GetShortExpVector(a, r_a) == sev_a, a, r_a);
     346  _pPolyAssume2(p_GetShortExpVector(b, r_b) == ~ not_sev_b, b, r_b);
     347 
     348  if (sev_a & not_sev_b)
     349  {
     350    pAssume1(_p_DivisibleBy2(a, r_a, b, r_b) == FALSE);
     351    return FALSE;
     352  }
     353  return _p_DivisibleBy1(a, r_a, b, r_b);
     354#else
     355  return pDebugShortDivisibleBy(a, sev_a, r_a, b, not_sev_b, r_b);
    321356#endif
    322357}
Note: See TracChangeset for help on using the changeset viewer.