Changeset 1b816a3 in git


Ignore:
Timestamp:
Jul 6, 2010, 2:35:39 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
a23b2107d8a272d2243292dc7d9703920aa2bd55
Parents:
208cd5146dbce262234140fd61a3065eb0660935
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-07-06 14:35:39+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:22+01:00
Message:
p_Divide, p_DivideM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • coeffs/coeffs.h

    r208cd5 r1b816a3  
    261261static inline BOOLEAN n_GreaterZero(number n, const coeffs r){ return (r)->cfGreaterZero(n,r); }
    262262// cfGreater?
     263#ifdef HAVE_RINGS
     264static inline BOOLEAN n_IsUnit(number n, const coeffs r) { return r->cfIsUnit(n,r); }
     265#endif
    263266
    264267/// init with an integer
  • polys/monomials/p_polys.cc

    r208cd5 r1b816a3  
    1111
    1212
    13 #include <kernel/mod2.h>
    14 
    15 #include <kernel/structs.h>
    16 #include <kernel/p_polys.h>
    17 #include <kernel/ring.h>
    18 #include <kernel/ideals.h>
    19 #include <kernel/int64vec.h>
     13#include <auxialiary.h>
     14
     15#include "ring.h"
     16#include "p_polys.h"
     17#include "ring.h"
     18#include "ideals.h"
     19#include "int64vec.h"
    2020#ifndef NDEBUG
    2121#include <kernel/febase.h>
     
    230230            }
    231231          }
    232 #endif
    233            
    234 #ifndef NDEBUG
    235232#if MYTEST
    236           PrintS("Initial Value: "); p_DebugPrint(p, r, r, 1);
     233//          if( p->exp[o->data.isTemp.start] > 0 )
     234//          {
     235//            PrintS("Initial Value: "); p_DebugPrint(p, r, r, 1);
     236//          }
    237237#endif
    238238#endif
     
    272272
    273273            const poly pp = F->m[c]; // get reference monomial!!!
    274 
    275274
    276275#ifndef NDEBUG
     
    326325            // TODO: how to check this for computed values???
    327326#endif
    328 #ifndef NDEBUG
    329 #if MYTEST
    330             PrintS("IS::Suffix::Result: "); // p_Write(p, r, r);
    331             p_DebugPrint(p, r, r, 1);
    332 #endif
    333 #endif
    334 
    335327          } else
    336328          {
  • polys/monomials/ring.cc

    r208cd5 r1b816a3  
    1010/* includes */
    1111#include <math.h>
    12 #include <kernel/mod2.h>
    13 
    14 #include <kernel/options.h>
    15 #include <omalloc/omalloc.h>
    16 #include <kernel/polys.h>
    17 #include <kernel/numbers.h>
    18 #include <kernel/febase.h>
    19 #include <kernel/intvec.h>
    20 #include <kernel/longtrans.h>
    21 #include <kernel/ffields.h>
    22 #include <kernel/ideals.h>
    23 #include <kernel/ring.h>
    24 #include <kernel/prCopy.h>
    25 #include <Singular/ipshell.h>
    26 #include <kernel/p_Procs.h>
     12#include "options.h"
     13#include "omalloc.h"
     14#include "polys.h"
     15#include "numbers.h"
     16#include "febase.h"
     17#include "intvec.h"
     18#include "longalg.h"
     19#include "longtrans.h"
     20#include "ffields.h"
     21#include "ideals.h"
     22#include "ring.h"
     23#include "prCopy.h"
     24#include "../Singular/ipshell.h"
     25#include "p_Procs.h"
    2726#ifdef HAVE_PLURAL
    28 #include <kernel/gring.h>
    29 #include <kernel/sca.h>
    30 #endif
    31 #include <kernel/maps.h>
    32 #include <kernel/matpol.h>
     27#include <gring.h>
     28#include <sca.h>
     29#endif
     30#include <maps.h>
     31#include <matpol.h>
    3332#ifdef HAVE_FACTORY
    3433#define SI_DONT_HAVE_GLOBAL_VARS
    35 #  include <factory/factory.h>
     34#  include <factory.h>
    3635#endif
    3736
     
    25002499  prev_ord=-1;
    25012500  place++;
    2502 
    2503 #if MYTEST
    2504   Print("rO_ISPrefix: place = %d, v: {", ord_struct.data.isTemp.start);
    2505 
    2506   for( int i = 0; i <= N; i++ )
    2507     Print("v[%d]: %09x", i, ord_struct.data.isTemp.pVarOffset[i]);
    2508 
    2509   PrintS("}!\n");
    2510 #endif
    25112501}
    25122502static void rO_ISSuffix(int &place, int &bitplace, int &prev_ord, long *o,
    25132503  int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
    25142504{
    2515 #if MYTEST
    2516   Print("rO_ISSuffix: place = %d\n", place);
    2517 #endif
    25182505
    25192506  // Let's find previous prefix:
     
    25532540
    25542541
    2555 #if MYTEST
    2556   PrintS("Changes in v: { ");
    2557 #endif
    2558 
    25592542  for( int i = 0; i <= N; i++ ) // Note [0] == component !!! No Skip?
    25602543  {
     
    25652548      v[i] = -1; // Undo!
    25662549      assume( pVarOffset[i] != -1 );
    2567 #if MYTEST
    2568       Print("v[%d]: %010x; ", i, pVarOffset[i]);
    2569 #endif
    25702550    }
    25712551    else
     
    25762556    pVarOffset[0] &= 0x0fff;
    25772557
    2578 #if MYTEST
    2579   PrintS(" }!\n");
    2580 #endif
    25812558  sro_ord &ord_struct = tmp_typ[typ_j];
    25822559
     
    41214098      Print("  start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
    41224099
    4123 #ifndef NDEBUG
    4124       for( int k = 0; k <= r->N; k++)
    4125         if (r->typ[j].data.isTemp.pVarOffset[k] != -1)
    4126           Print("[%2d]: %09x; ", k, r->typ[j].data.isTemp.pVarOffset[k]);
    4127 #endif
    41284100    }
    41294101    else if (r->typ[j].ord_typ==ro_is)
     
    44144386ring rCurrRingAssure_SyzComp()
    44154387{
    4416 #if MYTEST
    4417   PrintS("rCurrRingAssure_SyzComp(), currRing:  \n");
    4418   rWrite(currRing);
    4419 #ifdef RDEBUG
    4420   rDebugPrint(currRing);
    4421 #endif
    4422   PrintLn();
    4423 #endif
    4424 
    44254388  ring r = rAssure_SyzComp(currRing, TRUE);
    44264389
     
    44294392    rChangeCurrRing(r);
    44304393    assume(currRing == r);
    4431 
    4432 #if MYTEST
    4433   PrintS("\nrCurrRingAssure_SyzComp(): new currRing: \n");
    4434   rWrite(currRing);
    4435 #ifdef RDEBUG
    4436   rDebugPrint(currRing);
    4437 #endif
    4438   PrintLn();
    4439 #endif
    44404394  }
    44414395
     
    44964450#ifdef HAVE_PLURAL
    44974451    ring old_ring = r;
    4498 
    4499 #if MYTEST
    4500     PrintS("rCurrRingAssure_SyzComp(): temp r': ");
    4501     rWrite(r);
    4502 #ifdef RDEBUG
    4503     rDebugPrint(r);
    4504 #endif
    4505     PrintLn();
    4506 #endif
    4507 #endif
    4508 
     4452#endif
    45094453
    45104454    if (r->qideal!=NULL)
     
    45314475    assume(ncRingType(res) == ncRingType(old_ring));
    45324476#endif
    4533 
    4534 #if MYTEST
    4535     PrintS("rCurrRingAssure_SyzComp(): res: ");
    4536     rWrite(r);
    4537 #ifdef RDEBUG
    4538     rDebugPrint(r);
    4539 #endif
    4540     PrintLn();
    4541 #endif
    4542 
    45434477  }
    45444478
     
    49474881    rComplete(res, 1);
    49484882
    4949 #if MYTEST
    4950     PrintS("rAssure_InducedSchreyerOrdering(): temp res: ");
    4951     rWrite(res);
    4952 #ifdef RDEBUG
    4953     rDebugPrint(res);
    4954 #endif
    4955     PrintLn();
    4956 #endif
    4957 
    49584883#ifdef HAVE_PLURAL
    49594884    if (rIsPluralRing(r))
     
    49724897#ifdef HAVE_PLURAL
    49734898    ring old_ring = r;
    4974 
    4975 #if MYTEST
    4976     PrintS("rAssure_InducedSchreyerOrdering(): temp nc res: ");
    4977     rWrite(res);
    4978 #ifdef RDEBUG
    4979     rDebugPrint(res);
    4980 #endif
    4981     PrintLn();
    4982 #endif
    49834899#endif
    49844900
     
    50674983{
    50684984  // Put the reference set F into the ring -ordering -recor
    5069 #if MYTEST
    5070   Print("rSetISReference(F, i: %d, p: %d, w)\nF:", i, p);
    5071   idShow(F, r, r, 1); // currRing!
    5072   PrintLn();
    5073   PrintS("w: ");
    5074   if(componentWeights == NULL)
    5075     PrintS("NULL\n");
    5076   else
    5077     componentWeights->show();
    5078 #endif
    50794985
    50804986  // TEST THAT THERE ARE DEGs!!!
  • polys/polys.cc

    r208cd5 r1b816a3  
    1212#include <string.h>
    1313#include <ctype.h>
    14 #include <kernel/mod2.h>
    15 #include <kernel/options.h>
    16 #include <omalloc/omalloc.h>
    17 #include <kernel/febase.h>
    18 #include <kernel/numbers.h>
    19 #include <kernel/polys.h>
    20 #include <kernel/ring.h>
    21 #include <kernel/sbuckets.h>
     14#include <auxiliary.h>
     15#include "options.h"
     16#include "omalloc.h"
     17#include "reporter.h"
     18#include "numbers.h"
     19#include "polys.h"
     20#include "ring.h"
    2221
    2322#ifdef HAVE_PLURAL
    24 #include <kernel/gring.h>
    25 #include <kernel/sca.h>
     23#include <gring.h>
     24#include <sca.h>
    2625#endif
    2726
     
    3433/* returns -1 if a comes before b, 0 if a=b, 1 otherwise */
    3534
    36 int pVariables;     // number of variables
    37 
    3835/* 1 for polynomial ring, -1 otherwise */
    3936int     pOrdSgn;
     
    5552{
    5653  if (ppNoether!=NULL) pDelete(&ppNoether);
    57   pVariables = r->N;
    58   pOrdSgn = r->OrdSgn;
    59   pFDeg=r->pFDeg;
    60   pLDeg=r->pLDeg;
    61   pLexOrder=r->LexOrder;
     54  //pVariables = r->N;
     55  //pOrdSgn = r->OrdSgn;
     56  //pFDeg=r->pFDeg;
     57  //pLDeg=r->pLDeg;
     58  //pLexOrder=r->LexOrder;
    6259
    6360  if (complete)
     
    10299* comment should be "assumes that LM(a) = LM(b)*m, for some monomial m..."
    103100*/
    104 poly pDivide(poly a, poly b)
     101#define pDivide(a,b) p_Divide(a,b,currRing)
     102poly p_Divide(poly a, poly b, cont ring r)
    105103{
    106104  assume((pGetComp(a)==pGetComp(b)) || (pGetComp(b)==0));
     
    108106  poly result = pInit();
    109107
    110   for(i=(int)pVariables; i; i--)
    111     pSetExp(result,i, pGetExp(a,i)- pGetExp(b,i));
    112   pSetComp(result, pGetComp(a) - pGetComp(b));
    113   pSetm(result);
     108  for(i=(int)r->N; i; i--)
     109    p_SetExp(result,i, p_GetExp(a,i,r)- p_GetExp(b,i,r),r);
     110  p_SetComp(result, p_GetComp(a,r) - p_GetComp(b,r),r);
     111  p_Setm(result,r);
    114112  return result;
    115113}
     
    154152* assumes that b is not NULL, destroys b
    155153*/
    156 poly pDivideM(poly a, poly b)
     154poly p_DivideM(poly a, poly b, const ring r)
    157155{
    158156  if (a==NULL) { pDelete(&b); return NULL; }
     
    168166  while (a!=NULL)
    169167  {
    170     if (pDivisibleBy(b,a))
    171     {
    172       assume((pGetComp(a)==pGetComp(b)) || (pGetComp(b)==0));
    173       for(i=(int)pVariables; i; i--)
    174          pSubExp(a,i, pGetExp(b,i));
    175       pSubComp(a, pGetComp(b));
    176       pSetm(a);
     168    if (p_DivisibleBy(b,a,r))
     169    {
     170      assume((p_GetComp(a,r)==p_GetComp(b,r)) || (p_GetComp(b,r)==0));
     171      for(i=(int)r->N; i; i--)
     172         p_SubExp(a,i, p_GetExp(b,i,r),r);
     173      p_SubComp(a, p_GetComp(b,r),r);
     174      p_Setm(a,r);
    177175      prev=a;
    178176      pIter(a);
     
    182180      if (prev==NULL)
    183181      {
    184         pLmDelete(&result);
     182        p_DeleteLm(&result,r);
    185183        a=result;
    186184      }
    187185      else
    188186      {
    189         pLmDelete(&pNext(prev));
     187        p_DeleteLm(&pNext(prev),r);
    190188        a=pNext(prev);
    191189      }
  • polys/polys.h

    r208cd5 r1b816a3  
    325325// ----------------- define to enable new p_procs -----*/
    326326
    327 poly      pDivide(poly a, poly b);
    328 poly      pDivideM(poly a, poly b);
     327poly      p_Divide(poly a, poly b, const ring r);
     328poly      p_DivideM(poly a, poly b, const ring r);
    329329void      pLcm(poly a, poly b, poly m);
    330330poly      pDiff(poly a, int k);
Note: See TracChangeset for help on using the changeset viewer.