My Project  debian-1:4.1.1-p2+ds-4build1
Macros | Functions | Variables
old.gring.cc File Reference
#include "misc/auxiliary.h"
#include "nc.h"
#include "sca.h"
#include "gb_hack.h"
#include "polys/monomials/ring.h"
#include "coeffs/numbers.h"
#include "misc/options.h"
#include "polys/monomials/p_polys.h"
#include "polys/simpleideals.h"
#include "polys/matpol.h"
#include "polys/kbuckets.h"
#include "polys/sbuckets.h"
#include "polys/prCopy.h"
#include "polys/operations/p_Mult_q.h"
#include "summator.h"
#include "ncSAMult.h"
#include "ncSAFormula.h"

Go to the source code of this file.

Macros

#define MYTEST   0
 
#define OUTPUT   0
 
#define PLURAL_INTERNAL_DECLARATIONS
 
#define freeT(A, v)   omFreeSize((ADDRESS)A,(v+1)*sizeof(int))
 
#define freeN(A, k)   omFreeSize((ADDRESS)A,k*sizeof(number))
 

Functions

static poly NF_Proc_Dummy (ideal, ideal, poly, int, int, const ring)
 
static ideal BBA_Proc_Dummy (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring)
 
poly nc_p_CopyGet (poly a, const ring r)
 
poly nc_p_CopyPut (poly a, const ring r)
 
poly nc_p_Bracket_qq (poly p, const poly q, const ring r)
 returns [p,q], destroys p More...
 
int & getNCExtensions ()
 
int setNCExtensions (int iMask)
 
bool ncExtensions (int iMask)
 
poly gnc_pp_Mult_mm (const poly p, const poly m, const ring r, poly &last)
 
poly gnc_p_Mult_mm (poly p, const poly m, const ring r)
 
poly gnc_mm_Mult_p (const poly m, poly p, const ring r)
 
poly gnc_mm_Mult_pp (const poly m, const poly p, const ring r)
 
poly gnc_CreateSpolyOld (const poly p1, const poly p2, const ring r)
 
poly gnc_ReduceSpolyOld (const poly p1, poly p2, const ring r)
 
poly gnc_CreateSpolyNew (const poly p1, const poly p2, const ring r)
 
poly gnc_ReduceSpolyNew (const poly p1, poly p2, const ring r)
 
void gnc_kBucketPolyRedNew (kBucket_pt b, poly p, number *c)
 
void gnc_kBucketPolyRed_ZNew (kBucket_pt b, poly p, number *c)
 
void gnc_kBucketPolyRedOld (kBucket_pt b, poly p, number *c)
 
void gnc_kBucketPolyRed_ZOld (kBucket_pt b, poly p, number *c)
 
void nc_CleanUp (nc_struct *p)
 
void nc_rCleanUp (ring r)
 
poly nc_p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, int &shorter, const poly, const ring r)
 for p_Minus_mm_Mult_qq in pInline2.h More...
 
poly nc_p_Plus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, const int, const ring r)
 
poly _gnc_p_Mult_q (poly p, poly q, const int copy, const ring r)
 
poly _nc_p_Mult_q (poly pPolyP, poly pPolyQ, const ring rRing)
 general NC-multiplication with destruction More...
 
poly _nc_pp_Mult_qq (const poly pPolyP, const poly pPolyQ, const ring rRing)
 general NC-multiplication without destruction More...
 
poly gnc_mm_Mult_nn (int *F, int *G, const ring r)
 
poly gnc_mm_Mult_uu (int *F, int jG, int bG, const ring r)
 
poly gnc_uu_Mult_ww (int i, int a, int j, int b, const ring r)
 
poly gnc_p_Mult_mm_Common (poly p, const poly m, int side, const ring r)
 
poly gnc_pp_Mult_mm (const poly p, const poly m, const ring r)
 
poly gnc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r)
 
static poly gnc_uu_Mult_ww_formula (int i, int a, int j, int b, const ring r)
 
poly gnc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r)
 
poly nc_CreateShortSpoly (poly p1, poly p2, const ring r)
 
void nc_PolyPolyRedOld (poly &b, poly p, number *c, const ring r)
 
void nc_PolyPolyRedNew (poly &b, poly p, number *c, const ring r)
 
void nc_PolyPolyRed (poly &b, poly p, number *c, const ring r)
 
poly nc_mm_Bracket_nn (poly m1, poly m2, const ring r)
 returns [m1,m2] for two monoms, destroys nothing without coeffs More...
 
matrix nc_PrintMat (int a, int b, ring r, int metric)
 returns matrix with the info on noncomm multiplication More...
 
void nc_CleanUp (ring r)
 
void nc_rKill (ring r)
 complete destructor More...
 
BOOLEAN nc_CheckSubalgebra (poly PolyVar, ring r)
 
BOOLEAN gnc_CheckOrdCondition (matrix D, ring r)
 
BOOLEAN gnc_InitMultiplication (ring r, bool bSetupQuotient=false)
 
BOOLEAN nc_CallPlural (matrix CCC, matrix DDD, poly CCN, poly DDN, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring)
 returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation! More...
 
bool nc_rCopy (ring res, const ring r, bool bSetupQuotient)
 
static void gnc_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
void nc_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
poly nc_pSubst (poly p, int n, poly e, const ring r)
 substitute the n-th variable by e in p destroy p e is not a constant More...
 
ring nc_rCreateNCcomm (ring r)
 
poly p_CopyEmbed (poly p, ring srcRing, int shift, int, ring dstRing)
 
BOOLEAN rIsLikeOpposite (ring rBase, ring rCandidate)
 checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so More...
 
poly pOppose (ring Rop, poly p, const ring dst)
 opposes a vector p from Rop to currRing (dst!) More...
 
ideal idOppose (ring Rop, ideal I, const ring dst)
 opposes a module I from Rop to currRing(dst) More...
 
bool nc_SetupQuotient (ring rGR, const ring rG, bool bCopy)
 

Variables

NF_Proc nc_NF =NF_Proc_Dummy
 
BBA_Proc gnc_gr_bba =BBA_Proc_Dummy
 
BBA_Proc gnc_gr_mora =BBA_Proc_Dummy
 
BBA_Proc sca_bba =BBA_Proc_Dummy
 
BBA_Proc sca_mora =BBA_Proc_Dummy
 
BBA_Proc sca_gr_bba =BBA_Proc_Dummy
 
int iNCExtensions = SCAMASK | NOFORMULAMASK
 

Macro Definition Documentation

◆ freeN

#define freeN (   A,
  k 
)    omFreeSize((ADDRESS)A,k*sizeof(number))

Definition at line 102 of file old.gring.cc.

◆ freeT

#define freeT (   A,
  v 
)    omFreeSize((ADDRESS)A,(v+1)*sizeof(int))

Definition at line 101 of file old.gring.cc.

◆ MYTEST

#define MYTEST   0

Definition at line 9 of file old.gring.cc.

◆ OUTPUT

#define OUTPUT   0

Definition at line 10 of file old.gring.cc.

◆ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 24 of file old.gring.cc.

Function Documentation

◆ _gnc_p_Mult_q()

poly _gnc_p_Mult_q ( poly  p,
poly  q,
const int  copy,
const ring  r 
)

Definition at line 190 of file old.gring.cc.

192 {
193  poly res=NULL;
194  poly qq,pp;
195  if (copy)
196  {
197  qq=p_Copy(q,r);
198  pp=p_Copy(p,r);
199  }
200  else
201  {
202  qq=q;
203  pp=p;
204  }
205  while (qq!=NULL)
206  {
207  res=p_Add_q(res, pp_Mult_mm(pp, qq, r), r); // p_Head(qq, r)?
208  qq=p_LmDeleteAndNext(qq,r);
209  }
210  p_Delete(&pp,r);
211  return(res);
212 }

◆ _nc_p_Mult_q()

poly _nc_p_Mult_q ( poly  pPolyP,
poly  pPolyQ,
const ring  rRing 
)

general NC-multiplication with destruction

Definition at line 215 of file old.gring.cc.

216 {
217  assume( rIsPluralRing(rRing) );
218 #ifdef PDEBUG
219  p_Test(pPolyP, rRing);
220  p_Test(pPolyQ, rRing);
221 #endif
222 #ifdef RDEBUG
223  rTest(rRing);
224 #endif
225 
226  int lp, lq;
227 
228  pqLength(pPolyP, pPolyQ, lp, lq, MIN_LENGTH_BUCKET);
229 
230  bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (si_max(lp, lq) < MIN_LENGTH_BUCKET); // ???
231 
232  CPolynomialSummator sum(rRing, bUsePolynomial);
233 
234  if (lq <= lp) // ?
235  {
236  // always length(q) times "p * q[j]"
237  for( ; pPolyQ!=NULL; pPolyQ = p_LmDeleteAndNext( pPolyQ, rRing ) )
238  sum += pp_Mult_mm( pPolyP, pPolyQ, rRing);
239 
240  p_Delete( &pPolyP, rRing );
241  } else
242  {
243  // always length(p) times "p[i] * q"
244  for( ; pPolyP!=NULL; pPolyP = p_LmDeleteAndNext( pPolyP, rRing ) )
245  sum += nc_mm_Mult_pp( pPolyP, pPolyQ, rRing);
246 
247  p_Delete( &pPolyQ, rRing );
248  }
249 
250  return(sum);
251 }

◆ _nc_pp_Mult_qq()

poly _nc_pp_Mult_qq ( const poly  pPolyP,
const poly  pPolyQ,
const ring  rRing 
)

general NC-multiplication without destruction

Definition at line 254 of file old.gring.cc.

255 {
256  assume( rIsPluralRing(rRing) );
257 #ifdef PDEBUG
258  p_Test(pPolyP, rRing);
259  p_Test(pPolyQ, rRing);
260 #endif
261 #ifdef RDEBUG
262  rTest(rRing);
263 #endif
264 
265  int lp, lq;
266 
267  pqLength(pPolyP, pPolyQ, lp, lq, MIN_LENGTH_BUCKET);
268 
269  bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (si_max(lp, lq) < MIN_LENGTH_BUCKET); // ???
270 
271  CPolynomialSummator sum(rRing, bUsePolynomial);
272 
273  if (lq <= lp) // ?
274  {
275  // always length(q) times "p * q[j]"
276  for( poly q = pPolyQ; q !=NULL; q = pNext(q) )
277  sum += pp_Mult_mm(pPolyP, q, rRing);
278  } else
279  {
280  // always length(p) times "p[i] * q"
281  for( poly p = pPolyP; p !=NULL; p = pNext(p) )
282  sum += nc_mm_Mult_pp( p, pPolyQ, rRing);
283  }
284 
285  return(sum);
286 }

◆ BBA_Proc_Dummy()

static ideal BBA_Proc_Dummy ( const  ideal,
const  ideal,
const intvec ,
const intvec ,
kStrategy  ,
const  ring 
)
static

Definition at line 61 of file old.gring.cc.

62 { WerrorS("nc_NF not defined"); return NULL; }

◆ getNCExtensions()

int& getNCExtensions ( )

Definition at line 82 of file old.gring.cc.

83 {
84  return (iNCExtensions);
85 }

◆ gnc_CheckOrdCondition()

BOOLEAN gnc_CheckOrdCondition ( matrix  D,
ring  r 
)

Definition at line 2626 of file old.gring.cc.

2627 {
2628  /* analyze D: an upper triangular matrix of polys */
2629  /* check the ordering condition for D */
2630 // ring save = currRing;
2631 // int WeChangeRing = 0;
2632 // if (r != currRing)
2633 // {
2634 // rChangeCurrRing(r);
2635 // WeChangeRing = 1;
2636 // }
2637  poly p,q;
2638  int i,j;
2639  int report = 0;
2640  for(i=1; i<r->N; i++)
2641  {
2642  for(j=i+1; j<=r->N; j++)
2643  {
2644  p = nc_p_CopyGet(MATELEM(D,i,j),r);
2645  if ( p != NULL)
2646  {
2647  q = p_One(r);
2648  p_SetExp(q,i,1,r);
2649  p_SetExp(q,j,1,r);
2650  p_Setm(q,r);
2651  if (p_LmCmp(q,p,r) != 1) /* i.e. lm(p)==xy < lm(q)==D_ij */
2652  {
2653  Werror("Bad ordering at %d,%d\n",i,j);
2654 #if 0 /*Singularg should not differ from Singular except in error case*/
2655  p_Write(p,r);
2656  p_Write(q,r);
2657 #endif
2658  report = 1;
2659  }
2660  p_Delete(&q,r);
2661  p_Delete(&p,r);
2662  p = NULL;
2663  }
2664  }
2665  }
2666 // if ( WeChangeRing )
2667 // rChangeCurrRing(save);
2668  return(report);
2669 }

◆ gnc_CreateSpolyNew()

poly gnc_CreateSpolyNew ( const poly  p1,
const poly  p2,
const ring  r 
)

Definition at line 1557 of file old.gring.cc.

1558 {
1559 #ifdef PDEBUG
1560  p_Test(p1, r);
1561  p_Test(p2, r);
1562 #if MYTEST
1563  PrintS("p1: "); p_Write(p1, r);
1564  PrintS("p2: "); p_Write(p2, r);
1565 #endif
1566 #endif
1567 
1568  const long lCompP1 = p_GetComp(p1,r);
1569  const long lCompP2 = p_GetComp(p2,r);
1570 
1571  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1572  {
1573 #ifdef PDEBUG
1574  WerrorS("gnc_CreateSpolyNew: different non-zero components!");
1575  assume(0);
1576 #endif
1577  return(NULL);
1578  }
1579 
1580 // if ((r->GetNC()->type==nc_lie) && pHasNotCF(p1,p2)) /* prod crit */
1581 // {
1582 // return(nc_p_Bracket_qq(pCopy(p2),p1));
1583 // }
1584 
1585 // poly pL=p_One( r);
1586 
1587  poly m1=p_One( r);
1588  poly m2=p_One( r);
1589 
1590  poly pL = p_Lcm(p1,p2,r); // pL = lcm( lm(p1), lm(p2) )
1591 
1592 
1593 #ifdef PDEBUG
1594 // p_Test(pL,r);
1595 #endif
1596 
1597  p_ExpVectorDiff(m1, pL, p1, r); // m1 = pL / lm(p1)
1598  //p_SetComp(m1,0,r);
1599  //p_Setm(m1,r);
1600 
1601 #ifdef PDEBUG
1602  p_Test(m1,r);
1603 #endif
1604 // assume(p_GetComp(m1,r) == 0);
1605 
1606  p_ExpVectorDiff(m2, pL, p2, r); // m2 = pL / lm(p2)
1607 
1608  //p_SetComp(m2,0,r);
1609  //p_Setm(m2,r);
1610 #ifdef PDEBUG
1611  p_Test(m2,r);
1612 #endif
1613 
1614 #ifdef PDEBUG
1615 #if MYTEST
1616  PrintS("m1: "); pWrite(m1);
1617  PrintS("m2: "); pWrite(m2);
1618 #endif
1619 #endif
1620 
1621 
1622 // assume(p_GetComp(m2,r) == 0);
1623 
1624 #ifdef PDEBUG
1625 #if 0
1626  if( (p_GetComp(m2,r) != 0) || (p_GetComp(m1,r) != 0) )
1627  {
1628  WarnS("gnc_CreateSpolyNew: wrong monomials!");
1629 
1630 
1631 #ifdef RDEBUG
1632  PrintS("m1 = "); p_Write(m1, r);
1633  p_DebugPrint(m1, r);
1634 
1635  PrintS("m2 = "); p_Write(m2, r);
1636  p_DebugPrint(m2, r);
1637 
1638  PrintS("p1 = "); p_Write(p1, r);
1639  p_DebugPrint(p1, r);
1640 
1641  PrintS("p2 = "); p_Write(p2, r);
1642  p_DebugPrint(p2, r);
1643 
1644  PrintS("pL = "); p_Write(pL, r);
1645  p_DebugPrint(pL, r);
1646 #endif
1647 
1648  }
1649 
1650 #endif
1651 #endif
1652 
1653  p_LmFree(&pL,r);
1654 
1655  /* zero exponents !? */
1656  poly M1 = nc_mm_Mult_p(m1,p_Head(p1,r),r); // M1 = m1 * lt(p1)
1657  poly M2 = nc_mm_Mult_p(m2,p_Head(p2,r),r); // M2 = m2 * lt(p2)
1658 
1659 #ifdef PDEBUG
1660  p_Test(M1,r);
1661  p_Test(M2,r);
1662 
1663 #if MYTEST
1664  PrintS("M1: "); pWrite(M1);
1665  PrintS("M2: "); pWrite(M2);
1666 #endif
1667 #endif
1668 
1669  if(M1 == NULL || M2 == NULL)
1670  {
1671 #ifdef PDEBUG
1672  PrintS("\np1 = ");
1673  p_Write(p1, r);
1674 
1675  PrintS("m1 = ");
1676  p_Write(m1, r);
1677 
1678  PrintS("p2 = ");
1679  p_Write(p2, r);
1680 
1681  PrintS("m2 = ");
1682  p_Write(m2, r);
1683 
1684  WerrorS("ERROR in nc_CreateSpoly: result of multiplication is Zero!\n");
1685 #endif
1686  return(NULL);
1687  }
1688 
1689  number C1 = p_GetCoeff(M1,r); // C1 = lc(M1)
1690  number C2 = p_GetCoeff(M2,r); // C2 = lc(M2)
1691 
1692  /* GCD stuff */
1693  number C = n_SubringGcd(C1, C2, r->cf); // C = gcd(C1, C2)
1694 
1695  if (!n_IsOne(C, r->cf)) // if C != 1
1696  {
1697  C1=n_Div(C1, C, r->cf);n_Normalize(C1,r->cf); // C1 = C1 / C
1698  C2=n_Div(C2, C, r->cf);n_Normalize(C2,r->cf); // C2 = C2 / C
1699  }
1700  else
1701  {
1702  C1=n_Copy(C1,r->cf);
1703  C2=n_Copy(C2,r->cf);
1704  }
1705 
1706  n_Delete(&C,r->cf); // destroy the number C
1707 
1708  C1=n_InpNeg(C1,r->cf);
1709 
1710 // number MinusOne=n_Init(-1,r);
1711 // if (n_Equal(C1,MinusOne,r)) // lc(M1) / gcd( lc(M1), lc(M2)) == -1 ????
1712 // {
1713 // M2=p_Add_q(M1,M2,r); // ?????
1714 // }
1715 // else
1716 // {
1717  M1=__p_Mult_nn(M1,C2,r); // M1 = (C2*lc(p1)) * (lcm(lm(p1),lm(p2)) / lm(p1)) * lm(p1)
1718 
1719 #ifdef PDEBUG
1720  p_Test(M1,r);
1721 #endif
1722 
1723  M2=__p_Mult_nn(M2,C1,r); // M2 =(-C1*lc(p2)) * (lcm(lm(p1),lm(p2)) / lm(p2)) * lm(p2)
1724 
1725 
1726 
1727 #ifdef PDEBUG
1728  p_Test(M2,r);
1729 
1730 #if MYTEST
1731  PrintS("M1: "); pWrite(M1);
1732  PrintS("M2: "); pWrite(M2);
1733 #endif
1734 #endif
1735 
1736 
1737  M2=p_Add_q(M1,M2,r); // M1 is killed, M2 = spoly(lt(p1), lt(p2)) = C2*M1 - C1*M2
1738 
1739 #ifdef PDEBUG
1740  p_Test(M2,r);
1741 
1742 #if MYTEST
1743  PrintS("M2: "); pWrite(M2);
1744 #endif
1745 
1746 #endif
1747 
1748 // M2 == 0 for supercommutative algebras!
1749 // }
1750 // n_Delete(&MinusOne,r);
1751 
1752  p_SetCoeff(m1,C2,r); // lc(m1) = C2!!!
1753  p_SetCoeff(m2,C1,r); // lc(m2) = C1!!!
1754 
1755 #ifdef PDEBUG
1756  p_Test(m1,r);
1757  p_Test(m2,r);
1758 #endif
1759 
1760 // poly tmp = p_Copy(p1,r); // tmp = p1
1761 // tmp=p_LmDeleteAndNext(tmp,r); // tmp = tail(p1)
1762 //#ifdef PDEBUG
1763 // p_Test(tmp,r);
1764 //#endif
1765 
1766  M1 = nc_mm_Mult_pp(m1, pNext(p1), r); // M1 = m1 * tail(p1), delete tmp // ???
1767 
1768 #ifdef PDEBUG
1769  p_Test(M1,r);
1770 
1771 #if MYTEST
1772  PrintS("M1: "); pWrite(M1);
1773 #endif
1774 
1775 #endif
1776 
1777  M2=p_Add_q(M2,M1,r); // M2 = spoly(lt(p1), lt(p2)) + m1 * tail(p1), delete M1
1778 #ifdef PDEBUG
1779  M1=NULL;
1780  p_Test(M2,r);
1781 
1782 #if MYTEST
1783  PrintS("M2: "); pWrite(M2);
1784 #endif
1785 
1786 #endif
1787 
1788 // tmp=p_Copy(p2,r); // tmp = p2
1789 // tmp=p_LmDeleteAndNext(tmp,r); // tmp = tail(p2)
1790 
1791 //#ifdef PDEBUG
1792 // p_Test(tmp,r);
1793 //#endif
1794 
1795  M1 = nc_mm_Mult_pp(m2, pNext(p2), r); // M1 = m2 * tail(p2), detele tmp
1796 
1797 #ifdef PDEBUG
1798  p_Test(M1,r);
1799 
1800 #if MYTEST
1801  PrintS("M1: "); pWrite(M1);
1802 #endif
1803 
1804 #endif
1805 
1806  M2 = p_Add_q(M2,M1,r); // M2 = spoly(lt(p1), lt(p2)) + m1 * tail(p1) + m2*tail(p2)
1807 
1808 #ifdef PDEBUG
1809  M1=NULL;
1810  p_Test(M2,r);
1811 
1812 #if MYTEST
1813  PrintS("M2: "); pWrite(M2);
1814 #endif
1815 
1816 #endif
1817 
1818  p_Delete(&m1,r); // => n_Delete(&C1,r);
1819  p_Delete(&m2,r); // => n_Delete(&C2,r);
1820 
1821 #ifdef PDEBUG
1822  p_Test(M2,r);
1823 #endif
1824 
1825  if (M2!=NULL) p_Cleardenom(M2,r);
1826 
1827  return(M2);
1828 }

◆ gnc_CreateSpolyOld()

poly gnc_CreateSpolyOld ( const poly  p1,
const poly  p2,
const ring  r 
)

Definition at line 1470 of file old.gring.cc.

1471 {
1472 #ifdef PDEBUG
1473  if ((p_GetComp(p1,r)!=p_GetComp(p2,r))
1474  && (p_GetComp(p1,r)!=0)
1475  && (p_GetComp(p2,r)!=0))
1476  {
1477  dReportError("gnc_CreateSpolyOld : different components!");
1478  return(NULL);
1479  }
1480 #endif
1481  if ((ncRingType(r)==nc_lie) && p_HasNotCF(p1,p2, r)) /* prod crit */
1482  {
1483  return(nc_p_Bracket_qq(p_Copy(p2, r),p1, r));
1484  }
1485  poly pL=p_One(r);
1486  poly m1=p_One(r);
1487  poly m2=p_One(r);
1488  pL = p_Lcm(p1,p2,r);
1489  p_Setm(pL,r);
1490 #ifdef PDEBUG
1491  p_Test(pL,r);
1492 #endif
1493  p_ExpVectorDiff(m1,pL,p1,r);
1494  //p_SetComp(m1,0,r);
1495  //p_Setm(m1,r);
1496 #ifdef PDEBUG
1497  p_Test(m1,r);
1498 #endif
1499  p_ExpVectorDiff(m2,pL,p2,r);
1500  //p_SetComp(m2,0,r);
1501  //p_Setm(m2,r);
1502 #ifdef PDEBUG
1503  p_Test(m2,r);
1504 #endif
1505  p_Delete(&pL,r);
1506  /* zero exponents ! */
1507  poly M1 = nc_mm_Mult_p(m1,p_Head(p1,r),r);
1508  number C1 = p_GetCoeff(M1,r);
1509  poly M2 = nc_mm_Mult_p(m2,p_Head(p2,r),r);
1510  number C2 = p_GetCoeff(M2,r);
1511  /* GCD stuff */
1512  number C = n_SubringGcd(C1,C2,r->cf);
1513  if (!n_IsOne(C,r->cf))
1514  {
1515  C1=n_Div(C1,C, r->cf);n_Normalize(C1,r->cf);
1516  C2=n_Div(C2,C, r->cf);n_Normalize(C2,r->cf);
1517  }
1518  else
1519  {
1520  C1=n_Copy(C1, r->cf);
1521  C2=n_Copy(C2, r->cf);
1522  }
1523  n_Delete(&C,r->cf);
1524  M1=__p_Mult_nn(M1,C2,r);
1525  p_SetCoeff(m1,C2,r);
1526  if (n_IsMOne(C1,r->cf))
1527  {
1528  M2=p_Add_q(M1,M2,r);
1529  }
1530  else
1531  {
1532  C1=n_InpNeg(C1,r->cf);
1533  M2=__p_Mult_nn(M2,C1,r);
1534  M2=p_Add_q(M1,M2,r);
1535  p_SetCoeff(m2,C1,r);
1536  }
1537  /* M1 is killed, M2=res = C2 M1 - C1 M2 */
1538  poly tmp=p_Copy(p1,r);
1539  tmp=p_LmDeleteAndNext(tmp,r);
1540  M1=nc_mm_Mult_p(m1,tmp,r);
1541  tmp=p_Copy(p2,r);
1542  tmp=p_LmDeleteAndNext(tmp,r);
1543  M2=p_Add_q(M2,M1,r);
1544  M1=nc_mm_Mult_p(m2,tmp,r);
1545  M2=p_Add_q(M2,M1,r);
1546  p_Delete(&m1,r);
1547  p_Delete(&m2,r);
1548  // n_Delete(&C1,r);
1549  // n_Delete(&C2,r);
1550 #ifdef PDEBUG
1551  p_Test(M2,r);
1552 #endif
1553  if (M2!=NULL) M2=p_Cleardenom(M2,r);
1554  return(M2);
1555 }

◆ gnc_InitMultiplication()

BOOLEAN gnc_InitMultiplication ( ring  r,
bool  bSetupQuotient = false 
)

Definition at line 3040 of file old.gring.cc.

3041 {
3042  /* returns TRUE if there were errors */
3043  /* initialize the multiplication: */
3044  /* r->GetNC()->MTsize, r->GetNC()->MT, r->GetNC()->COM, */
3045  /* and r->GetNC()->IsSkewConstant for the skew case */
3046  if (rVar(r)==1)
3047  {
3048  ncRingType(r, nc_comm);
3049  r->GetNC()->IsSkewConstant=1;
3050  return FALSE;
3051  }
3052 
3053 // ring save = currRing;
3054 // int WeChangeRing = 0;
3055 
3056 // if (currRing!=r)
3057 // {
3058 // rChangeCurrRing(r);
3059 // WeChangeRing = 1;
3060 // }
3061 // assume( (currRing == r)
3062 // && (currRing->GetNC()!=NULL) ); // otherwise we cannot work with all these matrices!
3063 
3064  int i,j;
3065  r->GetNC()->MT = (matrix *)omAlloc0((r->N*(r->N-1))/2*sizeof(matrix));
3066  r->GetNC()->MTsize = (int *)omAlloc0((r->N*(r->N-1))/2*sizeof(int));
3067  id_Test((ideal)r->GetNC()->C, r);
3068  matrix COM = mp_Copy(r->GetNC()->C, r);
3069  poly p,q;
3070  short DefMTsize=7;
3071  int IsNonComm=0;
3072 // bool tmpIsSkewConstant = false;
3073 
3074  for(i=1; i<r->N; i++)
3075  {
3076  for(j=i+1; j<=r->N; j++)
3077  {
3078  if ( MATELEM(r->GetNC()->D,i,j) == NULL ) /* quasicommutative case */
3079  {
3080  /* 1x1 mult.matrix */
3081  r->GetNC()->MTsize[UPMATELEM(i,j,r->N)] = 1;
3082  r->GetNC()->MT[UPMATELEM(i,j,r->N)] = mpNew(1,1);
3083  }
3084  else /* pure noncommutative case */
3085  {
3086  /* TODO check the special multiplication properties */
3087  IsNonComm = 1;
3088  p_Delete(&(MATELEM(COM,i,j)),r);
3089  //MATELEM(COM,i,j) = NULL; // done by p_Delete
3090  r->GetNC()->MTsize[UPMATELEM(i,j,r->N)] = DefMTsize; /* default sizes */
3091  r->GetNC()->MT[UPMATELEM(i,j,r->N)] = mpNew(DefMTsize, DefMTsize);
3092  }
3093  /* set MT[i,j,1,1] to c_i_j*x_i*x_j + D_i_j */
3094  p = p_One(r);
3095  if (MATELEM(r->GetNC()->C,i,j)!=NULL)
3096  p_SetCoeff(p,n_Copy(pGetCoeff(MATELEM(r->GetNC()->C,i,j)),r->cf),r);
3097  p_SetExp(p,i,1,r);
3098  p_SetExp(p,j,1,r);
3099  p_Setm(p,r);
3100  p_Test(MATELEM(r->GetNC()->D,i,j),r);
3101  q = nc_p_CopyGet(MATELEM(r->GetNC()->D,i,j),r);
3102  p = p_Add_q(p,q,r);
3103  MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1) = nc_p_CopyPut(p,r);
3104  p_Delete(&p,r);
3105  // p = NULL;// done by p_Delete
3106  }
3107  }
3108  if (ncRingType(r)==nc_undef)
3109  {
3110  if (IsNonComm==1)
3111  {
3112  // assume(pN!=NULL);
3113  // if ((tmpIsSkewConstant==1) && (nIsOne(pGetCoeff(pN)))) r->GetNC()->type=nc_lie;
3114  // else r->GetNC()->type=nc_general;
3115  }
3116  if (IsNonComm==0)
3117  {
3118  ncRingType(r, nc_skew); // TODO: check whether it is commutative
3119  r->GetNC()->IsSkewConstant = 0; // true; //tmpIsSkewConstant; // BUG???
3120  } else
3121  assume( FALSE );
3122  }
3123  r->GetNC()->COM=COM;
3124 
3125  nc_p_ProcsSet(r, r->p_Procs);
3126 
3127  if(bSetupQuotient) // Test me!!!
3128  nc_SetupQuotient(r, NULL, false); // no copy!
3129 
3130 
3131 // if (save != currRing)
3132 // rChangeCurrRing(save);
3133 
3134  return FALSE;
3135 }

◆ gnc_kBucketPolyRed_ZNew()

void gnc_kBucketPolyRed_ZNew ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 2060 of file old.gring.cc.

2061 {
2062  const ring r = b->bucket_ring;
2063  // b is multiplied by a constant in this impl.
2064  number ctmp;
2065  poly m=p_One(r);
2067  //pSetm(m);
2068 #ifdef PDEBUG
2069  p_Test(m, r);
2070 #endif
2071 
2072  if(p_IsConstant(m,r))
2073  {
2074  p_Delete(&m, r);
2075  ctmp = kBucketPolyRed(b,p,pLength(p),NULL);
2076  }
2077  else
2078  {
2079  poly pp = nc_mm_Mult_pp(m,p,r);
2080  number c2;
2081  p_Cleardenom_n(pp,r,c2);
2082  p_Delete(&m, r);
2083  ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL);
2084  //cc=*c;
2085  //*c=nMult(*c,c2);
2086  n_Delete(&c2, r->cf);
2087  //nDelete(&cc);
2088  p_Delete(&pp, r);
2089  }
2090  if (c!=NULL) *c=ctmp;
2091  else n_Delete(&ctmp, r->cf);
2092 }

◆ gnc_kBucketPolyRed_ZOld()

void gnc_kBucketPolyRed_ZOld ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 2027 of file old.gring.cc.

2028 {
2029  const ring r = b->bucket_ring;
2030  // b is multiplied by a constant in this impl.
2031  number ctmp;
2032  poly m=p_One(r);
2034  //pSetm(m);
2035 #ifdef PDEBUG
2036  p_Test(m, r);
2037 #endif
2038  if(p_IsConstant(m,r))
2039  {
2040  p_Delete(&m, r);
2041  ctmp = kBucketPolyRed(b,p,pLength(p),NULL);
2042  }
2043  else
2044  {
2045  poly pp = nc_mm_Mult_pp(m,p,r);
2046  number c2;
2047  p_Cleardenom_n(pp,r,c2);
2048  p_Delete(&m, r);
2049  ctmp = kBucketPolyRed(b,pp,pLength(pp),NULL);
2050  //cc=*c;
2051  //*c=nMult(*c,c2);
2052  n_Delete(&c2, r->cf);
2053  //nDelete(&cc);
2054  p_Delete(&pp, r);
2055  }
2056  if (c!=NULL) *c=ctmp;
2057  else n_Delete(&ctmp, r->cf);
2058 }

◆ gnc_kBucketPolyRedNew()

void gnc_kBucketPolyRedNew ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 1947 of file old.gring.cc.

1948 {
1949  const ring r = b->bucket_ring;
1950 #ifdef PDEBUG
1951 // PrintS(">*");
1952 #endif
1953 
1954 #ifdef KDEBUG
1955  if( !kbTest(b) ) WerrorS("nc_kBucketPolyRed: broken bucket!");
1956 #endif
1957 
1958 #ifdef PDEBUG
1959  p_Test(p, r);
1960 #if MYTEST
1961  PrintS("p: "); p_Write(p, r);
1962 #endif
1963 #endif
1964 
1965  // b will not be multiplied by any constant in this impl.
1966  // ==> *c=1
1967  if (c!=NULL) *c=n_Init(1, r->cf);
1968  poly m = p_One(r);
1969  const poly pLmB = kBucketGetLm(b); // no new copy!
1970 
1971  assume( pLmB != NULL );
1972 
1973 #ifdef PDEBUG
1974  p_Test(pLmB, r);
1975 
1976 #if MYTEST
1977  PrintS("pLmB: "); p_Write(pLmB, r);
1978 #endif
1979 #endif
1980 
1981  p_ExpVectorDiff(m, pLmB, p, r);
1982  //pSetm(m);
1983 
1984 #ifdef PDEBUG
1985  p_Test(m, r);
1986 #if MYTEST
1987  PrintS("m: "); p_Write(m, r);
1988 #endif
1989 #endif
1990 
1991  poly pp = nc_mm_Mult_pp(m, p, r);
1992  p_Delete(&m, r);
1993 
1994  assume( pp != NULL );
1995  const number n = pGetCoeff(pp); // bug!
1996 
1997  if (!n_IsMOne(n, r->cf) ) // does this improve performance??!? also see below... // TODO: check later on.
1998  // if n == -1 => nn = 1 and -1/n
1999  {
2000  number nn=n_InpNeg(n_Invers(n, r->cf), r->cf);
2001  number t = n_Mult(nn,pGetCoeff(pLmB), r->cf);
2002  n_Delete(&nn, r->cf);
2003  pp = __p_Mult_nn(pp,t,r);
2004  n_Delete(&t, r->cf);
2005  }
2006  else
2007  {
2008  pp = __p_Mult_nn(pp,p_GetCoeff(pLmB, r), r);
2009  }
2010 
2011  int l = pLength(pp);
2012 
2013 #ifdef PDEBUG
2014  p_Test(pp, r);
2015 // PrintS("PP: "); pWrite(pp);
2016 #endif
2017 
2018  kBucket_Add_q(b,pp,&l);
2019 
2020 
2021 #ifdef PDEBUG
2022 // PrintS("*>");
2023 #endif
2024 }

◆ gnc_kBucketPolyRedOld()

void gnc_kBucketPolyRedOld ( kBucket_pt  b,
poly  p,
number *  c 
)

Definition at line 1914 of file old.gring.cc.

1915 {
1916  const ring r = b->bucket_ring;
1917  // b will not be multiplied by any constant in this impl.
1918  // ==> *c=1
1919  if (c!=NULL) *c=n_Init(1, r->cf);
1920  poly m=p_One(r);
1922  //pSetm(m);
1923 #ifdef PDEBUG
1924  p_Test(m, r);
1925 #endif
1926  poly pp= nc_mm_Mult_pp(m,p, r);
1927  assume(pp!=NULL);
1928  p_Delete(&m, r);
1929  number n=pGetCoeff(pp);
1930  number nn;
1931  if (!n_IsMOne(n, r->cf))
1932  {
1933  nn=n_InpNeg(n_Invers(n, r->cf), r->cf);
1934  n= n_Mult(nn,pGetCoeff(kBucketGetLm(b)), r->cf);
1935  n_Delete(&nn, r->cf);
1936  pp=__p_Mult_nn(pp,n,r);
1937  n_Delete(&n, r->cf);
1938  }
1939  else
1940  {
1942  }
1943  int l=pLength(pp);
1944  kBucket_Add_q(b,pp,&l);
1945 }

◆ gnc_mm_Mult_nn()

poly gnc_mm_Mult_nn ( int *  F,
int *  G,
const ring  r 
)

Definition at line 414 of file old.gring.cc.

416 {
417  poly out=NULL;
418  int i,j;
419  int iF,jG,iG;
420  int rN=r->N;
421 
422  int *F=(int *)omAlloc0((rN+1)*sizeof(int));
423  int *G=(int *)omAlloc0((rN+1)*sizeof(int));
424 
425  memcpy(F, F0,(rN+1)*sizeof(int));
426  // pExpVectorCopy(F,F0);
427  memcpy(G, G0,(rN+1)*sizeof(int));
428  // pExpVectorCopy(G,G0);
429  F[0]=0;
430  G[0]=0;
431 
432  iF=rN;
433  while ((F[iF]==0)&&(iF>=1)) iF--; /* last exp_num of F */
434  if (iF==0) /* F0 is zero vector */
435  {
436  out=p_One(r);
437  p_SetExpV(out,G0,r);
438  p_Setm(out,r);
439  freeT(F,rN);
440  freeT(G,rN);
441  return(out);
442  }
443  jG=1;
444  while ((G[jG]==0)&&(jG<rN)) jG++; /* first exp_num of G */
445  iG=rN;
446  while ((G[iG]==0)&&(iG>1)) iG--; /* last exp_num of G */
447 
448  out=p_One(r);
449 
450  if (iF<=jG)
451  /* i.e. no mixed exp_num , MERGE case */
452  {
453  { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
454  p_SetExpV(out,F,r);
455  p_Setm(out,r);
456  freeT(F,rN);
457  freeT(G,rN);
458  return(out);
459  }
460 
461  number cff=n_Init(1,r->cf);
462  number tmp_num=NULL;
463  int cpower=0;
464 
465  if (ncRingType(r)==nc_skew)
466  {
467  if (r->GetNC()->IsSkewConstant==1)
468  {
469  int tpower=0;
470  for(j=jG; j<=iG; j++)
471  {
472  if (G[j]!=0)
473  {
474  cpower = 0;
475  for(i=j+1; i<=iF; i++)
476  {
477  cpower = cpower + F[i];
478  }
479  cpower = cpower*G[j]; // bug! here may happen an arithmetic overflow!!!
480  tpower = tpower + cpower;
481  }
482  }
483  cff = n_Copy(pGetCoeff(MATELEM(r->GetNC()->COM,1,2)),r->cf);
484  n_Power(cff,tpower,&tmp_num, r->cf);
485  n_Delete(&cff,r->cf);
486  cff = tmp_num;
487  }
488  else /* skew commutative with nonequal coeffs */
489  {
490  number totcff=n_Init(1,r->cf);
491  for(j=jG; j<=iG; j++)
492  {
493  if (G[j]!=0)
494  {
495  cpower = 0;
496  for(i=j+1; i<=iF; i++)
497  {
498  if (F[i]!=0)
499  {
500  cpower = F[i]*G[j]; // bug! overflow danger!!!
501  cff = n_Copy(pGetCoeff(MATELEM(r->GetNC()->COM,j,i)),r->cf);
502  n_Power(cff,cpower,&tmp_num, r->cf);
503  cff = n_Mult(totcff,tmp_num, r->cf);
504  n_Delete(&totcff, r->cf);
505  n_Delete(&tmp_num, r->cf);
506  totcff = n_Copy(cff,r->cf);
507  n_Delete(&cff,r->cf);
508  }
509  } /* end 2nd for */
510  }
511  }
512  cff=totcff;
513  }
514  { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
515  p_SetExpV(out,F,r);
516  p_Setm(out,r);
517  p_SetCoeff(out,cff,r);
518  freeT(F,rN);
519  freeT(G,rN);
520  return(out);
521  } /* end nc_skew */
522 
523  /* now we have to destroy out! */
524  p_Delete(&out,r);
525 
526  if (iG==jG)
527  /* g is univariate monomial */
528  {
529  /* if (ri->GetNC()->type==nc_skew) -- postpone to TU */
530  out = gnc_mm_Mult_uu(F,jG,G[jG],r);
531  freeT(F,rN);
532  freeT(G,rN);
533  return(out);
534  }
535 
536  int *Prv=(int *)omAlloc0((rN+1)*sizeof(int));
537  int *Nxt=(int *)omAlloc0((rN+1)*sizeof(int));
538 
539  int *log=(int *)omAlloc0((rN+1)*sizeof(int));
540  int cnt=0; int cnf=0;
541 
542  /* splitting F wrt jG */
543  for (i=1;i<=jG;i++)
544  {
545  Prv[i]=F[i]; Nxt[i]=0; /* mult at the very end */
546  if (F[i]!=0) cnf++;
547  }
548 
549  if (cnf==0) freeT(Prv,rN);
550 
551  for (i=jG+1;i<=rN;i++)
552  {
553  Nxt[i]=F[i];
554  /* if (cnf!=0) Prv[i]=0; */
555  if (F[i]!=0)
556  {
557  cnt++;
558  } /* effective part for F */
559  }
560  freeT(F,rN);
561  cnt=0;
562 
563  for (i=1;i<=rN;i++)
564  {
565  if (G[i]!=0)
566  {
567  cnt++;
568  log[cnt]=i;
569  } /* lG for G */
570  }
571 
572 /* ---------------------- A C T I O N ------------------------ */
573  poly D=NULL;
574  poly Rout=NULL;
575  number *c=(number *)omAlloc0((rN+1)*sizeof(number));
576  c[0]=n_Init(1,r->cf);
577 
578  int *Op=Nxt;
579  int *On=G;
580  int *U=(int *)omAlloc0((rN+1)*sizeof(int));
581 
582  for (i=jG;i<=rN;i++) U[i]=Nxt[i]+G[i]; /* make leadterm */
583  Nxt=NULL;
584  G=NULL;
585  cnt=1;
586  int t=0;
587  poly w=NULL;
588  poly Pn=p_One(r);
589  p_SetExpV(Pn,On,r);
590  p_Setm(Pn,r);
591 
592  while (On[iG]!=0)
593  {
594  t=log[cnt];
595 
596  w=gnc_mm_Mult_uu(Op,t,On[t],r);
597  c[cnt]=n_Mult(c[cnt-1],pGetCoeff(w),r->cf);
598  D = pNext(w); /* getting coef and rest D */
599  p_LmDelete(&w,r);
600  w=NULL;
601 
602  Op[t] += On[t]; /* update exp_vectors */
603  On[t] = 0;
604 
605  if (t!=iG) /* not the last step */
606  {
607  p_SetExpV(Pn,On,r);
608  p_Setm(Pn,r);
609 #ifdef PDEBUG
610  p_Test(Pn,r);
611 #endif
612 
613 // if (pNext(D)==0)
614 // is D a monomial? could be postponed higher
615 // {
616 // Rout=nc_mm_Mult_nn(D,Pn,r);
617 // }
618 // else
619 // {
620  Rout=gnc_p_Mult_mm(D,Pn,r);
621 // }
622  }
623  else
624  {
625  Rout=D;
626  D=NULL;
627  }
628 
629  if (Rout!=NULL)
630  {
631  Rout=__p_Mult_nn(Rout,c[cnt-1],r); /* Rest is ready */
632  out=p_Add_q(out,Rout,r);
633  Rout=NULL;
634  }
635  cnt++;
636  }
637  freeT(On,rN);
638  freeT(Op,rN);
639  p_Delete(&Pn,r);
640  omFreeSize((ADDRESS)log,(rN+1)*sizeof(int));
641 
642  /* leadterm and Prv-part */
643 
644  Rout=p_One(r);
645  /* U is lead.monomial */
646  U[0]=0;
647  p_SetExpV(Rout,U,r);
648  p_Setm(Rout,r); /* use again this name Rout */
649 #ifdef PDEBUG
650  p_Test(Rout,r);
651 #endif
652  p_SetCoeff(Rout,c[cnt-1],r);
653  out=p_Add_q(out,Rout,r);
654  freeT(U,rN);
655  freeN(c,rN+1);
656  if (cnf!=0) /* Prv is non-zero vector */
657  {
658  Rout=p_One(r);
659  Prv[0]=0;
660  p_SetExpV(Rout,Prv,r);
661  p_Setm(Rout,r);
662 #ifdef PDEBUG
663  p_Test(Rout,r);
664 #endif
665  out=gnc_mm_Mult_p(Rout,out,r); /* getting the final result */
666  freeT(Prv,rN);
667  p_Delete(&Rout,r);
668  }
669  return (out);
670 }

◆ gnc_mm_Mult_p()

poly gnc_mm_Mult_p ( const poly  m,
poly  p,
const ring  r 
)

Definition at line 402 of file old.gring.cc.

403 {
404  return( gnc_p_Mult_mm_Common(p, m, 0, r) );
405 }

◆ gnc_mm_Mult_pp()

poly gnc_mm_Mult_pp ( const poly  m,
const poly  p,
const ring  r 
)

Definition at line 407 of file old.gring.cc.

408 {
409  return( gnc_p_Mult_mm_Common(p_Copy(p,r), m, 0, r) );
410 }

◆ gnc_mm_Mult_uu()

poly gnc_mm_Mult_uu ( int *  F,
int  jG,
int  bG,
const ring  r 
)

Definition at line 673 of file old.gring.cc.

675 {
676  poly out=NULL;
677  int i;
678  number num=NULL;
679 
680  int rN=r->N;
681  int iF=r->N;
682  while ((F[iF]==0)&&(iF>0)) iF-- ; /* last exponent_num of F */
683 
684  if (iF==0) /* F==zero vector in other words */
685  {
686  out=p_One(r);
687  p_SetExp(out,jG,bG,r);
688  p_Setm(out,r);
689  return(out);
690  }
691 
692  int jF=1;
693  while ((F[jF]==0)&&(jF<=rN)) jF++; /* first exp of F */
694 
695  if (iF<=jG) /* i.e. no mixed exp_num */
696  {
697  out=p_One(r);
698  F[jG]=F[jG]+bG;
699  p_SetExpV(out,F,r);
700  p_Setm(out,r);
701  return(out);
702  }
703 
704  if (iF==jF) /* uni times uni */
705  {
706  out=gnc_uu_Mult_ww(iF,F[iF],jG,bG,r);
707  return(out);
708  }
709 
710  /* Now: F is mono with >=2 exponents, jG<iF */
711  /* check the quasi-commutative case */
712 // matrix LCOM=r->GetNC()->COM;
713 // number rescoef=n_Init(1,r);
714 // number tmpcoef=n_Init(1,r);
715 // int tmpint;
716 // i=iF;
717 // while (i>=jG+1)
718 // /* all the non-zero exponents */
719 // {
720 // if (MATELEM(LCOM,jG,i)!=NULL)
721 // {
722 // tmpcoef=pGetCoeff(MATELEM(LCOM,jG,i));
723 // tmpint=(int)F[i];
724 // nPower(tmpcoef,F[i],&tmpcoef);
725 // rescoef=nMult(rescoef,tmpcoef);
726 // i--;
727 // }
728 // else
729 // {
730 // if (F[i]!=0) break;
731 // }
732 // }
733 // if (iF==i)
734 // /* no action took place*/
735 // {
736 
737 // }
738 // else /* power the result up to bG */
739 // {
740 // nPower(rescoef,bG,&rescoef);
741 // /* + cleanup, post-processing */
742 // }
743 
744  int *Prv=(int*)omAlloc0((rN+1)*sizeof(int));
745  int *Nxt=(int*)omAlloc0((rN+1)*sizeof(int));
746  int *lF=(int *)omAlloc0((rN+1)*sizeof(int));
747 
748  int cnt=0; int cnf=0;
749  /* splitting F wrt jG */
750  for (i=1;i<=jG;i++) /* mult at the very end */
751  {
752  Prv[i]=F[i]; Nxt[i]=0;
753  if (F[i]!=0) cnf++;
754  }
755 
756  if (cnf==0)
757  {
758  freeT(Prv,rN); Prv = NULL;
759  }
760 
761  for (i=jG+1;i<=rN;i++)
762  {
763  Nxt[i]=F[i];
764  if (cnf!=0) { Prv[i]=0;}
765  if (F[i]!=0)
766  {
767  cnt++;
768  lF[cnt]=i;
769  } /* eff_part,lF_for_F */
770  }
771 
772  if (cnt==1) /* Nxt consists of 1 nonzero el-t only */
773  {
774  int q=lF[1];
775  poly Rout=p_One(r);
776  out=gnc_uu_Mult_ww(q,Nxt[q],jG,bG,r);
777 
778  freeT(Nxt,rN); Nxt = NULL;
779 
780  if (cnf!=0)
781  {
782  Prv[0]=0;
783  p_SetExpV(Rout,Prv,r);
784  p_Setm(Rout,r);
785 
786 #ifdef PDEBUG
787  p_Test(Rout,r);
788 #endif
789 
790  freeT(Prv,rN);
791  Prv = NULL;
792 
793  out=gnc_mm_Mult_p(Rout,out,r); /* getting the final result */
794  }
795 
796  freeT(lF,rN);
797  lF = NULL;
798 
799  p_Delete(&Rout,r);
800 
801  assume(Nxt == NULL);
802  assume(lF == NULL);
803  assume(Prv == NULL);
804 
805  return (out);
806  }
807 /* -------------------- MAIN ACTION --------------------- */
808 
809  poly D=NULL;
810  poly Rout=NULL;
811  number *c=(number *)omAlloc0((cnt+2)*sizeof(number));
812  c[cnt+1]=n_Init(1,r->cf);
813  i=cnt+2; /* later in freeN */
814  int *Op=Nxt;
815 
816  int *On=(int *)omAlloc0((rN+1)*sizeof(int));
817  int *U=(int *)omAlloc0((rN+1)*sizeof(int));
818 
819 
820  // pExpVectorCopy(U,Nxt);
821  memcpy(U, Nxt,(rN+1)*sizeof(int));
822  U[jG] = U[jG] + bG;
823 
824  /* Op=Nxt and initial On=(0); */
825  Nxt=NULL;
826 
827  poly Pp;
828  poly Pn;
829  int t=0;
830  int first=lF[1];
831  int nlast=lF[cnt];
832  int kk=0;
833  /* cnt--; */
834  /* now lF[cnt] should be <=iF-1 */
835 
836  while (Op[first]!=0)
837  {
838  t=lF[cnt]; /* cnt as it was computed */
839 
840  poly w=gnc_uu_Mult_ww(t,Op[t],jG,bG,r);
841  c[cnt]=n_Copy(pGetCoeff(w),r->cf);
842  D = pNext(w); /* getting coef and rest D */
843  p_LmDelete(&w,r);
844  w=NULL;
845 
846  Op[t]= 0;
847  Pp=p_One(r);
848  p_SetExpV(Pp,Op,r);
849  p_Setm(Pp,r);
850 
851  if (t<nlast)
852  {
853  kk=lF[cnt+1];
854  On[kk]=F[kk];
855 
856  Pn=p_One(r);
857  p_SetExpV(Pn,On,r);
858  p_Setm(Pn,r);
859 
860  if (t!=first) /* typical expr */
861  {
862  w=gnc_p_Mult_mm(D,Pn,r);
863  Rout=gnc_mm_Mult_p(Pp,w,r);
864  w=NULL;
865  }
866  else /* last step */
867  {
868  On[t]=0;
869  p_SetExpV(Pn,On,r);
870  p_Setm(Pn,r);
871  Rout=gnc_p_Mult_mm(D,Pn,r);
872  }
873 #ifdef PDEBUG
874  p_Test(Pp,r);
875 #endif
876  p_Delete(&Pn,r);
877  }
878  else /* first step */
879  {
880  Rout=gnc_mm_Mult_p(Pp,D,r);
881  }
882 #ifdef PDEBUG
883  p_Test(Pp,r);
884 #endif
885  p_Delete(&Pp,r);
886  num=n_Mult(c[cnt+1],c[cnt],r->cf);
887  n_Delete(&c[cnt],r->cf);
888  c[cnt]=num;
889  Rout=__p_Mult_nn(Rout,c[cnt+1],r); /* Rest is ready */
890  out=p_Add_q(out,Rout,r);
891  Pp=NULL;
892  cnt--;
893  }
894  /* only to feel safe:*/
895  Pn=Pp=NULL;
896  freeT(On,rN);
897  freeT(Op,rN);
898 
899 /* leadterm and Prv-part with coef 1 */
900 /* U[0]=exp; */
901 /* U[jG]=U[jG]+bG; */
902 /* make leadterm */
903 /* ??????????? we have done it already :-0 */
904 
905  Rout=p_One(r);
906  p_SetExpV(Rout,U,r);
907  p_Setm(Rout,r); /* use again this name */
908  p_SetCoeff(Rout,c[cnt+1],r); /* last computed coef */
909 
910  out=p_Add_q(out,Rout,r);
911 
912  Rout=NULL;
913 
914  freeT(U, rN);
915  freeN(c, i);
916  freeT(lF, rN);
917 
918  if (cnf!=0)
919  {
920  Rout=p_One(r);
921  p_SetExpV(Rout,Prv,r);
922  p_Setm(Rout,r);
923  freeT(Prv, rN);
924  out=gnc_mm_Mult_p(Rout,out,r); /* getting the final result */
925  p_Delete(&Rout,r);
926  }
927 
928  return (out);
929 }

◆ gnc_p_Mult_mm()

poly gnc_p_Mult_mm ( poly  p,
const poly  m,
const ring  r 
)

Definition at line 397 of file old.gring.cc.

398 {
399  return( gnc_p_Mult_mm_Common(p, m, 1, r) );
400 }

◆ gnc_p_Mult_mm_Common()

poly gnc_p_Mult_mm_Common ( poly  p,
const poly  m,
int  side,
const ring  r 
)

Definition at line 301 of file old.gring.cc.

304 {
305  if ((p==NULL) || (m==NULL)) return NULL;
306  /* if (pNext(p)==NULL) return(nc_mm_Mult_nn(p,pCopy(m),r)); */
307  /* excluded - the cycle will do it anyway - OK. */
308  if (p_IsConstant(m,r)) return(__p_Mult_nn(p,p_GetCoeff(m,r),r));
309 
310 #ifdef PDEBUG
311  p_Test(p,r);
312  p_Test(m,r);
313 #endif
314  poly v=NULL;
315  int rN=r->N;
316  int *P=(int *)omAlloc0((rN+1)*sizeof(int));
317  int *M=(int *)omAlloc0((rN+1)*sizeof(int));
318  /* coefficients: */
319  number cP,cM,cOut;
320  p_GetExpV(m, M, r);
321  cM=p_GetCoeff(m,r);
322  /* components:*/
323  const int expM=p_GetComp(m,r);
324  int expP=0;
325  int expOut=0;
326  /* bucket constraints: */
327  int UseBuckets=1;
328  if (pLength(p)< MIN_LENGTH_BUCKET || TEST_OPT_NOT_BUCKETS) UseBuckets=0;
329 
330  CPolynomialSummator sum(r, UseBuckets == 0);
331 
332  while (p!=NULL)
333  {
334 #ifdef PDEBUG
335  p_Test(p,r);
336 #endif
337  expP=p_GetComp(p,r);
338  if (expP==0)
339  {
340  expOut=expM;
341  }
342  else
343  {
344  if (expM==0)
345  {
346  expOut=expP;
347 #ifdef PDEBUG
348 // if (side)
349 // {
350 // PrintS("gnc_p_Mult_mm: Multiplication in the left module from the right");
351 // }
352 #endif
353  }
354  else
355  {
356  /* REPORT_ERROR */
357 #ifdef PDEBUG
358  const char* s;
359  if (side==1) s="gnc_p_Mult_mm";
360  else s="gnc_mm_Mult_p";
361  Print("%s: exponent mismatch %d and %d\n",s,expP,expM);
362 #endif
363  expOut=0;
364  }
365  }
366  p_GetExpV(p,P,r);
367  cP=pGetCoeff(p);
368  cOut=n_Mult(cP,cM,r->cf);
369  if (side==1)
370  {
371  v = gnc_mm_Mult_nn(P, M, r);
372  }
373  else
374  {
375  v = gnc_mm_Mult_nn(M, P, r);
376  }
377  v = __p_Mult_nn(v,cOut,r);
378  n_Delete(&cOut,r->cf);
379  p_SetCompP(v,expOut,r);
380 
381  sum += v;
382 
383  p_LmDelete(&p,r);
384  }
385  freeT(P,rN);
386  freeT(M,rN);
387 
388  return(sum);
389 }

◆ gnc_p_ProcsSet()

static void gnc_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)
inlinestatic

Definition at line 3140 of file old.gring.cc.

3141 {
3142  // "commutative"
3143  p_Procs->p_Mult_mm = rGR->p_Procs->p_Mult_mm = gnc_p_Mult_mm;
3144  p_Procs->pp_Mult_mm = rGR->p_Procs->pp_Mult_mm = gnc_pp_Mult_mm;
3145  p_Procs->p_Minus_mm_Mult_qq = rGR->p_Procs->p_Minus_mm_Mult_qq = nc_p_Minus_mm_Mult_qq;
3146 
3147  // non-commutaitve multiplication by monomial from the left
3148  rGR->GetNC()->p_Procs.mm_Mult_p = gnc_mm_Mult_p;
3149  rGR->GetNC()->p_Procs.mm_Mult_pp = gnc_mm_Mult_pp;
3150 
3151 #if 0
3152  // Previous Plural's implementation...
3153  rGR->GetNC()->p_Procs.SPoly = gnc_CreateSpolyOld;
3154  rGR->GetNC()->p_Procs.ReduceSPoly = gnc_ReduceSpolyOld;
3155 
3156  rGR->GetNC()->p_Procs.BucketPolyRed = gnc_kBucketPolyRedOld;
3157  rGR->GetNC()->p_Procs.BucketPolyRed_Z= gnc_kBucketPolyRed_ZOld;
3158 #else
3159  // A bit cleaned up and somewhat rewritten functions...
3160  rGR->GetNC()->p_Procs.SPoly = gnc_CreateSpolyNew;
3161  rGR->GetNC()->p_Procs.ReduceSPoly = gnc_ReduceSpolyNew;
3162 
3163  rGR->GetNC()->p_Procs.BucketPolyRed = gnc_kBucketPolyRedNew;
3164  rGR->GetNC()->p_Procs.BucketPolyRed_Z= gnc_kBucketPolyRed_ZNew;
3165 #endif
3166 
3167  // warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object?
3168  if (rHasLocalOrMixedOrdering(rGR))
3169  rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_mora);
3170  else
3171  rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(gnc_gr_bba);
3172 
3173 /////////// rGR->GetNC()->p_Procs.GB = gnc_gr_bba; // bba even for local case!
3174 // old /// r->GetNC()->GB() = gnc_gr_bba;
3175 // rGR->GetNC()->p_Procs.GlobalGB = gnc_gr_bba;
3176 // rGR->GetNC()->p_Procs.LocalGB = gnc_gr_mora;
3177 // const ring save = currRing; if( save != r ) rChangeCurrRing(r);
3178 // ideal res = gnc_gr_bba(F, Q, w, hilb, strat/*, r*/);
3179 // if( save != r ) rChangeCurrRing(save); return (res);
3180 
3181 
3182 #if 0
3183  // Old Stuff
3184  p_Procs->p_Mult_mm = gnc_p_Mult_mm;
3185  _p_procs->p_Mult_mm = gnc_p_Mult_mm;
3186 
3187  p_Procs->pp_Mult_mm = gnc_pp_Mult_mm;
3188  _p_procs->pp_Mult_mm = gnc_pp_Mult_mm;
3189 
3190  p_Procs->p_Minus_mm_Mult_qq = NULL; // gnc_p_Minus_mm_Mult_qq_ign;
3191  _p_procs->p_Minus_mm_Mult_qq= NULL; // gnc_p_Minus_mm_Mult_qq_ign;
3192 
3193  r->GetNC()->mmMultP() = gnc_mm_Mult_p;
3194  r->GetNC()->mmMultPP() = gnc_mm_Mult_pp;
3195 
3196  r->GetNC()->SPoly() = gnc_CreateSpoly;
3197  r->GetNC()->ReduceSPoly() = gnc_ReduceSpoly;
3198 
3199 #endif
3200 }

◆ gnc_pp_Mult_mm() [1/2]

poly gnc_pp_Mult_mm ( const poly  p,
const poly  m,
const ring  r 
)

Definition at line 392 of file old.gring.cc.

393 {
394  return( gnc_p_Mult_mm_Common(p_Copy(p,r), m, 1, r) );
395 }

◆ gnc_pp_Mult_mm() [2/2]

poly gnc_pp_Mult_mm ( const poly  p,
const poly  m,
const ring  r,
poly &  last 
)

◆ gnc_ReduceSpolyNew()

poly gnc_ReduceSpolyNew ( const poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1398 of file old.gring.cc.

1399 {
1400  assume(p_LmDivisibleBy(p1, p2, r));
1401 
1402  const long lCompP1 = p_GetComp(p1,r);
1403  const long lCompP2 = p_GetComp(p2,r);
1404 
1405  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1406  {
1407 #ifdef PDEBUG
1408  WerrorS("gnc_ReduceSpolyNew: different non-zero components!");
1409 #endif
1410  return(NULL);
1411  }
1412 
1413  poly m = p_One(r);
1414  p_ExpVectorDiff(m, p2, p1, r);
1415  //p_Setm(m,r);
1416 #ifdef PDEBUG
1417  p_Test(m,r);
1418 #endif
1419 
1420  /* pSetComp(m,r)=0? */
1421  poly N = nc_mm_Mult_p(m, p_Head(p1,r), r);
1422 
1423  number C = p_GetCoeff(N, r);
1424  number cF = p_GetCoeff(p2, r);
1425 
1426  /* GCD stuff */
1427  number cG = n_SubringGcd(C, cF, r->cf);
1428 
1429  if (!n_IsOne(cG, r->cf))
1430  {
1431  cF = n_Div(cF, cG, r->cf); n_Normalize(cF, r->cf);
1432  C = n_Div(C, cG, r->cf); n_Normalize(C, r->cf);
1433  }
1434  else
1435  {
1436  cF = n_Copy(cF, r->cf);
1437  C = n_Copy(C, r->cf);
1438  }
1439  n_Delete(&cG,r->cf);
1440 
1441  p2 = __p_Mult_nn(p2, C, r); // p2 !!!
1442  p_Test(p2,r);
1443  n_Delete(&C,r->cf);
1444 
1445  poly out = nc_mm_Mult_pp(m, pNext(p1), r);
1446  p_Delete(&m,r);
1447 
1448  N = p_Add_q(N, out, r);
1449  p_Test(N,r);
1450 
1451  if (!n_IsMOne(cF,r->cf)) // ???
1452  {
1453  cF = n_InpNeg(cF,r->cf);
1454  N = __p_Mult_nn(N, cF, r);
1455  p_Test(N,r);
1456  }
1457  n_Delete(&cF,r->cf);
1458 
1459  out = p_Add_q(p2,N,r); // delete N, p2
1460  p_Test(out,r);
1461  if ( out!=NULL ) p_Cleardenom(out,r);
1462  return(out);
1463 }

◆ gnc_ReduceSpolyOld()

poly gnc_ReduceSpolyOld ( const poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1342 of file old.gring.cc.

1343 {
1344  assume(p_LmDivisibleBy(p1, p2, r));
1345 
1346 #ifdef PDEBUG
1347  if (p_GetComp(p1,r)!=p_GetComp(p2,r)
1348  && (p_GetComp(p1,r)!=0)
1349  && (p_GetComp(p2,r)!=0))
1350  {
1351  dReportError("nc_ReduceSpolyOld: different components");
1352  return(NULL);
1353  }
1354 #endif
1355  poly m = p_One(r);
1356  p_ExpVectorDiff(m,p2,p1,r);
1357  //p_Setm(m,r);
1358 #ifdef PDEBUG
1359  p_Test(m,r);
1360 #endif
1361  /* pSetComp(m,r)=0? */
1362  poly N = nc_mm_Mult_p(m, p_Head(p1,r), r);
1363  number C = p_GetCoeff(N, r);
1364  number cF = p_GetCoeff(p2, r);
1365  /* GCD stuff */
1366  number cG = n_SubringGcd(C, cF, r->cf);
1367  if ( !n_IsOne(cG,r->cf) )
1368  {
1369  cF = n_Div(cF, cG, r->cf); n_Normalize(cF, r->cf);
1370  C = n_Div(C, cG, r->cf); n_Normalize(C, r->cf);
1371  }
1372  else
1373  {
1374  cF = n_Copy(cF, r->cf);
1375  C = n_Copy(C, r->cf);
1376  }
1377  n_Delete(&cG,r->cf);
1378  p2 = __p_Mult_nn(p2, C, r);
1379  poly out = nc_mm_Mult_pp(m, pNext(p1), r);
1380  N = p_Add_q(N, out, r);
1381  p_Test(p2,r);
1382  p_Test(N,r);
1383  if (!n_IsMOne(cF,r->cf))
1384  {
1385  cF = n_InpNeg(cF,r->cf);
1386  N = __p_Mult_nn(N, cF, r);
1387  p_Test(N,r);
1388  }
1389  out = p_Add_q(p2,N,r);
1390  p_Test(out,r);
1391  if ( out!=NULL ) p_Cleardenom(out,r);
1392  p_Delete(&m,r);
1393  n_Delete(&cF,r->cf);
1394  n_Delete(&C,r->cf);
1395  return(out);
1396 }

◆ gnc_uu_Mult_ww()

poly gnc_uu_Mult_ww ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)

Definition at line 1039 of file old.gring.cc.

1042 {
1043  /* Check zero exceptions, (q-)commutativity and is there something to do? */
1044  assume(a!=0);
1045  assume(b!=0);
1046  poly out=p_One(r);
1047  if (i<=j)
1048  {
1049  p_SetExp(out,i,a,r);
1050  p_AddExp(out,j,b,r);
1051  p_Setm(out,r);
1052  return(out);
1053  }/* zero exeptions and usual case */
1054  /* if ((a==0)||(b==0)||(i<=j)) return(out); */
1055 
1056  if (MATELEM(r->GetNC()->COM,j,i)!=NULL)
1057  /* commutative or quasicommutative case */
1058  {
1059  p_SetExp(out,i,a,r);
1060  p_AddExp(out,j,b,r);
1061  p_Setm(out,r);
1062  if (n_IsOne(pGetCoeff(MATELEM(r->GetNC()->COM,j,i)),r->cf)) /* commutative case */
1063  {
1064  return(out);
1065  }
1066  else
1067  {
1068  number tmp_number=pGetCoeff(MATELEM(r->GetNC()->COM,j,i)); /* quasicommutative case */
1069  n_Power(tmp_number,a*b,&tmp_number, r->cf); // BUG! ;-(
1070  p_SetCoeff(out,tmp_number,r);
1071  return(out);
1072  }
1073  }/* end_of commutative or quasicommutative case */
1074  p_Delete(&out,r);
1075 
1076 
1077  if(ncExtensions(NOCACHEMASK) && !ncExtensions(NOFORMULAMASK)) // don't use cache whenever possible!
1078  { // without cache!?
1079  CFormulaPowerMultiplier* FormulaMultiplier = GetFormulaPowerMultiplier(r);
1081 
1082  if( FormulaMultiplier != NULL )
1083  PairType = FormulaMultiplier->GetPair(j, i);
1084 
1085  if( PairType != _ncSA_notImplemented )
1086  // // return FormulaMultiplier->Multiply(j, i, b, a);
1087  return CFormulaPowerMultiplier::Multiply( PairType, j, i, b, a, r);
1088  }
1089 
1090 
1091  /* we are here if i>j and variables do not commute or quasicommute */
1092  /* in fact, now a>=1 and b>=1; and j<i */
1093  /* now check whether the polynomial is already computed */
1094  int rN=r->N;
1095  int vik = UPMATELEM(j,i,rN);
1096  int cMTsize=r->GetNC()->MTsize[vik];
1097  int newcMTsize=0;
1098  newcMTsize=si_max(a,b);
1099 
1100  if (newcMTsize<=cMTsize)
1101  {
1102  out = nc_p_CopyGet(MATELEM(r->GetNC()->MT[vik],a,b),r);
1103  if (out !=NULL) return (out);
1104  }
1105  int k,m;
1106  if (newcMTsize > cMTsize)
1107  {
1108  int inM=(((newcMTsize+6)/7)*7);
1109  assume (inM>=newcMTsize);
1110  newcMTsize = inM;
1111  // matrix tmp = (matrix)omAlloc0(inM*inM*sizeof(poly));
1112  matrix tmp = mpNew(newcMTsize,newcMTsize);
1113 
1114  for (k=1;k<=cMTsize;k++)
1115  {
1116  for (m=1;m<=cMTsize;m++)
1117  {
1118  out = MATELEM(r->GetNC()->MT[UPMATELEM(j,i,rN)],k,m);
1119  if ( out != NULL )
1120  {
1121  MATELEM(tmp,k,m) = out;/*MATELEM(r->GetNC()->MT[UPMATELEM(j,i,rN)],k,m)*/
1122  // omCheckAddr(tmp->m);
1123  MATELEM(r->GetNC()->MT[UPMATELEM(j,i,rN)],k,m)=NULL;
1124  // omCheckAddr(r->GetNC()->MT[UPMATELEM(j,i,rN)]->m);
1125  out=NULL;
1126  }
1127  }
1128  }
1129  id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(j,i,rN)]),r);
1130  r->GetNC()->MT[UPMATELEM(j,i,rN)] = tmp;
1131  tmp=NULL;
1132  r->GetNC()->MTsize[UPMATELEM(j,i,rN)] = newcMTsize;
1133  }
1134  /* The update of multiplication matrix is finished */
1135 
1136 
1137  return gnc_uu_Mult_ww_formula(i, a, j, b, r);
1138 
1139  out = gnc_uu_Mult_ww_vert(i, a, j, b, r);
1140  // out = nc_uu_Mult_ww_horvert(i, a, j, b, r);
1141  return(out);
1142 }

◆ gnc_uu_Mult_ww_formula()

static poly gnc_uu_Mult_ww_formula ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)
inlinestatic

Definition at line 1006 of file old.gring.cc.

1007 {
1009  return gnc_uu_Mult_ww_vert(i, a, j, b, r);
1010 
1011  CFormulaPowerMultiplier* FormulaMultiplier = GetFormulaPowerMultiplier(r);
1013 
1014  if( FormulaMultiplier != NULL )
1015  PairType = FormulaMultiplier->GetPair(j, i);
1016 
1017 
1018  if( PairType == _ncSA_notImplemented )
1019  return gnc_uu_Mult_ww_vert(i, a, j, b, r);
1020 
1021 
1022  // return FormulaMultiplier->Multiply(j, i, b, a);
1023  poly t = CFormulaPowerMultiplier::Multiply( PairType, j, i, b, a, r);
1024 
1025  int rN=r->N;
1026  matrix cMT = r->GetNC()->MT[UPMATELEM(j,i,rN)]; /* cMT=current MT */
1027 
1028 
1029  MATELEM(cMT, a, b) = nc_p_CopyPut(t,r);
1030 
1031  // t=MATELEM(cMT,a,b);
1032 // t= nc_p_CopyGet(MATELEM(cMT,a,b),r);
1033  // return(p_Copy(t,r));
1034  /* since the last computed element was cMT[a,b] */
1035  return(t);
1036 }

◆ gnc_uu_Mult_ww_horvert()

poly gnc_uu_Mult_ww_horvert ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)

Definition at line 1144 of file old.gring.cc.

1146 {
1147  int k,m;
1148  int rN=r->N;
1149  matrix cMT=r->GetNC()->MT[UPMATELEM(j,i,rN)]; /* cMT=current MT */
1150 
1151  poly x=p_One(r);p_SetExp(x,j,1,r);p_Setm(x,r);/* var(j); */
1152  poly y=p_One(r);p_SetExp(y,i,1,r);p_Setm(y,r); /*var(i); for convenience */
1153 #ifdef PDEBUG
1154  p_Test(x,r);
1155  p_Test(y,r);
1156 #endif
1157 
1158  poly t=NULL;
1159 
1160  int toXY;
1161  int toYX;
1162 
1163  if (a==1) /* y*x^b, b>=2 */
1164  {
1165  toXY=b-1;
1166  while ( (MATELEM(cMT,1,toXY)==NULL) && (toXY>=2)) toXY--;
1167  for (m=toXY+1;m<=b;m++)
1168  {
1169  t=MATELEM(cMT,1,m);
1170  if (t==NULL) /* remove after debug */
1171  {
1172  t = p_Copy(MATELEM(cMT,1,m-1),r);
1173  t = gnc_p_Mult_mm(t,x,r);
1174  MATELEM(cMT,1,m) = t;
1175  /* omCheckAddr(cMT->m); */
1176  }
1177  else
1178  {
1179  /* Error, should never get there */
1180  WarnS("Error: a=1; MATELEM!=0");
1181  }
1182  t=NULL;
1183  }
1184  return(p_Copy(MATELEM(cMT,1,b),r));
1185  }
1186 
1187  if (b==1) /* y^a*x, a>=2 */
1188  {
1189  toYX=a-1;
1190  while ( (MATELEM(cMT,toYX,1)==NULL) && (toYX>=2)) toYX--;
1191  for (m=toYX+1;m<=a;m++)
1192  {
1193  t=MATELEM(cMT,m,1);
1194  if (t==NULL) /* remove after debug */
1195  {
1196  t = p_Copy(MATELEM(cMT,m-1,1),r);
1197  t = gnc_mm_Mult_p(y,t,r);
1198  MATELEM(cMT,m,1) = t;
1199  /* omCheckAddr(cMT->m); */
1200  }
1201  else
1202  {
1203  /* Error, should never get there */
1204  WarnS("Error: b=1, MATELEM!=0");
1205  }
1206  t=NULL;
1207  }
1208  return(p_Copy(MATELEM(cMT,a,1),r));
1209  }
1210 
1211 /* ------------ Main Cycles ----------------------------*/
1212  /* a>1, b>1 */
1213 
1214  int dXY=0; int dYX=0;
1215  /* dXY = distance for computing x-mult, then y-mult */
1216  /* dYX = distance for computing y-mult, then x-mult */
1217  int toX=a-1; int toY=b-1; /* toX = to axe X, toY = to axe Y */
1218  toXY=b-1; toYX=a-1;
1219  /* if toX==0, toXY = dist. to computed y * x^toXY */
1220  /* if toY==0, toYX = dist. to computed y^toYX * x */
1221  while ( (MATELEM(cMT,toX,b)==NULL) && (toX>=1)) toX--;
1222  if (toX==0) /* the whole column is not computed yet */
1223  {
1224  while ( (MATELEM(cMT,1,toXY)==NULL) && (toXY>=1)) toXY--;
1225  /* toXY >=1 */
1226  dXY=b-1-toXY;
1227  }
1228  dXY=dXY+a-toX; /* the distance to nearest computed y^toX x^b */
1229 
1230  while ( (MATELEM(cMT,a,toY)==NULL) && (toY>=1)) toY--;
1231  if (toY==0) /* the whole row is not computed yet */
1232  {
1233  while ( (MATELEM(cMT,toYX,1)==NULL) && (toYX>=1)) toYX--;
1234  /* toYX >=1 */
1235  dYX=a-1-toYX;
1236  }
1237  dYX=dYX+b-toY; /* the distance to nearest computed y^a x^toY */
1238 
1239  if (dYX>=dXY)
1240  {
1241  /* first x, then y */
1242  if (toX==0) /* start with the row*/
1243  {
1244  for (m=toXY+1;m<=b;m++)
1245  {
1246  t=MATELEM(cMT,1,m);
1247  if (t==NULL) /* remove after debug */
1248  {
1249  t = p_Copy(MATELEM(cMT,1,m-1),r);
1250  t = gnc_p_Mult_mm(t,x,r);
1251  MATELEM(cMT,1,m) = t;
1252  /* omCheckAddr(cMT->m); */
1253  }
1254  else
1255  {
1256  /* Error, should never get there */
1257  WarnS("dYX>=dXY,toXY; MATELEM==0");
1258  }
1259  t=NULL;
1260  }
1261  toX=1; /* y*x^b is computed */
1262  }
1263  /* Now toX>=1 */
1264  for (k=toX+1;k<=a;k++)
1265  {
1266  t=MATELEM(cMT,k,b);
1267  if (t==NULL) /* remove after debug */
1268  {
1269  t = p_Copy(MATELEM(cMT,k-1,b),r);
1270  t = gnc_mm_Mult_p(y,t,r);
1271  MATELEM(cMT,k,b) = t;
1272  /* omCheckAddr(cMT->m); */
1273  }
1274  else
1275  {
1276  /* Error, should never get there */
1277  WarnS("dYX>=dXY,toX; MATELEM==0");
1278  }
1279  t=NULL;
1280  }
1281  } /* endif (dYX>=dXY) */
1282 
1283 
1284  if (dYX<dXY)
1285  {
1286  /* first y, then x */
1287  if (toY==0) /* start with the column*/
1288  {
1289  for (m=toYX+1;m<=a;m++)
1290  {
1291  t=MATELEM(cMT,m,1);
1292  if (t==NULL) /* remove after debug */
1293  {
1294  t = p_Copy(MATELEM(cMT,m-1,1),r);
1295  t = gnc_mm_Mult_p(y,t,r);
1296  MATELEM(cMT,m,1) = t;
1297  /* omCheckAddr(cMT->m); */
1298  }
1299  else
1300  {
1301  /* Error, should never get there */
1302  WarnS("dYX<dXY,toYX; MATELEM==0");
1303  }
1304  t=NULL;
1305  }
1306  toY=1; /* y^a*x is computed */
1307  }
1308  /* Now toY>=1 */
1309  for (k=toY+1;k<=b;k++)
1310  {
1311  t=MATELEM(cMT,a,k);
1312  if (t==NULL) /* remove after debug */
1313  {
1314  t = p_Copy(MATELEM(cMT,a,k-1),r);
1315  t = gnc_p_Mult_mm(t,x,r);
1316  MATELEM(cMT,a,k) = t;
1317  /* omCheckAddr(cMT->m); */
1318  }
1319  else
1320  {
1321  /* Error, should never get there */
1322  WarnS("dYX<dXY,toY; MATELEM==0");
1323  }
1324  t=NULL;
1325  }
1326  } /* endif (dYX<dXY) */
1327 
1328  p_Delete(&x,r);
1329  p_Delete(&y,r);
1330  t=p_Copy(MATELEM(cMT,a,b),r);
1331  return(t); /* since the last computed element was cMT[a,b] */
1332 }

◆ gnc_uu_Mult_ww_vert()

poly gnc_uu_Mult_ww_vert ( int  i,
int  a,
int  j,
int  b,
const ring  r 
)

Definition at line 931 of file old.gring.cc.

932 {
933  int k,m;
934  int rN=r->N;
935  const int cMTindex = UPMATELEM(j,i,rN);
936  matrix cMT=r->GetNC()->MT[cMTindex]; /* cMT=current MT */
937 
938  poly x=p_One(r);p_SetExp(x,j,1,r);p_Setm(x,r);
939 /* var(j); */
940  poly y=p_One(r);p_SetExp(y,i,1,r);p_Setm(y,r);
941 /*var(i); for convenience */
942 #ifdef PDEBUG
943  p_Test(x,r);
944  p_Test(y,r);
945 #endif
946  poly t=NULL;
947 /* ------------ Main Cycles ----------------------------*/
948 
949  for (k=2;k<=a;k++)
950  {
951  t = MATELEM(cMT,k,1);
952 
953  if (t==NULL) /* not computed yet */
954  {
955  t = nc_p_CopyGet(MATELEM(cMT,k-1,1),r);
956  // t=p_Copy(MATELEM(cMT,k-1,1),r);
957  t = gnc_mm_Mult_p(y,t,r);
958  cMT=r->GetNC()->MT[cMTindex]; // since multiplication can change the MT table...
959  assume( t != NULL );
960 #ifdef PDEBUG
961  p_Test(t,r);
962 #endif
963  MATELEM(cMT,k,1) = nc_p_CopyPut(t,r);
964  // omCheckAddr(cMT->m);
965  p_Delete(&t,r);
966  }
967  t=NULL;
968  }
969 
970  for (m=2;m<=b;m++)
971  {
972  t = MATELEM(cMT,a,m);
973  // t=MATELEM(cMT,a,m);
974  if (t==NULL) //not computed yet
975  {
976  t = nc_p_CopyGet(MATELEM(cMT,a,m-1),r);
977  assume( t != NULL );
978  // t=p_Copy(MATELEM(cMT,a,m-1),r);
979  t = gnc_p_Mult_mm(t,x,r);
980  cMT=r->GetNC()->MT[cMTindex]; // since multiplication can change the MT table...
981 #ifdef PDEBUG
982  p_Test(t,r);
983 #endif
984  MATELEM(cMT,a,m) = nc_p_CopyPut(t,r);
985  // MATELEM(cMT,a,m) = t;
986  // omCheckAddr(cMT->m);
987  p_Delete(&t,r);
988  }
989  t=NULL;
990  }
991  p_Delete(&x,r);
992  p_Delete(&y,r);
993  t=MATELEM(cMT,a,b);
994  assume( t != NULL );
995 
996  t= nc_p_CopyGet(t,r);
997 #ifdef PDEBUG
998  p_Test(t,r);
999 #endif
1000  // return(p_Copy(t,r));
1001  /* since the last computed element was cMT[a,b] */
1002  return(t);
1003 }

◆ idOppose()

ideal idOppose ( ring  Rop,
ideal  I,
const ring  dst 
)

opposes a module I from Rop to currRing(dst)

Definition at line 3406 of file old.gring.cc.

3407 {
3408  /* the simplest case:*/
3409  if ( Rop == dst ) return id_Copy(I, dst);
3410 
3411  /* check Rop == rOpposite(currRing) */
3412  if (!rIsLikeOpposite(dst, Rop))
3413  {
3414  WarnS("an opposite ring should be used");
3415  return NULL;
3416  }
3417  int i;
3418  ideal idOp = idInit(I->ncols, I->rank);
3419  for (i=0; i< (I->ncols)*(I->nrows); i++)
3420  {
3421  idOp->m[i] = pOppose(Rop,I->m[i], dst);
3422  }
3423  id_Test(idOp, dst);
3424  return idOp;
3425 }

◆ nc_CallPlural()

BOOLEAN nc_CallPlural ( matrix  CCC,
matrix  DDD,
poly  CCN,
poly  DDN,
ring  r,
bool  bSetupQuotient,
bool  bCopyInput,
bool  bBeQuiet,
ring  curr,
bool  dummy_ring 
)

returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation!

Definition at line 2681 of file old.gring.cc.

2686 {
2687  assume( r != NULL );
2688  assume( curr != NULL );
2689 
2690  if( !bSetupQuotient)
2691  assume( (r->qideal == NULL) ); // The basering must NOT be a qring!??
2692 
2693  assume( rSamePolyRep(r, curr) || bCopyInput ); // wrong assumption?
2694 
2695 
2696  if( r->N == 1 ) // clearly commutative!!!
2697  {
2698  assume(
2699  ( (CCC != NULL) && (MATCOLS(CCC) == 1) && (MATROWS(CCC) == 1) && (MATELEM(CCC,1,1) == NULL) ) ||
2700  ( (CCN == NULL) )
2701  );
2702 
2703  assume(
2704  ( (DDD != NULL) && (MATCOLS(DDD) == 1) && (MATROWS(DDD) == 1) && (MATELEM(DDD,1,1) == NULL) ) ||
2705  ( (DDN == NULL) )
2706  );
2707  if(!dummy_ring)
2708  {
2709  WarnS("commutative ring with 1 variable");
2710  return FALSE;
2711  }
2712  }
2713 
2714  // there must be:
2715  assume( (CCC != NULL) != (CCN != NULL) ); // exactly one data about coeffs (C).
2716  assume( !((DDD != NULL) && (DDN != NULL)) ); // at most one data about tails (D).
2717 
2718 // ring save = currRing;
2719 // if( save != curr )
2720 // rChangeCurrRing(curr);
2721 
2722 
2723 #if OUTPUT
2724  if( CCC != NULL )
2725  {
2726  PrintS("nc_CallPlural(), Input data, CCC: \n");
2727  iiWriteMatrix(CCC, "C", 2, curr, 4);
2728  }
2729  if( DDD != NULL )
2730  {
2731  PrintS("nc_CallPlural(), Input data, DDD: \n");
2732  iiWriteMatrix(DDD, "D", 2, curr, 4);
2733  }
2734 #endif
2735 
2736 
2737 #ifndef SING_NDEBUG
2738  if (CCC!=NULL) id_Test((ideal)CCC, curr);
2739  if (DDD!=NULL) id_Test((ideal)DDD, curr);
2740  p_Test(CCN, curr);
2741  p_Test(DDN, curr);
2742 #endif
2743 
2744  if( (!bBeQuiet) && (r->GetNC() != NULL) )
2745  WarnS("going to redefine the algebra structure");
2746 
2747 // if( currRing != r )
2748 // rChangeCurrRing(r);
2749 
2750  matrix CC = NULL;
2751  poly CN = NULL;
2752  matrix C; bool bCnew = false;
2753 
2754  matrix DD = NULL;
2755  poly DN = NULL;
2756  matrix D; bool bDnew = false;
2757 
2758  number nN, pN, qN;
2759 
2760  bool IsSkewConstant = false, tmpIsSkewConstant;
2761  int i, j;
2762 
2763  nc_type nctype = nc_undef;
2764 
2765  //////////////////////////////////////////////////////////////////
2766  // check the correctness of arguments, without any real chagnes!!!
2767 
2768 
2769 
2770  // check C
2771  if ((CCC != NULL) && ( (MATCOLS(CCC)==1) || MATROWS(CCC)==1 ) )
2772  {
2773  CN = MATELEM(CCC,1,1);
2774  }
2775  else
2776  {
2777  if ((CCC != NULL) && ( (MATCOLS(CCC)!=r->N) || (MATROWS(CCC)!=r->N) ))
2778  {
2779  Werror("Square %d x %d matrix expected", r->N, r->N);
2780 
2781 // if( currRing != save )
2782 // rChangeCurrRing(save);
2783  return TRUE;
2784  }
2785  }
2786  if (( CCC != NULL) && (CC == NULL)) CC = CCC; // mp_Copy(CCC, ?); // bug!?
2787  if (( CCN != NULL) && (CN == NULL)) CN = CCN;
2788 
2789  // check D
2790  if ((DDD != NULL) && ( (MATCOLS(DDD)==1) || MATROWS(DDD)==1 ) )
2791  {
2792  DN = MATELEM(DDD,1,1);
2793  }
2794  else
2795  {
2796  if ((DDD != NULL) && ( (MATCOLS(DDD)!=r->N) || (MATROWS(DDD)!=r->N) ))
2797  {
2798  Werror("Square %d x %d matrix expected",r->N,r->N);
2799 
2800 // if( currRing != save )
2801 // rChangeCurrRing(save);
2802  return TRUE;
2803  }
2804  }
2805 
2806  if (( DDD != NULL) && (DD == NULL)) DD = DDD; // mp_Copy(DDD, ?); // ???
2807  if (( DDN != NULL) && (DN == NULL)) DN = DDN;
2808 
2809  // further checks and some analysis:
2810  // all data in 'curr'!
2811  if (CN != NULL) /* create matrix C = CN * Id */
2812  {
2813  if (!p_IsConstant(CN,curr))
2814  {
2815  WerrorS("Incorrect input : non-constants are not allowed as coefficients (first argument)");
2816  return TRUE;
2817  }
2818  assume(p_IsConstant(CN,curr));
2819 
2820  nN = pGetCoeff(CN);
2821  if (n_IsZero(nN, curr->cf))
2822  {
2823  WerrorS("Incorrect input : zero coefficients are not allowed");
2824 
2825 // if( currRing != save )
2826 // rChangeCurrRing(save);
2827  return TRUE;
2828  }
2829 
2830  if (n_IsOne(nN, curr->cf))
2831  nctype = nc_lie;
2832  else
2833  nctype = nc_general;
2834 
2835  IsSkewConstant = true;
2836 
2837  C = mpNew(r->N,r->N); // ring independent!
2838  bCnew = true;
2839 
2840  for(i=1; i<r->N; i++)
2841  for(j=i+1; j<=r->N; j++)
2842  MATELEM(C,i,j) = prCopyR_NoSort(CN, curr, r); // nc_p_CopyPut(CN, r); // copy CN from curr into r
2843 
2844 #ifndef SING_NDEBUG
2845  id_Test((ideal)C, r);
2846 #endif
2847 
2848  } else
2849  if ( (CN == NULL) && (CC != NULL) ) /* copy matrix C */
2850  {
2851  /* analyze C */
2852 
2853  BOOLEAN pN_set=FALSE;
2854  pN = n_Init(0,curr->cf);
2855 
2856  if( r->N > 1 )
2857  if ( MATELEM(CC,1,2) != NULL )
2858  {
2859  if (!pN_set) n_Delete(&pN,curr->cf); // free initial nInit(0)
2860  pN = p_GetCoeff(MATELEM(CC,1,2), curr);
2861  pN_set=TRUE;
2862  }
2863 
2864  tmpIsSkewConstant = true;
2865 
2866  for(i=1; i<r->N; i++)
2867  for(j=i+1; j<=r->N; j++)
2868  {
2869  if (MATELEM(CC,i,j) == NULL)
2870  qN = NULL;
2871  else
2872  {
2873  if (!p_IsConstant(MATELEM(CC,i,j),curr))
2874  {
2875  Werror("Incorrect input : non-constants are not allowed as coefficients (first argument at [%d, %d])", i, j);
2876  return TRUE;
2877  }
2878  assume(p_IsConstant(MATELEM(CC,i,j),curr));
2879  qN = p_GetCoeff(MATELEM(CC,i,j),curr);
2880  }
2881 
2882 
2883  if ( qN == NULL ) /* check the consistency: Cij!=0 */
2884  // find also illegal pN
2885  {
2886  WerrorS("Incorrect input : matrix of coefficients contains zeros in the upper triangle");
2887 
2888 // if( currRing != save )
2889 // rChangeCurrRing(save);
2890  return TRUE;
2891  }
2892 
2893  if (!n_Equal(pN, qN, curr->cf)) tmpIsSkewConstant = false;
2894  }
2895 
2896  if( bCopyInput )
2897  {
2898  C = mp_Copy(CC, curr, r); // Copy C into r!!!???
2899 #ifndef SING_NDEBUG
2900  id_Test((ideal)C, r);
2901 #endif
2902  bCnew = true;
2903  }
2904  else
2905  C = CC;
2906 
2907  IsSkewConstant = tmpIsSkewConstant;
2908 
2909  if ( tmpIsSkewConstant && n_IsOne(pN, curr->cf) )
2910  nctype = nc_lie;
2911  else
2912  nctype = nc_general;
2913  if (!pN_set) n_Delete(&pN,curr->cf); // free initial nInit(0)
2914  }
2915 
2916  /* initialition of the matrix D */
2917  if ( DD == NULL ) /* we treat DN only (it could also be NULL) */
2918  {
2919  D = mpNew(r->N,r->N); bDnew = true;
2920 
2921  if (DN == NULL)
2922  {
2923  if ( (nctype == nc_lie) || (nctype == nc_undef) )
2924  nctype = nc_comm; /* it was nc_skew earlier */
2925  else /* nc_general, nc_skew */
2926  nctype = nc_skew;
2927  }
2928  else /* DN != NULL */
2929  for(i=1; i<r->N; i++)
2930  for(j=i+1; j<=r->N; j++)
2931  MATELEM(D,i,j) = prCopyR_NoSort(DN, curr, r); // project DN into r->GetNC()->basering!
2932 #ifndef SING_NDEBUG
2933  id_Test((ideal)D, r);
2934 #endif
2935  }
2936  else /* DD != NULL */
2937  {
2938  bool b = true; // DD == null ?
2939 
2940  for(int i = 1; (i < r->N) && b; i++)
2941  for(int j = i+1; (j <= r->N) && b; j++)
2942  if (MATELEM(DD, i, j) != NULL)
2943  {
2944  b = false;
2945  break;
2946  }
2947 
2948  if (b) // D == NULL!!!
2949  {
2950  if ( (nctype == nc_lie) || (nctype == nc_undef) )
2951  nctype = nc_comm; /* it was nc_skew earlier */
2952  else /* nc_general, nc_skew */
2953  nctype = nc_skew;
2954  }
2955 
2956  if( bCopyInput )
2957  {
2958  D = mp_Copy(DD, curr, r); // Copy DD into r!!!
2959 #ifndef SING_NDEBUG
2960  id_Test((ideal)D, r);
2961 #endif
2962  bDnew = true;
2963  }
2964  else
2965  D = DD;
2966  }
2967 
2968  assume( C != NULL );
2969  assume( D != NULL );
2970 
2971 #if OUTPUT
2972  PrintS("nc_CallPlural(), Computed data, C: \n");
2973  iiWriteMatrix(C, "C", 2, r, 4);
2974 
2975  PrintS("nc_CallPlural(), Computed data, D: \n");
2976  iiWriteMatrix(D, "D", 2, r, 4);
2977 
2978  Print("\nTemporary: type = %d, IsSkewConstant = %d\n", nctype, IsSkewConstant);
2979 #endif
2980 
2981 
2982  // check the ordering condition for D (both matrix and poly cases):
2983  if ( gnc_CheckOrdCondition(D, r) )
2984  {
2985  if( bCnew ) mp_Delete( &C, r );
2986  if( bDnew ) mp_Delete( &D, r );
2987 
2988  WerrorS("Matrix of polynomials violates the ordering condition");
2989 
2990 // if( currRing != save )
2991 // rChangeCurrRing(save);
2992  return TRUE;
2993  }
2994 
2995  // okay now we are ready for this!!!
2996 
2997  // create new non-commutative structure
2998  nc_struct *nc_new = (nc_struct *)omAlloc0(sizeof(nc_struct));
2999 
3000  ncRingType(nc_new, nctype);
3001 
3002  nc_new->C = C; // if C and D were given by matrices at the beginning they are in r
3003  nc_new->D = D; // otherwise they should be in r->GetNC()->basering(polynomial * Id_{N})
3004 
3005  nc_new->IsSkewConstant = (IsSkewConstant?1:0);
3006 
3007  // Setup new NC structure!!!
3008  if (r->GetNC() != NULL)
3009  {
3010 #ifndef SING_NDEBUG
3011  WarnS("Changing the NC-structure of an existing NC-ring!!!");
3012 #endif
3013  nc_rKill(r);
3014  }
3015 
3016  r->GetNC() = nc_new;
3017 
3018  r->ext_ref=NULL;
3019 
3020 // if( currRing != save )
3021 // rChangeCurrRing(save);
3022 
3023  return gnc_InitMultiplication(r, bSetupQuotient);
3024 }

◆ nc_CheckSubalgebra()

BOOLEAN nc_CheckSubalgebra ( poly  PolyVar,
ring  r 
)

Definition at line 2567 of file old.gring.cc.

2568 {
2569 // ring save = currRing;
2570 // int WeChangeRing = 0;
2571 // if (currRing != r)
2572 // rChangeCurrRing(r);
2573 // WeChangeRing = 1;
2574 // }
2575  int rN=r->N;
2576  int *ExpVar=(int*)omAlloc0((rN+1)*sizeof(int));
2577  int *ExpTmp=(int*)omAlloc0((rN+1)*sizeof(int));
2578  p_GetExpV(PolyVar, ExpVar, r);
2579  int i; int j; int k;
2580  poly test=NULL;
2581  int OK=1;
2582  for (i=1; i<rN; i++)
2583  {
2584  if (ExpVar[i]==0) /* i.e. not in PolyVar */
2585  {
2586  for (j=i+1; j<=rN; j++)
2587  {
2588  if (ExpVar[j]==0)
2589  {
2590  test = MATELEM(r->GetNC()->D,i,j);
2591  while (test!=NULL)
2592  {
2593  p_GetExpV(test, ExpTmp, r);
2594  OK=1;
2595  for (k=1;k<=rN;k++)
2596  {
2597  if (ExpTmp[k]!=0)
2598  {
2599  if (ExpVar[k]!=0) OK=0;
2600  }
2601  }
2602  if (!OK)
2603  {
2604 // if ( WeChangeRing )
2605 // rChangeCurrRing(save);
2606  return(TRUE);
2607  }
2608  pIter(test);
2609  }
2610  }
2611  }
2612  }
2613  }
2614  freeT(ExpVar,rN);
2615  freeT(ExpTmp,rN);
2616 // if ( WeChangeRing )
2617 // rChangeCurrRing(save);
2618  return(FALSE);
2619 }

◆ nc_CleanUp() [1/2]

void nc_CleanUp ( nc_struct p)
inline

Definition at line 2460 of file old.gring.cc.

2461 {
2462  assume(p != NULL);
2463  omFreeSize((ADDRESS)p,sizeof(nc_struct));
2464 }

◆ nc_CleanUp() [2/2]

void nc_CleanUp ( ring  r)
inline

Definition at line 2466 of file old.gring.cc.

2467 {
2468  /* small CleanUp of r->GetNC() */
2469  assume(r != NULL);
2470  nc_CleanUp(r->GetNC());
2471  r->GetNC() = NULL;
2472 }

◆ nc_CreateShortSpoly()

poly nc_CreateShortSpoly ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1878 of file old.gring.cc.

1879 {
1880 #ifdef PDEBUG
1881  p_Test(p1, r);
1882  p_Test(p2, r);
1883 #endif
1884 
1885  const long lCompP1 = p_GetComp(p1,r);
1886  const long lCompP2 = p_GetComp(p2,r);
1887 
1888  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1889  {
1890 #ifdef PDEBUG
1891  WerrorS("nc_CreateShortSpoly: wrong module components!"); // !!!!
1892 #endif
1893  return(NULL);
1894  }
1895 
1896  poly m;
1897 
1898 #ifdef HAVE_RATGRING
1899  if ( rIsRatGRing(r))
1900  {
1901  /* rational version */
1902  m = p_LcmRat(p1, p2, si_max(lCompP1, lCompP2), r);
1903  } else
1904 #endif
1905  {
1906  m = p_Lcm(p1, p2, r);
1907  }
1908 
1909  pSetCoeff0(m,NULL);
1910 
1911  return(m);
1912 }

◆ nc_mm_Bracket_nn()

poly nc_mm_Bracket_nn ( poly  m1,
poly  m2,
const ring  r 
)

returns [m1,m2] for two monoms, destroys nothing without coeffs

Definition at line 2283 of file old.gring.cc.

2284 {
2285  if (p_LmIsConstant(m1, r) || p_LmIsConstant(m1, r)) return(NULL);
2286  if (p_LmCmp(m1,m2, r)==0) return(NULL);
2287  int rN=r->N;
2288  int *M1=(int *)omAlloc0((rN+1)*sizeof(int));
2289  int *M2=(int *)omAlloc0((rN+1)*sizeof(int));
2290  int *aPREFIX=(int *)omAlloc0((rN+1)*sizeof(int));
2291  int *aSUFFIX=(int *)omAlloc0((rN+1)*sizeof(int));
2292  p_GetExpV(m1,M1, r);
2293  p_GetExpV(m2,M2, r);
2294  poly res=NULL;
2295  poly ares=NULL;
2296  poly bres=NULL;
2297  poly prefix=NULL;
2298  poly suffix=NULL;
2299  int nMin,nMax;
2300  number nTmp=NULL;
2301  int i,j,k;
2302  for (i=1;i<=rN;i++)
2303  {
2304  if (M2[i]!=0)
2305  {
2306  ares=NULL;
2307  for (j=1;j<=rN;j++)
2308  {
2309  if (M1[j]!=0)
2310  {
2311  bres=NULL;
2312  /* compute [ x_j^M1[j],x_i^M2[i] ] */
2313  if (i<j) {nMax=j; nMin=i;} else {nMax=i; nMin=j;}
2314  if ( (i==j) || ((MATELEM(r->GetNC()->COM,nMin,nMax)!=NULL) && n_IsOne(pGetCoeff(MATELEM(r->GetNC()->C,nMin,nMax)), r->cf) )) /* not (the same exp. or commuting exps)*/
2315  { bres=NULL; }
2316  else
2317  {
2318  if (i<j) { bres=gnc_uu_Mult_ww(j,M1[j],i,M2[i], r); }
2319  else bres=gnc_uu_Mult_ww(i,M2[i],j,M1[j], r);
2320  if (n_IsOne(pGetCoeff(bres), r->cf))
2321  {
2322  bres=p_LmDeleteAndNext(bres, r);
2323  }
2324  else
2325  {
2326  nTmp=n_Sub(pGetCoeff(bres),n_Init(1, r->cf), r->cf);
2327  p_SetCoeff(bres,nTmp, r); /* only lc ! */
2328  }
2329 #ifdef PDEBUG
2330  p_Test(bres, r);
2331 #endif
2332  if (i>j) bres=p_Neg(bres, r);
2333  }
2334  if (bres!=NULL)
2335  {
2336  /* now mult (prefix, bres, suffix) */
2337  memcpy(aSUFFIX, M1,(rN+1)*sizeof(int));
2338  memcpy(aPREFIX, M1,(rN+1)*sizeof(int));
2339  for (k=1;k<=j;k++) aSUFFIX[k]=0;
2340  for (k=j;k<=rN;k++) aPREFIX[k]=0;
2341  aSUFFIX[0]=0;
2342  aPREFIX[0]=0;
2343  prefix=p_One(r);
2344  suffix=p_One(r);
2345  p_SetExpV(prefix,aPREFIX, r);
2346  p_Setm(prefix, r);
2347  p_SetExpV(suffix,aSUFFIX, r);
2348  p_Setm(suffix, r);
2349  if (!p_LmIsConstant(prefix, r)) bres = gnc_mm_Mult_p(prefix, bres, r);
2350  if (!p_LmIsConstant(suffix, r)) bres = gnc_p_Mult_mm(bres, suffix, r);
2351  ares=p_Add_q(ares, bres, r);
2352  /* What to give free? */
2353  /* Do we have to free aPREFIX/aSUFFIX? it seems so */
2354  p_Delete(&prefix, r);
2355  p_Delete(&suffix, r);
2356  }
2357  }
2358  }
2359  if (ares!=NULL)
2360  {
2361  /* now mult (prefix, bres, suffix) */
2362  memcpy(aSUFFIX, M2,(rN+1)*sizeof(int));
2363  memcpy(aPREFIX, M2,(rN+1)*sizeof(int));
2364  for (k=1;k<=i;k++) aSUFFIX[k]=0;
2365  for (k=i;k<=rN;k++) aPREFIX[k]=0;
2366  aSUFFIX[0]=0;
2367  aPREFIX[0]=0;
2368  prefix=p_One(r);
2369  suffix=p_One(r);
2370  p_SetExpV(prefix,aPREFIX, r);
2371  p_Setm(prefix, r);
2372  p_SetExpV(suffix,aSUFFIX, r);
2373  p_Setm(suffix, r);
2374  bres=ares;
2375  if (!p_LmIsConstant(prefix, r)) bres = gnc_mm_Mult_p(prefix, bres, r);
2376  if (!p_LmIsConstant(suffix, r)) bres = gnc_p_Mult_mm(bres, suffix, r);
2377  res=p_Add_q(res, bres, r);
2378  p_Delete(&prefix, r);
2379  p_Delete(&suffix, r);
2380  }
2381  }
2382  }
2383  freeT(M1, rN);
2384  freeT(M2, rN);
2385  freeT(aPREFIX, rN);
2386  freeT(aSUFFIX, rN);
2387 #ifdef PDEBUG
2388  p_Test(res, r);
2389 #endif
2390  return(res);
2391 }

◆ nc_p_Bracket_qq()

poly nc_p_Bracket_qq ( poly  p,
const poly  q,
const ring  r 
)

returns [p,q], destroys p

Definition at line 2242 of file old.gring.cc.

2243 {
2244  assume(p != NULL && q!= NULL);
2245 
2246  if (!rIsPluralRing(r)) return(NULL);
2247  if (p_ComparePolys(p,q, r)) return(NULL);
2248  /* Components !? */
2249  poly Q=NULL;
2250  number coef=NULL;
2251  poly pres=NULL;
2252  int UseBuckets=1;
2253  if (((pLength(p)< MIN_LENGTH_BUCKET/2) && (pLength(q)< MIN_LENGTH_BUCKET/2))
2255  UseBuckets=0;
2256 
2257 
2258  CPolynomialSummator sum(r, UseBuckets == 0);
2259 
2260  while (p!=NULL)
2261  {
2262  Q=q;
2263  while(Q!=NULL)
2264  {
2265  pres=nc_mm_Bracket_nn(p,Q, r); /* since no coeffs are taken into account there */
2266  if (pres!=NULL)
2267  {
2268  coef = n_Mult(pGetCoeff(p),pGetCoeff(Q), r->cf);
2269  pres = __p_Mult_nn(pres,coef,r);
2270 
2271  sum += pres;
2272  n_Delete(&coef, r->cf);
2273  }
2274  pIter(Q);
2275  }
2276  p=p_LmDeleteAndNext(p, r);
2277  }
2278  return(sum);
2279 }

◆ nc_p_CopyGet()

poly nc_p_CopyGet ( poly  a,
const ring  r 
)

Definition at line 2525 of file old.gring.cc.

2526 {
2527 #ifndef PDEBUG
2528  p_Test(a, r);
2529 #endif
2530 
2531 // if (r != currRing)
2532 // {
2533 //#ifdef PDEBUF
2534 // WerrorS("nc_p_CopyGet call not in currRing");
2535 //#endif
2536 // return(NULL);
2537 // }
2538  return(p_Copy(a,r));
2539 }

◆ nc_p_CopyPut()

poly nc_p_CopyPut ( poly  a,
const ring  r 
)

Definition at line 2546 of file old.gring.cc.

2547 {
2548 #ifndef PDEBUG
2549  p_Test(a, r);
2550 #endif
2551 
2552 // if (r != currRing)
2553 // {
2554 //#ifdef PDEBUF
2555 // WerrorS("nc_p_CopyGet call not in currRing");
2556 //#endif
2557 // return(NULL);
2558 // }
2559 
2560  return(p_Copy(a,r));
2561 }

◆ nc_p_Minus_mm_Mult_qq()

poly nc_p_Minus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int &  shorter,
const  poly,
const ring  r 
)

for p_Minus_mm_Mult_qq in pInline2.h

Definition at line 150 of file old.gring.cc.

152 {
153  poly mc = p_Neg( p_Copy(m, r), r );
154  poly mmc = nc_mm_Mult_pp( mc, q, r );
155  p_Delete(&mc, r);
156 
157  int org_p=pLength(p);
158  int org_q=pLength(q);
159 
160  p = p_Add_q(p, mmc, r);
161 
162  shorter = pLength(p)-org_p-org_q; // ring independent!
163 
164  return(p);
165 }

◆ nc_p_Plus_mm_Mult_qq()

poly nc_p_Plus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int &  lp,
const int  ,
const ring  r 
)

Definition at line 168 of file old.gring.cc.

170 {
171  p = p_Add_q(p, nc_mm_Mult_pp( m, q, r ), r);
172 
173  lp = pLength(p);
174 
175  return(p);
176 }

◆ nc_p_ProcsSet()

void nc_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)

Definition at line 3204 of file old.gring.cc.

3205 {
3206  assume(rIsPluralRing(rGR));
3207  assume(p_Procs!=NULL);
3208 
3209  gnc_p_ProcsSet(rGR, p_Procs);
3210 
3211  if(rIsSCA(rGR) && ncExtensions(SCAMASK) )
3212  {
3213  sca_p_ProcsSet(rGR, p_Procs);
3214  }
3215 
3216  if( ncExtensions(NOPLURALMASK) )
3218 
3219  if(!rIsSCA(rGR) && !ncExtensions(NOFORMULAMASK))
3221 
3222 }

◆ nc_PolyPolyRed()

void nc_PolyPolyRed ( poly &  b,
poly  p,
number *  c,
const ring  r 
)

Definition at line 2229 of file old.gring.cc.

2230 {
2231 #if 0
2232  nc_PolyPolyRedOld(b, p, c, r);
2233 #else
2234  nc_PolyPolyRedNew(b, p, c, r);
2235 #endif
2236 }

◆ nc_PolyPolyRedNew()

void nc_PolyPolyRedNew ( poly &  b,
poly  p,
number *  c,
const ring  r 
)
inline

Definition at line 2129 of file old.gring.cc.

2131 {
2132 #ifdef PDEBUG
2133  p_Test(b, r);
2134  p_Test(p, r);
2135 #endif
2136 
2137 #if MYTEST
2138  PrintS("nc_PolyPolyRedNew(");
2139  p_Write0(b, r);
2140  PrintS(", ");
2141  p_Write0(p, r);
2142  PrintS(", *c): ");
2143 #endif
2144 
2145  // b will not by multiplied by any constant in this impl.
2146  // ==> *c=1
2147  if (c!=NULL) *c=n_Init(1, r->cf);
2148 
2149  poly pp = NULL;
2150 
2151  // there is a problem when p is a square(=>0!)
2152 
2153  while((b != NULL) && (pp == NULL))
2154  {
2155 
2156 // poly pLmB = p_Head(b, r);
2157  poly m = p_One(r);
2158  p_ExpVectorDiff(m, b, p, r);
2159 // pDelete(&pLmB);
2160  //pSetm(m);
2161 
2162 #ifdef PDEBUG
2163  p_Test(m, r);
2164  p_Test(b, r);
2165 #endif
2166 
2167  pp = nc_mm_Mult_pp(m, p, r);
2168 
2169 #if MYTEST
2170  PrintS("\n{b': ");
2171  p_Write0(b, r);
2172  PrintS(", m: ");
2173  p_Write0(m, r);
2174  PrintS(", pp: ");
2175  p_Write0(pp, r);
2176  PrintS(" }\n");
2177 #endif
2178 
2179  p_Delete(&m, r); // one m for all tries!
2180 
2181 // assume( pp != NULL );
2182 
2183  if( pp == NULL )
2184  {
2185  b = p_LmDeleteAndNext(b, r);
2186 
2187  if( !p_DivisibleBy(p, b, r) )
2188  return;
2189 
2190  }
2191  }
2192 
2193 #if MYTEST
2194  PrintS("{b': ");
2195  p_Write0(b, r);
2196  PrintS(", pp: ");
2197  p_Write0(pp, r);
2198  PrintS(" }\n");
2199 #endif
2200 
2201 
2202  if(b == NULL) return;
2203 
2204 
2205  assume(pp != NULL);
2206 
2207  const number n = pGetCoeff(pp); // no new copy
2208 
2209  number nn;
2210 
2211  if (!n_IsMOne(n, r->cf)) // TODO: as above.
2212  {
2213  nn=n_InpNeg(n_Invers(n, r->cf), r->cf);
2214  number t = n_Mult(nn, pGetCoeff(b), r->cf);
2215  n_Delete(&nn, r->cf);
2216  pp=__p_Mult_nn(pp, t, r);
2217  n_Delete(&t, r->cf);
2218  }
2219  else
2220  {
2221  pp=__p_Mult_nn(pp, pGetCoeff(b), r);
2222  }
2223 
2224 
2225  b=p_Add_q(b,pp,r);
2226 
2227 }

◆ nc_PolyPolyRedOld()

void nc_PolyPolyRedOld ( poly &  b,
poly  p,
number *  c,
const ring  r 
)
inline

Definition at line 2095 of file old.gring.cc.

2097 {
2098  // b will not by multiplied by any constant in this impl.
2099  // ==> *c=1
2100  if (c!=NULL) *c=n_Init(1, r->cf);
2101  poly m=p_One(r);
2102  p_ExpVectorDiff(m,p_Head(b, r),p, r);
2103  //pSetm(m);
2104 #ifdef PDEBUG
2105  p_Test(m, r);
2106 #endif
2107  poly pp=nc_mm_Mult_pp(m,p,r);
2108  assume(pp!=NULL);
2109 
2110  p_Delete(&m, r);
2111  number n=pGetCoeff(pp);
2112  number nn;
2113  if (!n_IsMOne(n, r->cf))
2114  {
2115  nn=n_InpNeg(n_Invers(n, r->cf), r->cf);
2116  n =n_Mult(nn,pGetCoeff(b), r->cf);
2117  n_Delete(&nn, r->cf);
2118  pp=__p_Mult_nn(pp,n,r);
2119  n_Delete(&n, r->cf);
2120  }
2121  else
2122  {
2123  pp=__p_Mult_nn(pp,p_GetCoeff(b, r),r);
2124  }
2125  b=p_Add_q(b,pp,r);
2126 }

◆ nc_PrintMat()

matrix nc_PrintMat ( int  a,
int  b,
ring  r,
int  metric 
)

returns matrix with the info on noncomm multiplication

Definition at line 2393 of file old.gring.cc.

2394 {
2395 
2396  if ( (a==b) || !rIsPluralRing(r) ) return(NULL);
2397  int i;
2398  int j;
2399  if (a>b) {j=b; i=a;}
2400  else {j=a; i=b;}
2401  /* i<j */
2402  int rN=r->N;
2403  int size=r->GetNC()->MTsize[UPMATELEM(i,j,rN)];
2404  matrix M = r->GetNC()->MT[UPMATELEM(i,j,rN)];
2405  /* return(M); */
2406 /*
2407  int sizeofres;
2408  if (metric==0)
2409  {
2410  sizeofres=sizeof(int);
2411  }
2412  if (metric==1)
2413  {
2414  sizeofres=sizeof(number);
2415  }
2416 */
2418  int s;
2419  int t;
2420  int length;
2421  long totdeg;
2422  poly p;
2423  for(s=1;s<=size;s++)
2424  {
2425  for(t=1;t<=size;t++)
2426  {
2427  p=MATELEM(M,s,t);
2428  if (p==NULL)
2429  {
2430  MATELEM(res,s,t)=0;
2431  }
2432  else
2433  {
2434  length = pLength(p);
2435  if (metric==0) /* length */
2436  {
2437  MATELEM(res,s,t)= p_ISet(length,r);
2438  }
2439  else if (metric==1) /* sum of deg divided by the length */
2440  {
2441  totdeg=0;
2442  while (p!=NULL)
2443  {
2444  totdeg=totdeg+p_Deg(p,r);
2445  pIter(p);
2446  }
2447  number ntd = n_Init(totdeg, r->cf);
2448  number nln = n_Init(length, r->cf);
2449  number nres= n_Div(ntd,nln, r->cf);
2450  n_Delete(&ntd, r->cf);
2451  n_Delete(&nln, r->cf);
2452  MATELEM(res,s,t)=p_NSet(nres,r);
2453  }
2454  }
2455  }
2456  }
2457  return(res);
2458 }

◆ nc_pSubst()

poly nc_pSubst ( poly  p,
int  n,
poly  e,
const ring  r 
)

substitute the n-th variable by e in p destroy p e is not a constant

Definition at line 3228 of file old.gring.cc.

3229 {
3230  int rN = r->N;
3231  int *PRE = (int *)omAlloc0((rN+1)*sizeof(int));
3232  int *SUF = (int *)omAlloc0((rN+1)*sizeof(int));
3233  int i,pow;
3234  number C;
3235  poly suf,pre;
3236  poly res = NULL;
3237  poly out = NULL;
3238  while ( p!= NULL )
3239  {
3240  C = p_GetCoeff(p, r);
3241  p_GetExpV(p, PRE, r); /* faster splitting? */
3242  pow = PRE[n]; PRE[n]=0;
3243  res = NULL;
3244  if (pow!=0)
3245  {
3246  for (i=n+1; i<=rN; i++)
3247  {
3248  SUF[i] = PRE[i];
3249  PRE[i] = 0;
3250  }
3251  res = p_Power(p_Copy(e, r),pow, r);
3252  /* multiply with prefix */
3253  pre = p_One(r);
3254  p_SetExpV(pre,PRE, r);
3255  p_Setm(pre, r);
3256  res = nc_mm_Mult_p(pre,res, r);
3257  /* multiply with suffix */
3258  suf = p_One(r);
3259  p_SetExpV(suf,SUF, r);
3260  p_Setm(suf, r);
3261  res = p_Mult_mm(res,suf, r);
3262  res = __p_Mult_nn(res,C, r);
3263  p_SetComp(res,PRE[0], r);
3264  }
3265  else /* pow==0 */
3266  {
3267  res = p_Head(p, r);
3268  }
3269  p = p_LmDeleteAndNext(p, r);
3270  out = p_Add_q(out,res, r);
3271  }
3272  freeT(PRE,rN);
3273  freeT(SUF,rN);
3274  return(out);
3275 }

◆ nc_rCleanUp()

void nc_rCleanUp ( ring  r)

◆ nc_rCopy()

bool nc_rCopy ( ring  res,
const ring  r,
bool  bSetupQuotient 
)

Definition at line 3028 of file old.gring.cc.

3029 {
3030  if (nc_CallPlural(r->GetNC()->C, r->GetNC()->D, NULL, NULL, res, bSetupQuotient, true, true, r))
3031  {
3032  WarnS("Error occurred while coping/setuping the NC structure!"); // No reaction!???
3033  return true; // error
3034  }
3035 
3036  return false;
3037 }

◆ nc_rCreateNCcomm()

ring nc_rCreateNCcomm ( ring  r)

Definition at line 3279 of file old.gring.cc.

3280 {
3281  if (rIsPluralRing(r)) return r;
3282 
3283  ring rr = rCopy(r);
3284 
3285  matrix C = mpNew(rr->N,rr->N); // ring-independent!?!
3286  matrix D = mpNew(rr->N,rr->N);
3287 
3288  for(int i=1; i<rr->N; i++)
3289  for(int j=i+1; j<=rr->N; j++)
3290  MATELEM(C,i,j) = p_One(rr);
3291 
3292  if (nc_CallPlural(C, D, NULL, NULL, rr, false, true, false, rr, TRUE)) // TODO: what about quotient ideal?
3293  WarnS("Error initializing multiplication!"); // No reaction!???
3294 
3295  return rr;
3296 }

◆ nc_rKill()

void nc_rKill ( ring  r)

complete destructor

Definition at line 2474 of file old.gring.cc.

2476 {
2477  if( r->GetNC()->GetGlobalMultiplier() != NULL )
2478  {
2479  delete r->GetNC()->GetGlobalMultiplier();
2480  r->GetNC()->GetGlobalMultiplier() = NULL;
2481  }
2482 
2483  if( r->GetNC()->GetFormulaPowerMultiplier() != NULL )
2484  {
2485  delete r->GetNC()->GetFormulaPowerMultiplier();
2486  r->GetNC()->GetFormulaPowerMultiplier() = NULL;
2487  }
2488 
2489 
2490  int i,j;
2491  int rN=r->N;
2492  if ( rN > 1 )
2493  {
2494  for(i=1;i<rN;i++)
2495  {
2496  for(j=i+1;j<=rN;j++)
2497  {
2498  id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(i,j,rN)]),r);
2499  }
2500  }
2501  omFreeSize((ADDRESS)r->GetNC()->MT,rN*(rN-1)/2*sizeof(matrix));
2502  omFreeSize((ADDRESS)r->GetNC()->MTsize,rN*(rN-1)/2*sizeof(int));
2503  id_Delete((ideal *)&(r->GetNC()->COM),r);
2504  }
2505  id_Delete((ideal *)&(r->GetNC()->C),r);
2506  id_Delete((ideal *)&(r->GetNC()->D),r);
2507 
2508  if( rIsSCA(r) && (r->GetNC()->SCAQuotient() != NULL) )
2509  {
2510  id_Delete(&r->GetNC()->SCAQuotient(), r); // Custom SCA destructor!!!
2511  }
2512 
2513 
2514  nc_CleanUp(r);
2515 }

◆ nc_SetupQuotient()

bool nc_SetupQuotient ( ring  rGR,
const ring  rG,
bool  bCopy 
)

Definition at line 3428 of file old.gring.cc.

3429 {
3430  if( rGR->qideal == NULL )
3431  return false; // no quotient = no work! done!? What about factors of SCA?
3432 
3433  bool ret = true;
3434  // currently only super-commutative extension deals with factors.
3435 
3436  if( ncExtensions(SCAMASK) )
3437  {
3438  bool sca_ret = sca_SetupQuotient(rGR, rG, bCopy);
3439 
3440  if(sca_ret) // yes it was dealt with!
3441  ret = false;
3442  }
3443 
3444  if( bCopy )
3445  {
3446  assume(rIsPluralRing(rGR) == rIsPluralRing(rG));
3447  assume((rGR->qideal==NULL) == (rG->qideal==NULL));
3448  assume(rIsSCA(rGR) == rIsSCA(rG));
3449  assume(ncRingType(rGR) == ncRingType(rG));
3450  }
3451 
3452  return ret;
3453 }

◆ ncExtensions()

bool ncExtensions ( int  iMask)

Definition at line 94 of file old.gring.cc.

95 {
96  return ((getNCExtensions() & iMask) == iMask);
97 }

◆ NF_Proc_Dummy()

static poly NF_Proc_Dummy ( ideal  ,
ideal  ,
poly  ,
int  ,
int  ,
const  ring 
)
static

Definition at line 59 of file old.gring.cc.

60 { WerrorS("nc_NF not defined"); return NULL; }

◆ p_CopyEmbed()

poly p_CopyEmbed ( poly  p,
ring  srcRing,
int  shift,
int  ,
ring  dstRing 
)

Definition at line 3303 of file old.gring.cc.

3304 {
3305  if (dstRing == srcRing)
3306  {
3307  return(p_Copy(p,dstRing));
3308  }
3309  nMapFunc nMap=n_SetMap(srcRing->cf, dstRing->cf);
3310  poly q;
3311  // if ( nMap == nCopy)
3312  // {
3313  // q = prCopyR(p,srcRing);
3314  // }
3315  // else
3316  {
3317  int *perm = (int *)omAlloc0((rVar(srcRing)+1)*sizeof(int));
3318  int *par_perm = (int *)omAlloc0((rPar(srcRing)+1)*sizeof(int));
3319  // int *par_perm = (int *)omAlloc0((rPar(srcRing)+1)*sizeof(int));
3320  int i;
3321  // if (srcRing->P > 0)
3322  // {
3323  // for (i=0; i<srcRing->P; i++)
3324  // par_perm[i]=-i;
3325  // }
3326  if ((shift<0) || (shift > rVar(srcRing))) // ???
3327  {
3328  WerrorS("bad shifts in p_CopyEmbed");
3329  return(0);
3330  }
3331  for (i=1; i<= srcRing->N; i++)
3332  {
3333  perm[i] = shift+i;
3334  }
3335  q = p_PermPoly(p,perm,srcRing, dstRing, nMap,par_perm, rPar(srcRing));
3336  }
3337  return(q);
3338 }

◆ pOppose()

poly pOppose ( ring  Rop,
poly  p,
const ring  dst 
)

opposes a vector p from Rop to currRing (dst!)

Definition at line 3367 of file old.gring.cc.

3368 {
3369  /* the simplest case:*/
3370  if ( Rop == dst ) return(p_Copy(p, dst));
3371  /* check Rop == rOpposite(currRing) */
3372 
3373 
3374  if ( !rIsLikeOpposite(dst, Rop) )
3375  {
3376  WarnS("an opposite ring should be used");
3377  return NULL;
3378  }
3379 
3380  nMapFunc nMap = n_SetMap(Rop->cf, dst->cf); // reverse?
3381 
3382  /* nMapFunc nMap = nSetMap(Rop);*/
3383  /* since we know that basefields coinside! */
3384 
3385  // coinside???
3386 
3387  int *perm=(int *)omAlloc0((Rop->N+1)*sizeof(int));
3388  if (!p_IsConstantPoly(p, Rop))
3389  {
3390  /* we know perm exactly */
3391  int i;
3392  for(i=1; i<=Rop->N; i++)
3393  {
3394  perm[i] = Rop->N+1-i;
3395  }
3396  }
3397  poly res = p_PermPoly(p, perm, Rop, dst, nMap);
3398  omFreeSize((ADDRESS)perm,(Rop->N+1)*sizeof(int));
3399 
3400  p_Test(res, dst);
3401 
3402  return res;
3403 }

◆ rIsLikeOpposite()

BOOLEAN rIsLikeOpposite ( ring  rBase,
ring  rCandidate 
)

checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so

Definition at line 3340 of file old.gring.cc.

3341 {
3342  /* the same basefield */
3343  int diagnose = TRUE;
3344  nMapFunc nMap = n_SetMap(rCandidate->cf, rBase->cf); // reverse?
3345 
3346 ////// if (nMap != nCopy) diagnose = FALSE;
3347  if (nMap == NULL) diagnose = FALSE;
3348 
3349 
3350  /* same number of variables */
3351  if (rBase->N != rCandidate->N) diagnose = FALSE;
3352  /* nc and comm ring */
3353  if ( rIsPluralRing(rBase) != rIsPluralRing(rCandidate) ) diagnose = FALSE;
3354  /* both are qrings */
3355  /* NO CHECK, since it is used in building opposite qring */
3356  /* if ( ((rBase->qideal != NULL) && (rCandidate->qideal == NULL)) */
3357  /* || ((rBase->qideal == NULL) && (rCandidate->qideal != NULL)) ) */
3358  /* diagnose = FALSE; */
3359  /* TODO: varnames are e->E etc */
3360  return diagnose;
3361 }

◆ setNCExtensions()

int setNCExtensions ( int  iMask)

Definition at line 87 of file old.gring.cc.

88 {
89  const int iOld = getNCExtensions();
90  getNCExtensions() = iMask;
91  return (iOld);
92 }

Variable Documentation

◆ gnc_gr_bba

BBA_Proc gnc_gr_bba =BBA_Proc_Dummy

Definition at line 67 of file old.gring.cc.

◆ gnc_gr_mora

BBA_Proc gnc_gr_mora =BBA_Proc_Dummy

Definition at line 68 of file old.gring.cc.

◆ iNCExtensions

int iNCExtensions = SCAMASK | NOFORMULAMASK

Definition at line 80 of file old.gring.cc.

◆ nc_NF

Definition at line 66 of file old.gring.cc.

◆ sca_bba

Definition at line 69 of file old.gring.cc.

◆ sca_gr_bba

BBA_Proc sca_gr_bba =BBA_Proc_Dummy

Definition at line 71 of file old.gring.cc.

◆ sca_mora

Definition at line 70 of file old.gring.cc.

test
CanonicalForm test
Definition: cfModGcd.cc:4037
nc_struct
Definition: nc.h:75
nc_mm_Bracket_nn
poly nc_mm_Bracket_nn(poly m1, poly m2, const ring r)
returns [m1,m2] for two monoms, destroys nothing without coeffs
Definition: old.gring.cc:2283
FALSE
#define FALSE
Definition: auxiliary.h:94
nc_struct::C
matrix C
Definition: nc.h:83
dReportError
int dReportError(const char *fmt,...)
Definition: dError.cc:43
gnc_ReduceSpolyNew
poly gnc_ReduceSpolyNew(const poly p1, poly p2, const ring r)
Definition: old.gring.cc:1398
gnc_CreateSpolyOld
poly gnc_CreateSpolyOld(const poly p1, const poly p2, const ring r)
Definition: old.gring.cc:1470
matrix
ip_smatrix * matrix
Definition: matpol.h:30
ncInitSpecialPairMultiplication
BOOLEAN ncInitSpecialPairMultiplication(ring r)
Definition: ncSAMult.cc:263
p_LmDeleteAndNext
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:712
pOppose
poly pOppose(ring Rop, poly p, const ring dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3367
p_LcmRat
poly p_LcmRat(const poly a, const poly b, const long lCompM, const ring r)
Definition: p_polys.cc:1621
p_GetCoeff
#define p_GetCoeff(p, r)
Definition: monomials.h:54
p_GetComp
#define p_GetComp(p, r)
Definition: monomials.h:68
ip_smatrix
Definition: matpol.h:13
gnc_p_Mult_mm_Common
poly gnc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r)
Definition: old.gring.cc:301
j
int j
Definition: facHensel.cc:105
nc_struct::IsSkewConstant
int IsSkewConstant
Definition: nc.h:93
cast_A_to_vptr
void * cast_A_to_vptr(A a)
Definition: auxiliary.h:398
k
int k
Definition: cfEzgcd.cc:92
p_Write0
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:193
gnc_mm_Mult_p
poly gnc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: old.gring.cc:402
x
Variable x
Definition: cfModGcd.cc:4023
p_ExpVectorDiff
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1402
MATELEM
#define MATELEM(mat, i, j)
Definition: matpol.h:28
y
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
ncExtensions
bool ncExtensions(int iMask)
Definition: old.gring.cc:94
lq
Definition: lq.h:38
nc_comm
Definition: nc.h:17
p_DebugPrint
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4202
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
gnc_p_Mult_mm
poly gnc_p_Mult_mm(poly p, const poly m, const ring r)
Definition: old.gring.cc:397
nc_p_CopyPut
poly nc_p_CopyPut(poly a, const ring r)
Definition: old.gring.cc:2546
p_Head
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:810
p_Mult_mm
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:982
MIN_LENGTH_BUCKET
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:19
num
CanonicalForm num(const CanonicalForm &f)
Definition: canonicalform.h:330
p_ComparePolys
BOOLEAN p_ComparePolys(poly p1, poly p2, const ring r)
returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL
Definition: p_polys.cc:4456
ncRingType
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:167
kBucketPolyRed
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1060
gnc_kBucketPolyRedNew
void gnc_kBucketPolyRedNew(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:1947
p_Neg
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1028
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:245
_ncSA_notImplemented
Definition: ncSAFormula.h:16
gnc_kBucketPolyRed_ZNew
void gnc_kBucketPolyRed_ZNew(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:2060
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
CFormulaPowerMultiplier::Multiply
static poly Multiply(Enum_ncSAType type, const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:694
pqLength
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
Definition: p_Mult_q.cc:27
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
p_Test
#define p_Test(p, r)
Definition: p_polys.h:155
pp_Mult_mm
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:972
kBucketGetLm
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:487
gnc_uu_Mult_ww_vert
poly gnc_uu_Mult_ww_vert(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:931
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
rTest
#define rTest(r)
Definition: ring.h:776
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
p_HasNotCF
BOOLEAN p_HasNotCF(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1318
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
nc_p_Bracket_qq
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2242
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
gnc_gr_bba
BBA_Proc gnc_gr_bba
Definition: old.gring.cc:67
freeT
#define freeT(A, v)
Definition: old.gring.cc:101
b
CanonicalForm b
Definition: cfModGcd.cc:4044
__p_Mult_nn
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:912
p_Lcm
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1599
n_Normalize
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
Enum_ncSAType
Enum_ncSAType
Definition: ncSAFormula.h:14
iiWriteMatrix
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:733
p_LmDivisibleBy
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1794
CFormulaPowerMultiplier
Definition: ncSAFormula.h:26
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:476
nc_rKill
void nc_rKill(ring r)
complete destructor
Definition: old.gring.cc:2474
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:403
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:183
p_SetExpV
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1463
gnc_InitMultiplication
BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient=false)
Definition: old.gring.cc:3040
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:797
p_Power
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2141
nc_PolyPolyRedOld
void nc_PolyPolyRedOld(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2095
freeN
#define freeN(A, k)
Definition: old.gring.cc:102
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
gnc_mm_Mult_uu
poly gnc_mm_Mult_uu(int *F, int jG, int bG, const ring r)
Definition: old.gring.cc:673
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: simpleideals.cc:113
rHasLocalOrMixedOrdering
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
p_PermPoly
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:4011
res
CanonicalForm res
Definition: facAbsFact.cc:64
kBucket_Add_q
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:635
nc_type
nc_type
Definition: nc.h:12
nc_lie
Definition: nc.h:18
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
M
#define M
Definition: sirandom.c:24
CFormulaPowerMultiplier::GetPair
Enum_ncSAType GetPair(int i, int j) const
Definition: ncSAFormula.h:43
TEST_OPT_NOT_BUCKETS
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:103
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
SCAMASK
const int SCAMASK
Definition: nc.h:333
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
nc_p_Minus_mm_Mult_qq
poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &shorter, const poly, const ring r)
for p_Minus_mm_Mult_qq in pInline2.h
Definition: old.gring.cc:150
NOPLURALMASK
const int NOPLURALMASK
Definition: nc.h:347
kbTest
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:193
sca_p_ProcsSet
void sca_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: sca.cc:1223
D
#define D(A)
Definition: gentable.cc:128
rIsRatGRing
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:414
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:698
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:203
pIter
#define pIter(p)
Definition: monomials.h:41
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2779
n_Mult
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
rPar
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:589
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
p_DivisibleBy
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1803
gnc_pp_Mult_mm
poly gnc_pp_Mult_mm(const poly p, const poly m, const ring r, poly &last)
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1448
gnc_uu_Mult_ww
poly gnc_uu_Mult_ww(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:1039
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1488
mp_Delete
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:779
pp
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:253
nc_mm_Mult_p
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:242
n_InpNeg
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557
NOCACHEMASK
const int NOCACHEMASK
Definition: nc.h:349
nc_general
Definition: nc.h:15
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:35
COM
#define COM(f)
Definition: transext.cc:69
n_Sub
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition: coeffs.h:669
UPMATELEM
#define UPMATELEM(i, j, nVar)
Definition: nc.h:36
p_LmFree
static void p_LmFree(poly p, ring)
Definition: p_polys.h:670
nc_SetupQuotient
bool nc_SetupQuotient(ring rGR, const ring rG, bool bCopy)
Definition: old.gring.cc:3428
p_Deg
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:578
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:842
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1302
n_Invers
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
Definition: coeffs.h:564
ncInitSpecialPowersMultiplication
bool ncInitSpecialPowersMultiplication(ring r)
Definition: ncSAFormula.cc:48
gnc_kBucketPolyRed_ZOld
void gnc_kBucketPolyRed_ZOld(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:2027
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
log
gmp_float log(const gmp_float &a)
Definition: mpr_complex.cc:343
nc_undef
Definition: nc.h:19
rIsLikeOpposite
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
Definition: old.gring.cc:3340
Print
#define Print
Definition: emacs.cc:79
gnc_p_ProcsSet
static void gnc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3140
gnc_CheckOrdCondition
BOOLEAN gnc_CheckOrdCondition(matrix D, ring r)
Definition: old.gring.cc:2626
nc_p_CopyGet
poly nc_p_CopyGet(poly a, const ring r)
Definition: old.gring.cc:2525
p_NSet
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1432
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:188
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:36
nc_p_ProcsSet
void nc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3204
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:400
n_IsMOne
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:472
gnc_mm_Mult_pp
poly gnc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: old.gring.cc:407
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:63
getNCExtensions
int & getNCExtensions()
Definition: old.gring.cc:82
GetFormulaPowerMultiplier
static CFormulaPowerMultiplier * GetFormulaPowerMultiplier(const ring r)
Definition: ncSAFormula.h:92
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
pow
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:414
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
m
int m
Definition: cfEzgcd.cc:121
MATCOLS
#define MATCOLS(i)
Definition: matpol.h:27
p_AddExp
static long p_AddExp(poly p, int v, long ee, ring r)
Definition: p_polys.h:594
WarnS
#define WarnS
Definition: emacs.cc:77
assume
#define assume(x)
Definition: mod2.h:384
nc_struct::D
matrix D
Definition: nc.h:84
NULL
#define NULL
Definition: omList.c:9
nc_mm_Mult_pp
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:232
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:238
l
int l
Definition: cfEzgcd.cc:93
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
n_Power
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:632
nc_skew
Definition: nc.h:16
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:224
nc_PolyPolyRedNew
void nc_PolyPolyRedNew(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2129
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
rSamePolyRep
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1667
n_Equal
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460
p
int p
Definition: cfModGcd.cc:4019
p_IsConstantPoly
static BOOLEAN p_IsConstantPoly(const poly p, const ring r)
Definition: p_polys.h:1915
p_IsConstant
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1901
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
NOFORMULAMASK
const int NOFORMULAMASK
Definition: nc.h:348
gnc_CreateSpolyNew
poly gnc_CreateSpolyNew(const poly p1, const poly p2, const ring r)
Definition: old.gring.cc:1557
gnc_mm_Mult_nn
poly gnc_mm_Mult_nn(int *F, int *G, const ring r)
Definition: old.gring.cc:414
gnc_kBucketPolyRedOld
void gnc_kBucketPolyRedOld(kBucket_pt b, poly p, number *c)
Definition: old.gring.cc:1914
n_Div
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:721
nc_CallPlural
BOOLEAN nc_CallPlural(matrix CCC, matrix DDD, poly CCN, poly DDN, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2681
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1286
Q
#define Q
Definition: sirandom.c:25
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition: simpleideals.cc:403
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:48
copy
CFArray copy(const CFList &list)
write elements of list into an array
Definition: facFqBivarUtil.cc:364
iNCExtensions
int iNCExtensions
Definition: old.gring.cc:80
prCopyR_NoSort
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:77
rCopy
ring rCopy(ring r)
Definition: ring.cc:1604
mp_Copy
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:62
rIsSCA
static bool rIsSCA(const ring r)
Definition: nc.h:198
id_Test
#define id_Test(A, lR)
Definition: simpleideals.h:79
MATROWS
#define MATROWS(i)
Definition: matpol.h:26
G
static TreeM * G
Definition: janet.cc:32
gnc_uu_Mult_ww_formula
static poly gnc_uu_Mult_ww_formula(int i, int a, int j, int b, const ring r)
Definition: old.gring.cc:1006
sca_SetupQuotient
bool sca_SetupQuotient(ring rGR, ring rG, bool bCopy)
Definition: sca.cc:909
CPolynomialSummator
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(.
Definition: summator.h:19
gnc_gr_mora
BBA_Proc gnc_gr_mora
Definition: old.gring.cc:68
_p_procs
static p_Procs_s * _p_procs
Definition: p_Procs_Set.h:111
pNext
#define pNext(p)
Definition: monomials.h:40
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
On
void On(int sw)
switches
Definition: canonicalform.cc:1898
nc_CleanUp
void nc_CleanUp(nc_struct *p)
Definition: old.gring.cc:2460
p_LmIsConstant
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
Definition: p_polys.h:964
gnc_ReduceSpolyOld
poly gnc_ReduceSpolyOld(const poly p1, poly p2, const ring r)
Definition: old.gring.cc:1342
pWrite
void pWrite(poly p)
Definition: polys.h:282
p_Cleardenom_n
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2888