My Project  debian-1:4.1.1-p2+ds-4build2
Data Structures | Functions
matpol.cc File Reference
#include "misc/auxiliary.h"
#include "omalloc/omalloc.h"
#include "misc/mylimits.h"
#include "misc/intvec.h"
#include "coeffs/numbers.h"
#include "reporter/reporter.h"
#include "monomials/ring.h"
#include "monomials/p_polys.h"
#include "simpleideals.h"
#include "matpol.h"
#include "prCopy.h"
#include "sparsmat.h"

Go to the source code of this file.

Data Structures

class  row_col_weight
 
class  mp_permmatrix
 

Functions

static poly mp_Exdiv (poly m, poly d, poly vars, const ring)
 
static poly mp_Select (poly fro, poly what, const ring)
 
matrix mpNew (int r, int c)
 create a r x c zero-matrix More...
 
matrix mp_Copy (matrix a, const ring r)
 copies matrix a (from ring r to r) More...
 
matrix mp_Copy (const matrix a, const ring rSrc, const ring rDst)
 copies matrix a from rSrc into rDst More...
 
matrix mp_InitP (int r, int c, poly p, const ring R)
 make it a p * unit matrix More...
 
matrix mp_InitI (int r, int c, int v, const ring R)
 make it a v * unit matrix More...
 
matrix mp_MultI (matrix a, int f, const ring R)
 c = f*a More...
 
matrix mp_MultP (matrix a, poly p, const ring R)
 multiply a matrix 'a' by a poly 'p', destroy the args More...
 
matrix pMultMp (poly p, matrix a, const ring R)
 
matrix mp_Add (matrix a, matrix b, const ring R)
 
matrix mp_Sub (matrix a, matrix b, const ring R)
 
matrix mp_Mult (matrix a, matrix b, const ring R)
 
matrix mp_Transp (matrix a, const ring R)
 
poly mp_Trace (matrix a, const ring R)
 
poly TraceOfProd (matrix a, matrix b, int n, const ring R)
 
matrix mp_Coeffs (ideal I, int var, const ring R)
 corresponds to Maple's coeffs: var has to be the number of a variable More...
 
void mp_Monomials (matrix c, int r, int var, matrix m, const ring R)
 
matrix mp_CoeffProc (poly f, poly vars, const ring R)
 
void mp_Coef2 (poly v, poly mon, matrix *c, matrix *m, const ring R)
 corresponds to Macauley's coef: the exponent vector of vars has to contain the variables, eg 'xy'; then the poly f is searched for monomials in x and y, these monimials are written to the first row of the matrix co. the second row of co contains the respective factors in f. Thus f = sum co[1,i]*co[2,i], i = 1..cols, rows equals 2. More...
 
int mp_Compare (matrix a, matrix b, const ring R)
 
BOOLEAN mp_Equal (matrix a, matrix b, const ring R)
 
static poly p_Insert (poly p1, poly p2, const ring R)
 
static void mp_PartClean (matrix a, int lr, int lc, const ring R)
 
BOOLEAN mp_IsDiagUnit (matrix U, const ring R)
 
void iiWriteMatrix (matrix im, const char *n, int dim, const ring r, int spaces)
 set spaces to zero by default More...
 
char * iiStringMatrix (matrix im, int dim, const ring r, char ch)
 
void mp_Delete (matrix *a, const ring r)
 
static float mp_PolyWeight (poly p, const ring r)
 
static void mpReplace (int j, int n, int &sign, int *perm)
 
static int mp_PivBar (matrix a, int lr, int lc, const ring r)
 
static void mpSwapRow (matrix a, int pos, int lr, int lc)
 
static int mp_PrepareRow (matrix a, int lr, int lc, const ring R)
 
static int mp_PivRow (matrix a, int lr, int lc, const ring r)
 
static void mpSwapCol (matrix a, int pos, int lr, int lc)
 
static int mp_PreparePiv (matrix a, int lr, int lc, const ring r)
 
static void mp_ElimBar (matrix a0, matrix re, poly div, int lr, int lc, const ring R)
 
void mp_MinorToResult (ideal result, int &elems, matrix a, int r, int c, ideal R, const ring)
 entries of a are minors and go to result (only if not in R) More...
 
static void mpFinalClean (matrix a)
 
void mp_RecMin (int ar, ideal result, int &elems, matrix a, int lr, int lc, poly barDiv, ideal R, const ring r)
 produces recursively the ideal of all arxar-minors of a More...
 
poly mp_DetBareiss (matrix a, const ring r)
 returns the determinant of the matrix m; uses Bareiss algorithm More...
 
matrix mp_Wedge (matrix a, int ar, const ring R)
 
static void p_DecomposeComp (poly p, poly *a, int l, const ring r)
 
static ideal mp_MultAndShift (poly f, ideal B, int s, const ring r)
 
static void mp_AddSubMat (ideal res, ideal sm, int col, const ring r)
 
ideal mp_Tensor (ideal A, ideal B, const ring r)
 

Function Documentation

◆ iiStringMatrix()

char* iiStringMatrix ( matrix  im,
int  dim,
const ring  r,
char  ch 
)

Definition at line 755 of file matpol.cc.

756 {
757  int i,ii = MATROWS(im);
758  int j,jj = MATCOLS(im);
759  poly *pp = im->m;
760  char ch_s[2];
761  ch_s[0]=ch;
762  ch_s[1]='\0';
763 
764  StringSetS("");
765 
766  for (i=0; i<ii; i++)
767  {
768  for (j=0; j<jj; j++)
769  {
770  p_String0(*pp++, r);
771  StringAppendS(ch_s);
772  if (dim > 1) StringAppendS("\n");
773  }
774  }
775  char *s=StringEndS();
776  s[strlen(s)- (dim > 1 ? 2 : 1)]='\0';
777  return s;
778 }

◆ iiWriteMatrix()

void iiWriteMatrix ( matrix  im,
const char *  n,
int  dim,
const ring  r,
int  spaces 
)

set spaces to zero by default

Definition at line 734 of file matpol.cc.

735 {
736  int i,ii = MATROWS(im)-1;
737  int j,jj = MATCOLS(im)-1;
738  poly *pp = im->m;
739 
740  for (i=0; i<=ii; i++)
741  {
742  for (j=0; j<=jj; j++)
743  {
744  if (spaces>0)
745  Print("%-*.*s",spaces,spaces," ");
746  if (dim == 2) Print("%s[%u,%u]=",n,i+1,j+1);
747  else if (dim == 1) Print("%s[%u]=",n,j+1);
748  else if (dim == 0) Print("%s=",n);
749  if ((i<ii)||(j<jj)) p_Write(*pp++, r);
750  else p_Write0(*pp, r);
751  }
752  }
753 }

◆ mp_Add()

matrix mp_Add ( matrix  a,
matrix  b,
const ring  R 
)

Definition at line 178 of file matpol.cc.

179 {
180  int k, n = a->nrows, m = a->ncols;
181  if ((n != b->nrows) || (m != b->ncols))
182  {
183 /*
184 * Werror("cannot add %dx%d matrix and %dx%d matrix",
185 * m,n,b->cols(),b->rows());
186 */
187  return NULL;
188  }
189  matrix c = mpNew(n,m);
190  for (k=m*n-1; k>=0; k--)
191  c->m[k] = p_Add_q(p_Copy(a->m[k], R), p_Copy(b->m[k], R), R);
192  return c;
193 }

◆ mp_AddSubMat()

static void mp_AddSubMat ( ideal  res,
ideal  sm,
int  col,
const ring  r 
)
static

Definition at line 1739 of file matpol.cc.

1740 {
1741  for(int i=0;i<IDELEMS(sm);i++)
1742  {
1743  res->m[col+i]=p_Add_q(res->m[col+i],sm->m[i],r);
1744  sm->m[i]=NULL;
1745  }
1746 }

◆ mp_Coef2()

void mp_Coef2 ( poly  v,
poly  mon,
matrix c,
matrix m,
const ring  R 
)

corresponds to Macauley's coef: the exponent vector of vars has to contain the variables, eg 'xy'; then the poly f is searched for monomials in x and y, these monimials are written to the first row of the matrix co. the second row of co contains the respective factors in f. Thus f = sum co[1,i]*co[2,i], i = 1..cols, rows equals 2.

Definition at line 503 of file matpol.cc.

504 {
505  poly* s;
506  poly p;
507  int sl,i,j;
508  int l=0;
509  poly sel=mp_Select(v,mon, R);
510 
511  p_Vec2Polys(sel,&s,&sl, R);
512  for (i=0; i<sl; i++)
513  l=si_max(l,pLength(s[i]));
514  *c=mpNew(sl,l);
515  *m=mpNew(sl,l);
516  poly h;
517  int isConst;
518  for (j=1; j<=sl;j++)
519  {
520  p=s[j-1];
521  if (p_IsConstant(p, R)) /*p != NULL */
522  {
523  isConst=-1;
524  i=l;
525  }
526  else
527  {
528  isConst=1;
529  i=1;
530  }
531  while(p!=NULL)
532  {
533  h = p_Head(p, R);
534  MATELEM(*m,j,i) = h;
535  i+=isConst;
536  p = p->next;
537  }
538  }
539  while (v!=NULL)
540  {
541  i = 1;
542  j = __p_GetComp(v, R);
543  loop
544  {
545  poly mp=MATELEM(*m,j,i);
546  if (mp!=NULL)
547  {
548  h = mp_Exdiv(v, mp /*MATELEM(*m,j,i)*/, mp, R);
549  if (h!=NULL)
550  {
551  p_SetComp(h,0, R);
552  MATELEM(*c,j,i) = p_Add_q(MATELEM(*c,j,i), h, R);
553  break;
554  }
555  }
556  if (i < l)
557  i++;
558  else
559  break;
560  }
561  v = v->next;
562  }
563 }

◆ mp_CoeffProc()

matrix mp_CoeffProc ( poly  f,
poly  vars,
const ring  R 
)

Definition at line 401 of file matpol.cc.

402 {
403  assume(vars!=NULL);
404  poly sel, h;
405  int l, i;
406  int pos_of_1 = -1;
407  matrix co;
408 
409  if (f==NULL)
410  {
411  co = mpNew(2, 1);
412  MATELEM(co,1,1) = p_One(R);
413  MATELEM(co,2,1) = NULL;
414  return co;
415  }
416  sel = mp_Select(f, vars, R);
417  l = pLength(sel);
418  co = mpNew(2, l);
419 
421  {
422  for (i=l; i>=1; i--)
423  {
424  h = sel;
425  pIter(sel);
426  pNext(h)=NULL;
427  MATELEM(co,1,i) = h;
428  MATELEM(co,2,i) = NULL;
429  if (p_IsConstant(h, R)) pos_of_1 = i;
430  }
431  }
432  else
433  {
434  for (i=1; i<=l; i++)
435  {
436  h = sel;
437  pIter(sel);
438  pNext(h)=NULL;
439  MATELEM(co,1,i) = h;
440  MATELEM(co,2,i) = NULL;
441  if (p_IsConstant(h, R)) pos_of_1 = i;
442  }
443  }
444  while (f!=NULL)
445  {
446  i = 1;
447  loop
448  {
449  if (i!=pos_of_1)
450  {
451  h = mp_Exdiv(f, MATELEM(co,1,i),vars, R);
452  if (h!=NULL)
453  {
454  MATELEM(co,2,i) = p_Add_q(MATELEM(co,2,i), h, R);
455  break;
456  }
457  }
458  if (i == l)
459  {
460  // check monom 1 last:
461  if (pos_of_1 != -1)
462  {
463  h = mp_Exdiv(f, MATELEM(co,1,pos_of_1),vars, R);
464  if (h!=NULL)
465  {
466  MATELEM(co,2,pos_of_1) = p_Add_q(MATELEM(co,2,pos_of_1), h, R);
467  }
468  }
469  break;
470  }
471  i ++;
472  }
473  pIter(f);
474  }
475  return co;
476 }

◆ mp_Coeffs()

matrix mp_Coeffs ( ideal  I,
int  var,
const ring  R 
)

corresponds to Maple's coeffs: var has to be the number of a variable

Definition at line 315 of file matpol.cc.

316 {
317  poly h,f;
318  int l, i, c, m=0;
319  /* look for maximal power m of x_var in I */
320  for (i=IDELEMS(I)-1; i>=0; i--)
321  {
322  f=I->m[i];
323  while (f!=NULL)
324  {
325  l=p_GetExp(f,var, R);
326  if (l>m) m=l;
327  pIter(f);
328  }
329  }
330  matrix co=mpNew((m+1)*I->rank,IDELEMS(I));
331  /* divide each monomial by a power of x_var,
332  * remember the power in l and the component in c*/
333  for (i=IDELEMS(I)-1; i>=0; i--)
334  {
335  f=I->m[i];
336  I->m[i]=NULL;
337  while (f!=NULL)
338  {
339  l=p_GetExp(f,var, R);
340  p_SetExp(f,var,0, R);
341  c=si_max((int)p_GetComp(f, R),1);
342  p_SetComp(f,0, R);
343  p_Setm(f, R);
344  /* now add the resulting monomial to co*/
345  h=pNext(f);
346  pNext(f)=NULL;
347  //MATELEM(co,c*(m+1)-l,i+1)
348  // =p_Add_q(MATELEM(co,c*(m+1)-l,i+1),f, R);
349  MATELEM(co,(c-1)*(m+1)+l+1,i+1)
350  =p_Add_q(MATELEM(co,(c-1)*(m+1)+l+1,i+1),f, R);
351  /* iterate f*/
352  f=h;
353  }
354  }
355  id_Delete(&I, R);
356  return co;
357 }

◆ mp_Compare()

int mp_Compare ( matrix  a,
matrix  b,
const ring  R 
)

Definition at line 565 of file matpol.cc.

566 {
567  if (MATCOLS(a)<MATCOLS(b)) return -1;
568  else if (MATCOLS(a)>MATCOLS(b)) return 1;
569  if (MATROWS(a)<MATROWS(b)) return -1;
570  else if (MATROWS(a)<MATROWS(b)) return 1;
571 
572  unsigned ii=MATCOLS(a)*MATROWS(a)-1;
573  unsigned j=0;
574  int r=0;
575  while (j<=ii)
576  {
577  r=p_Compare(a->m[j],b->m[j],R);
578  if (r!=0) return r;
579  j++;
580  }
581  return r;
582 }

◆ mp_Copy() [1/2]

matrix mp_Copy ( const matrix  a,
const ring  rSrc,
const ring  rDst 
)

copies matrix a from rSrc into rDst

Definition at line 84 of file matpol.cc.

85 {
86  id_Test((ideal)a, rSrc);
87 
88  poly t;
89  int i, m=MATROWS(a), n=MATCOLS(a);
90 
91  matrix b = mpNew(m, n);
92 
93  for (i=m*n-1; i>=0; i--)
94  {
95  t = a->m[i];
96  if (t!=NULL)
97  {
98  b->m[i] = prCopyR_NoSort(t, rSrc, rDst);
99  p_Normalize(b->m[i], rDst);
100  }
101  }
102  b->rank=a->rank;
103 
104  id_Test((ideal)b, rDst);
105 
106  return b;
107 }

◆ mp_Copy() [2/2]

matrix mp_Copy ( matrix  a,
const ring  r 
)

copies matrix a (from ring r to r)

Definition at line 63 of file matpol.cc.

64 {
65  id_Test((ideal)a, r);
66  poly t;
67  int i, m=MATROWS(a), n=MATCOLS(a);
68  matrix b = mpNew(m, n);
69 
70  for (i=m*n-1; i>=0; i--)
71  {
72  t = a->m[i];
73  if (t!=NULL)
74  {
75  p_Normalize(t, r);
76  b->m[i] = p_Copy(t, r);
77  }
78  }
79  b->rank=a->rank;
80  return b;
81 }

◆ mp_Delete()

void mp_Delete ( matrix a,
const ring  r 
)

Definition at line 780 of file matpol.cc.

781 {
782  id_Delete((ideal *) a, r);
783 }

◆ mp_DetBareiss()

poly mp_DetBareiss ( matrix  a,
const ring  r 
)

returns the determinant of the matrix m; uses Bareiss algorithm

Definition at line 1576 of file matpol.cc.

1577 {
1578  int s;
1579  poly div, res;
1580  if (MATROWS(a) != MATCOLS(a))
1581  {
1582  Werror("det of %d x %d matrix",MATROWS(a),MATCOLS(a));
1583  return NULL;
1584  }
1585  matrix c = mp_Copy(a,r);
1586  mp_permmatrix *Bareiss = new mp_permmatrix(c,r);
1587  row_col_weight w(Bareiss->mpGetRdim(), Bareiss->mpGetCdim());
1588 
1589  /* Bareiss */
1590  div = NULL;
1591  while(Bareiss->mpPivotBareiss(&w))
1592  {
1593  Bareiss->mpElimBareiss(div);
1594  div = Bareiss->mpGetElem(Bareiss->mpGetRdim(), Bareiss->mpGetCdim());
1595  }
1596  Bareiss->mpRowReorder();
1597  Bareiss->mpColReorder();
1598  Bareiss->mpSaveArray();
1599  s = Bareiss->mpGetSign();
1600  delete Bareiss;
1601 
1602  /* result */
1603  res = MATELEM(c,1,1);
1604  MATELEM(c,1,1) = NULL;
1605  id_Delete((ideal *)&c,r);
1606  if (s < 0)
1607  res = p_Neg(res,r);
1608  return res;
1609 }

◆ mp_ElimBar()

static void mp_ElimBar ( matrix  a0,
matrix  re,
poly  div,
int  lr,
int  lc,
const ring  R 
)
static

Definition at line 1349 of file matpol.cc.

1350 {
1351  int r=lr-1, c=lc-1;
1352  poly *b = a0->m, *x = re->m;
1353  poly piv, elim, q1, *ap, *a, *q;
1354  int i, j;
1355 
1356  ap = &b[r*a0->ncols];
1357  piv = ap[c];
1358  for(j=c-1; j>=0; j--)
1359  if (ap[j] != NULL) ap[j] = p_Neg(ap[j],R);
1360  for(i=r-1; i>=0; i--)
1361  {
1362  a = &b[i*a0->ncols];
1363  q = &x[i*re->ncols];
1364  if (a[c] != NULL)
1365  {
1366  elim = a[c];
1367  for (j=c-1; j>=0; j--)
1368  {
1369  q1 = NULL;
1370  if (a[j] != NULL)
1371  {
1372  q1 = sm_MultDiv(a[j], piv, div,R);
1373  if (ap[j] != NULL)
1374  {
1375  poly q2 = sm_MultDiv(ap[j], elim, div, R);
1376  q1 = p_Add_q(q1,q2,R);
1377  }
1378  }
1379  else if (ap[j] != NULL)
1380  q1 = sm_MultDiv(ap[j], elim, div, R);
1381  if (q1 != NULL)
1382  {
1383  if (div)
1384  sm_SpecialPolyDiv(q1, div,R);
1385  q[j] = q1;
1386  }
1387  }
1388  }
1389  else
1390  {
1391  for (j=c-1; j>=0; j--)
1392  {
1393  if (a[j] != NULL)
1394  {
1395  q1 = sm_MultDiv(a[j], piv, div, R);
1396  if (div)
1397  sm_SpecialPolyDiv(q1, div, R);
1398  q[j] = q1;
1399  }
1400  }
1401  }
1402  }
1403 }

◆ mp_Equal()

BOOLEAN mp_Equal ( matrix  a,
matrix  b,
const ring  R 
)

Definition at line 584 of file matpol.cc.

585 {
586  if ((MATCOLS(a)!=MATCOLS(b)) || (MATROWS(a)!=MATROWS(b)))
587  return FALSE;
588  int i=MATCOLS(a)*MATROWS(a)-1;
589  while (i>=0)
590  {
591  if (a->m[i]==NULL)
592  {
593  if (b->m[i]!=NULL) return FALSE;
594  }
595  else if (b->m[i]==NULL) return FALSE;
596  else if (p_Cmp(a->m[i],b->m[i], R)!=0) return FALSE;
597  i--;
598  }
599  i=MATCOLS(a)*MATROWS(a)-1;
600  while (i>=0)
601  {
602  if(!p_EqualPolys(a->m[i],b->m[i], R)) return FALSE;
603  i--;
604  }
605  return TRUE;
606 }

◆ mp_Exdiv()

static poly mp_Exdiv ( poly  m,
poly  d,
poly  vars,
const ring  R 
)
static

Definition at line 483 of file matpol.cc.

484 {
485  int i;
486  poly h = p_Head(m, R);
487  for (i=1; i<=rVar(R); i++)
488  {
489  if (p_GetExp(vars,i, R) > 0)
490  {
491  if (p_GetExp(d,i, R) != p_GetExp(h,i, R))
492  {
493  p_Delete(&h, R);
494  return NULL;
495  }
496  p_SetExp(h,i,0, R);
497  }
498  }
499  p_Setm(h, R);
500  return h;
501 }

◆ mp_InitI()

matrix mp_InitI ( int  r,
int  c,
int  v,
const ring  R 
)

make it a v * unit matrix

Definition at line 128 of file matpol.cc.

129 {
130  return mp_InitP(r, c, p_ISet(v, R), R);
131 }

◆ mp_InitP()

matrix mp_InitP ( int  r,
int  c,
poly  p,
const ring  R 
)

make it a p * unit matrix

Definition at line 112 of file matpol.cc.

113 {
114  matrix rc = mpNew(r,c);
115  int i=si_min(r,c), n = c*(i-1)+i-1, inc = c+1;
116 
117  p_Normalize(p, R);
118  while (n>0)
119  {
120  rc->m[n] = p_Copy(p, R);
121  n -= inc;
122  }
123  rc->m[0]=p;
124  return rc;
125 }

◆ mp_IsDiagUnit()

BOOLEAN mp_IsDiagUnit ( matrix  U,
const ring  R 
)

Definition at line 716 of file matpol.cc.

717 {
718  if(MATROWS(U)!=MATCOLS(U))
719  return FALSE;
720  for(int i=MATCOLS(U);i>=1;i--)
721  {
722  for(int j=MATCOLS(U); j>=1; j--)
723  {
724  if (i==j)
725  {
726  if (!p_IsUnit(MATELEM(U,i,i), R)) return FALSE;
727  }
728  else if (MATELEM(U,i,j)!=NULL) return FALSE;
729  }
730  }
731  return TRUE;
732 }

◆ mp_MinorToResult()

void mp_MinorToResult ( ideal  result,
int &  elems,
matrix  a,
int  r,
int  c,
ideal  R,
const  ring 
)

entries of a are minors and go to result (only if not in R)

Definition at line 1407 of file matpol.cc.

1409 {
1410  poly *q1;
1411  int e=IDELEMS(result);
1412  int i,j;
1413 
1414  if (R != NULL)
1415  {
1416  for (i=r-1;i>=0;i--)
1417  {
1418  q1 = &(a->m)[i*a->ncols];
1419  //for (j=c-1;j>=0;j--)
1420  //{
1421  // if (q1[j]!=NULL) q1[j] = kNF(R,currRing->qideal,q1[j]);
1422  //}
1423  }
1424  }
1425  for (i=r-1;i>=0;i--)
1426  {
1427  q1 = &(a->m)[i*a->ncols];
1428  for (j=c-1;j>=0;j--)
1429  {
1430  if (q1[j]!=NULL)
1431  {
1432  if (elems>=e)
1433  {
1434  pEnlargeSet(&(result->m),e,e);
1435  e += e;
1436  IDELEMS(result) =e;
1437  }
1438  result->m[elems] = q1[j];
1439  q1[j] = NULL;
1440  elems++;
1441  }
1442  }
1443  }
1444 }

◆ mp_Monomials()

void mp_Monomials ( matrix  c,
int  r,
int  var,
matrix  m,
const ring  R 
)

Definition at line 364 of file matpol.cc.

365 {
366  /* clear contents of m*/
367  int k,l;
368  for (k=MATROWS(m);k>0;k--)
369  {
370  for(l=MATCOLS(m);l>0;l--)
371  {
372  p_Delete(&MATELEM(m,k,l), R);
373  }
374  }
375  omfreeSize((ADDRESS)m->m,MATROWS(m)*MATCOLS(m)*sizeof(poly));
376  /* allocate monoms in the right size r x MATROWS(c)*/
377  m->m=(poly*)omAlloc0(r*MATROWS(c)*sizeof(poly));
378  MATROWS(m)=r;
379  MATCOLS(m)=MATROWS(c);
380  m->rank=r;
381  /* the maximal power p of x_var: MATCOLS(m)=r*(p+1) */
382  int p=MATCOLS(m)/r-1;
383  /* fill in the powers of x_var=h*/
384  poly h=p_One(R);
385  for(k=r;k>0; k--)
386  {
387  MATELEM(m,k,k*(p+1))=p_One(R);
388  }
389  for(l=p;l>=0; l--)
390  {
391  p_SetExp(h,var,p-l, R);
392  p_Setm(h, R);
393  for(k=r;k>0; k--)
394  {
395  MATELEM(m,k,k*(p+1)-l)=p_Copy(h, R);
396  }
397  }
398  p_Delete(&h, R);
399 }

◆ mp_Mult()

matrix mp_Mult ( matrix  a,
matrix  b,
const ring  R 
)

Definition at line 212 of file matpol.cc.

213 {
214  int i, j, k;
215  int m = MATROWS(a);
216  int p = MATCOLS(a);
217  int q = MATCOLS(b);
218 
219  if (p!=MATROWS(b))
220  {
221 /*
222 * Werror("cannot multiply %dx%d matrix and %dx%d matrix",
223 * m,p,b->rows(),q);
224 */
225  return NULL;
226  }
227  matrix c = mpNew(m,q);
228 
229  for (i=1; i<=m; i++)
230  {
231  for (k=1; k<=p; k++)
232  {
233  poly aik;
234  if ((aik=MATELEM(a,i,k))!=NULL)
235  {
236  for (j=1; j<=q; j++)
237  {
238  poly bkj;
239  if ((bkj=MATELEM(b,k,j))!=NULL)
240  {
241  poly *cij=&(MATELEM(c,i,j));
242  poly s = pp_Mult_qq(aik /*MATELEM(a,i,k)*/, bkj/*MATELEM(b,k,j)*/, R);
243  if (/*MATELEM(c,i,j)*/ (*cij)==NULL) (*cij)=s;
244  else (*cij) = p_Add_q((*cij) /*MATELEM(c,i,j)*/ ,s, R);
245  }
246  }
247  }
248  // pNormalize(t);
249  // MATELEM(c,i,j) = t;
250  }
251  }
252  for(i=m*q-1;i>=0;i--) p_Normalize(c->m[i], R);
253  return c;
254 }

◆ mp_MultAndShift()

static ideal mp_MultAndShift ( poly  f,
ideal  B,
int  s,
const ring  r 
)
static

Definition at line 1720 of file matpol.cc.

1721 {
1722  assume(f!=NULL);
1723  ideal res=idInit(IDELEMS(B),B->rank+s);
1724  int q=IDELEMS(B); // p x q
1725  for(int j=0;j<q;j++)
1726  {
1727  poly h=pp_Mult_qq(f,B->m[j],r);
1728  if (h!=NULL)
1729  {
1730  if (s>0) p_Shift(&h,s,r);
1731  res->m[j]=h;
1732  }
1733  }
1734  p_Delete(&f,r);
1735  return res;
1736 }

◆ mp_MultI()

matrix mp_MultI ( matrix  a,
int  f,
const ring  R 
)

c = f*a

Definition at line 134 of file matpol.cc.

135 {
136  int k, n = a->nrows, m = a->ncols;
137  poly p = p_ISet(f, R);
138  matrix c = mpNew(n,m);
139 
140  for (k=m*n-1; k>0; k--)
141  c->m[k] = pp_Mult_qq(a->m[k], p, R);
142  c->m[0] = p_Mult_q(p_Copy(a->m[0], R), p, R);
143  return c;
144 }

◆ mp_MultP()

matrix mp_MultP ( matrix  a,
poly  p,
const ring  R 
)

multiply a matrix 'a' by a poly 'p', destroy the args

Definition at line 147 of file matpol.cc.

148 {
149  int k, n = a->nrows, m = a->ncols;
150 
151  p_Normalize(p, R);
152  for (k=m*n-1; k>0; k--)
153  {
154  if (a->m[k]!=NULL)
155  a->m[k] = p_Mult_q(a->m[k], p_Copy(p, R), R);
156  }
157  a->m[0] = p_Mult_q(a->m[0], p, R);
158  return a;
159 }

◆ mp_PartClean()

static void mp_PartClean ( matrix  a,
int  lr,
int  lc,
const ring  R 
)
static

Definition at line 704 of file matpol.cc.

705 {
706  poly *q1;
707  int i,j;
708 
709  for (i=lr-1;i>=0;i--)
710  {
711  q1 = &(a->m)[i*a->ncols];
712  for (j=lc-1;j>=0;j--) if(q1[j]) p_Delete(&q1[j], R);
713  }
714 }

◆ mp_PivBar()

static int mp_PivBar ( matrix  a,
int  lr,
int  lc,
const ring  r 
)
static

Definition at line 1234 of file matpol.cc.

1235 {
1236  float f1, f2;
1237  poly *q1;
1238  int i,j,io;
1239 
1240  io = -1;
1241  f1 = 1.0e30;
1242  for (i=lr-1;i>=0;i--)
1243  {
1244  q1 = &(a->m)[i*a->ncols];
1245  f2 = 0.0;
1246  for (j=lc-1;j>=0;j--)
1247  {
1248  if (q1[j]!=NULL)
1249  f2 += mp_PolyWeight(q1[j],r);
1250  }
1251  if ((f2!=0.0) && (f2<f1))
1252  {
1253  f1 = f2;
1254  io = i;
1255  }
1256  }
1257  if (io<0) return 0;
1258  else return io+1;
1259 }

◆ mp_PivRow()

static int mp_PivRow ( matrix  a,
int  lr,
int  lc,
const ring  r 
)
static

Definition at line 1294 of file matpol.cc.

1295 {
1296  float f1, f2;
1297  poly *q1;
1298  int j,jo;
1299 
1300  jo = -1;
1301  f1 = 1.0e30;
1302  q1 = &(a->m)[(lr-1)*a->ncols];
1303  for (j=lc-1;j>=0;j--)
1304  {
1305  if (q1[j]!=NULL)
1306  {
1307  f2 = mp_PolyWeight(q1[j],r);
1308  if (f2<f1)
1309  {
1310  f1 = f2;
1311  jo = j;
1312  }
1313  }
1314  }
1315  if (jo<0) return 0;
1316  else return jo+1;
1317 }

◆ mp_PolyWeight()

static float mp_PolyWeight ( poly  p,
const ring  r 
)
static

Definition at line 1202 of file matpol.cc.

1203 {
1204  int i;
1205  float res;
1206 
1207  if (pNext(p) == NULL)
1208  {
1209  res = (float)n_Size(pGetCoeff(p),r->cf);
1210  for (i=r->N;i>0;i--)
1211  {
1212  if(p_GetExp(p,i,r)!=0)
1213  {
1214  res += 2.0;
1215  break;
1216  }
1217  }
1218  }
1219  else
1220  {
1221  res = 0.0;
1222  do
1223  {
1224  res += (float)n_Size(pGetCoeff(p),r->cf)+2.0;
1225  pIter(p);
1226  }
1227  while (p);
1228  }
1229  return res;
1230 }

◆ mp_PreparePiv()

static int mp_PreparePiv ( matrix  a,
int  lr,
int  lc,
const ring  r 
)
static

Definition at line 1339 of file matpol.cc.

1340 {
1341  int c;
1342 
1343  c = mp_PivRow(a, lr, lc,r);
1344  if(c==0) return 0;
1345  if(c<lc) mpSwapCol(a, c, lr, lc);
1346  return 1;
1347 }

◆ mp_PrepareRow()

static int mp_PrepareRow ( matrix  a,
int  lr,
int  lc,
const ring  R 
)
static

Definition at line 1281 of file matpol.cc.

1282 {
1283  int r;
1284 
1285  r = mp_PivBar(a,lr,lc,R);
1286  if(r==0) return 0;
1287  if(r<lr) mpSwapRow(a, r, lr, lc);
1288  return 1;
1289 }

◆ mp_RecMin()

void mp_RecMin ( int  ar,
ideal  result,
int &  elems,
matrix  a,
int  lr,
int  lc,
poly  barDiv,
ideal  R,
const ring  r 
)

produces recursively the ideal of all arxar-minors of a

for minors with Bareiss

Definition at line 1503 of file matpol.cc.

1505 {
1506  int k;
1507  int kr=lr-1,kc=lc-1;
1508  matrix nextLevel=mpNew(kr,kc);
1509 
1510  loop
1511  {
1512 /*--- look for an optimal row and bring it to last position ------------*/
1513  if(mp_PrepareRow(a,lr,lc,r)==0) break;
1514 /*--- now take all pivots from the last row ------------*/
1515  k = lc;
1516  loop
1517  {
1518  if(mp_PreparePiv(a,lr,k,r)==0) break;
1519  mp_ElimBar(a,nextLevel,barDiv,lr,k,r);
1520  k--;
1521  if (ar>1)
1522  {
1523  mp_RecMin(ar-1,result,elems,nextLevel,kr,k,a->m[kr*a->ncols+k],R,r);
1524  mp_PartClean(nextLevel,kr,k, r);
1525  }
1526  else mp_MinorToResult(result,elems,nextLevel,kr,k,R,r);
1527  if (ar>k-1) break;
1528  }
1529  if (ar>=kr) break;
1530 /*--- now we have to take out the last row...------------*/
1531  lr = kr;
1532  kr--;
1533  }
1534  mpFinalClean(nextLevel);
1535 }

◆ mp_Select()

static poly mp_Select ( poly  fro,
poly  what,
const ring  R 
)
static

Definition at line 670 of file matpol.cc.

671 {
672  int i;
673  poly h, res;
674  res = NULL;
675  while (fro!=NULL)
676  {
677  h = p_One(R);
678  for (i=1; i<=rVar(R); i++)
679  p_SetExp(h,i, p_GetExp(fro,i, R) * p_GetExp(what, i, R), R);
680  p_SetComp(h, p_GetComp(fro, R), R);
681  p_Setm(h, R);
682  res = p_Insert(h, res, R);
683  fro = fro->next;
684  }
685  return res;
686 }

◆ mp_Sub()

matrix mp_Sub ( matrix  a,
matrix  b,
const ring  R 
)

Definition at line 195 of file matpol.cc.

196 {
197  int k, n = a->nrows, m = a->ncols;
198  if ((n != b->nrows) || (m != b->ncols))
199  {
200 /*
201 * Werror("cannot sub %dx%d matrix and %dx%d matrix",
202 * m,n,b->cols(),b->rows());
203 */
204  return NULL;
205  }
206  matrix c = mpNew(n,m);
207  for (k=m*n-1; k>=0; k--)
208  c->m[k] = p_Sub(p_Copy(a->m[k], R), p_Copy(b->m[k], R), R);
209  return c;
210 }

◆ mp_Tensor()

ideal mp_Tensor ( ideal  A,
ideal  B,
const ring  r 
)

Definition at line 1748 of file matpol.cc.

1749 {
1750  // size of the result n*q x m*p
1751  int n=IDELEMS(A); // m x n
1752  int m=A->rank;
1753  int q=IDELEMS(B); // p x q
1754  int p=B->rank;
1755  ideal res=idInit(n*q,m*p);
1756  poly *a=(poly*)omAlloc(m*sizeof(poly));
1757  for(int i=0; i<n; i++)
1758  {
1759  memset(a,0,m*sizeof(poly));
1760  p_DecomposeComp(p_Copy(A->m[i],r),a,m,r);
1761  for(int j=0;j<m;j++)
1762  {
1763  if (a[j]!=NULL)
1764  {
1765  ideal sm=mp_MultAndShift(a[j], // A_i_j
1766  B,
1767  j*p, // shift j*p down
1768  r);
1769  mp_AddSubMat(res,sm,i*q,r); // add this columns to col i*q ff
1770  id_Delete(&sm,r); // delete the now empty ideal
1771  }
1772  }
1773  }
1774  omFreeSize(a,m*sizeof(poly));
1775  return res;
1776 }

◆ mp_Trace()

poly mp_Trace ( matrix  a,
const ring  R 
)

Definition at line 277 of file matpol.cc.

278 {
279  int i;
280  int n = (MATCOLS(a)<MATROWS(a)) ? MATCOLS(a) : MATROWS(a);
281  poly t = NULL;
282 
283  for (i=1; i<=n; i++)
284  t = p_Add_q(t, p_Copy(MATELEM(a,i,i), R), R);
285  return t;
286 }

◆ mp_Transp()

matrix mp_Transp ( matrix  a,
const ring  R 
)

Definition at line 256 of file matpol.cc.

257 {
258  int i, j, r = MATROWS(a), c = MATCOLS(a);
259  poly *p;
260  matrix b = mpNew(c,r);
261 
262  p = b->m;
263  for (i=0; i<c; i++)
264  {
265  for (j=0; j<r; j++)
266  {
267  if (a->m[j*c+i]!=NULL) *p = p_Copy(a->m[j*c+i], R);
268  p++;
269  }
270  }
271  return b;
272 }

◆ mp_Wedge()

matrix mp_Wedge ( matrix  a,
int  ar,
const ring  R 
)

Definition at line 1651 of file matpol.cc.

1652 {
1653  int i,j,k,l;
1654  int *rowchoise,*colchoise;
1655  BOOLEAN rowch,colch;
1656  matrix result;
1657  matrix tmp;
1658  poly p;
1659 
1660  i = binom(a->nrows,ar);
1661  j = binom(a->ncols,ar);
1662 
1663  rowchoise=(int *)omAlloc(ar*sizeof(int));
1664  colchoise=(int *)omAlloc(ar*sizeof(int));
1665  result = mpNew(i,j);
1666  tmp = mpNew(ar,ar);
1667  l = 1; /* k,l:the index in result*/
1668  idInitChoise(ar,1,a->nrows,&rowch,rowchoise);
1669  while (!rowch)
1670  {
1671  k=1;
1672  idInitChoise(ar,1,a->ncols,&colch,colchoise);
1673  while (!colch)
1674  {
1675  for (i=1; i<=ar; i++)
1676  {
1677  for (j=1; j<=ar; j++)
1678  {
1679  MATELEM(tmp,i,j) = MATELEM(a,rowchoise[i-1],colchoise[j-1]);
1680  }
1681  }
1682  p = mp_DetBareiss(tmp, R);
1683  if ((k+l) & 1) p=p_Neg(p, R);
1684  MATELEM(result,l,k) = p;
1685  k++;
1686  idGetNextChoise(ar,a->ncols,&colch,colchoise);
1687  }
1688  idGetNextChoise(ar,a->nrows,&rowch,rowchoise);
1689  l++;
1690  }
1691 
1692  /*delete the matrix tmp*/
1693  for (i=1; i<=ar; i++)
1694  {
1695  for (j=1; j<=ar; j++) MATELEM(tmp,i,j) = NULL;
1696  }
1697  id_Delete((ideal *) &tmp, R);
1698  return (result);
1699 }

◆ mpFinalClean()

static void mpFinalClean ( matrix  a)
static

Definition at line 1495 of file matpol.cc.

1496 {
1497  omFreeSize((ADDRESS)a->m,a->nrows*a->ncols*sizeof(poly));
1499 }

◆ mpNew()

matrix mpNew ( int  r,
int  c 
)

create a r x c zero-matrix

Definition at line 36 of file matpol.cc.

37 {
38  int rr=r;
39  if (rr<=0) rr=1;
40  //if ( (((int)(MAX_INT_VAL/sizeof(poly))) / rr) <= c)
41  //{
42  // Werror("internal error: creating matrix[%d][%d]",r,c);
43  // return NULL;
44  //}
46  rc->nrows = r;
47  rc->ncols = c;
48  rc->rank = r;
49  if ((c != 0)&&(r!=0))
50  {
51  size_t s=((size_t)r)*((size_t)c)*sizeof(poly);
52  rc->m = (poly*)omAlloc0(s);
53  //if (rc->m==NULL)
54  //{
55  // Werror("internal error: creating matrix[%d][%d]",r,c);
56  // return NULL;
57  //}
58  }
59  return rc;
60 }

◆ mpReplace()

static void mpReplace ( int  j,
int  n,
int &  sign,
int *  perm 
)
static

Definition at line 1044 of file matpol.cc.

1045 {
1046  int k;
1047 
1048  if (j != n)
1049  {
1050  k = perm[n];
1051  perm[n] = perm[j];
1052  perm[j] = k;
1053  sign = -sign;
1054  }
1055 }

◆ mpSwapCol()

static void mpSwapCol ( matrix  a,
int  pos,
int  lr,
int  lc 
)
static

Definition at line 1319 of file matpol.cc.

1320 {
1321  poly sw;
1322  int j;
1323  poly* a2 = a->m;
1324  poly* a1 = &a2[pos-1];
1325 
1326  a2 = &a2[lc-1];
1327  for (j=a->ncols*(lr-1); j>=0; j-=a->ncols)
1328  {
1329  sw = a1[j];
1330  a1[j] = a2[j];
1331  a2[j] = sw;
1332  }
1333 }

◆ mpSwapRow()

static void mpSwapRow ( matrix  a,
int  pos,
int  lr,
int  lc 
)
static

Definition at line 1261 of file matpol.cc.

1262 {
1263  poly sw;
1264  int j;
1265  poly* a2 = a->m;
1266  poly* a1 = &a2[a->ncols*(pos-1)];
1267 
1268  a2 = &a2[a->ncols*(lr-1)];
1269  for (j=lc-1; j>=0; j--)
1270  {
1271  sw = a1[j];
1272  a1[j] = a2[j];
1273  a2[j] = sw;
1274  }
1275 }

◆ p_DecomposeComp()

static void p_DecomposeComp ( poly  p,
poly *  a,
int  l,
const ring  r 
)
static

Definition at line 1701 of file matpol.cc.

1702 {
1703  poly h=p;
1704  while(h!=NULL)
1705  {
1706  poly hh=pNext(h);
1707  pNext(h)=a[__p_GetComp(h,r)-1];
1708  a[__p_GetComp(h,r)-1]=h;
1709  p_SetComp(h,0,r);
1710  p_SetmComp(h,r);
1711  h=hh;
1712  }
1713  for(int i=0;i<l;i++)
1714  {
1715  if(a[i]!=NULL) a[i]=pReverse(a[i]);
1716  }
1717 }

◆ p_Insert()

static poly p_Insert ( poly  p1,
poly  p2,
const ring  R 
)
static

Definition at line 612 of file matpol.cc.

613 {
614  poly a1, p, a2, a;
615  int c;
616 
617  if (p1==NULL) return p2;
618  if (p2==NULL) return p1;
619  a1 = p1;
620  a2 = p2;
621  a = p = p_One(R);
622  loop
623  {
624  c = p_Cmp(a1, a2, R);
625  if (c == 1)
626  {
627  a = pNext(a) = a1;
628  pIter(a1);
629  if (a1==NULL)
630  {
631  pNext(a) = a2;
632  break;
633  }
634  }
635  else if (c == -1)
636  {
637  a = pNext(a) = a2;
638  pIter(a2);
639  if (a2==NULL)
640  {
641  pNext(a) = a1;
642  break;
643  }
644  }
645  else
646  {
647  p_LmDelete(&a2, R);
648  a = pNext(a) = a1;
649  pIter(a1);
650  if (a1==NULL)
651  {
652  pNext(a) = a2;
653  break;
654  }
655  else if (a2==NULL)
656  {
657  pNext(a) = a1;
658  break;
659  }
660  }
661  }
662  p_LmDelete(&p, R);
663  return p;
664 }

◆ pMultMp()

matrix pMultMp ( poly  p,
matrix  a,
const ring  R 
)

Definition at line 164 of file matpol.cc.

165 {
166  int k, n = a->nrows, m = a->ncols;
167 
168  p_Normalize(p, R);
169  for (k=m*n-1; k>0; k--)
170  {
171  if (a->m[k]!=NULL)
172  a->m[k] = p_Mult_q(p_Copy(p, R), a->m[k], R);
173  }
174  a->m[0] = p_Mult_q(p, a->m[0], R);
175  return a;
176 }

◆ TraceOfProd()

poly TraceOfProd ( matrix  a,
matrix  b,
int  n,
const ring  R 
)

Definition at line 291 of file matpol.cc.

292 {
293  int i, j;
294  poly p, t = NULL;
295 
296  for (i=1; i<=n; i++)
297  {
298  for (j=1; j<=n; j++)
299  {
300  p = pp_Mult_qq(MATELEM(a,i,j), MATELEM(b,j,i), R);
301  t = p_Add_q(t, p, R);
302  }
303  }
304  return t;
305 }
dim
int dim(ideal I, ring r)
Definition: tropicalStrategy.cc:23
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
FALSE
#define FALSE
Definition: auxiliary.h:94
sip_sideal_bin
omBin sip_sideal_bin
Definition: simpleideals.cc:29
matrix
ip_smatrix * matrix
Definition: matpol.h:31
p_GetComp
#define p_GetComp(p, r)
Definition: monomials.h:71
ip_smatrix
Definition: matpol.h:14
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:107
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:469
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
p_Normalize
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3709
k
int k
Definition: cfEzgcd.cc:92
p_Write0
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
mp_PivBar
static int mp_PivBar(matrix a, int lr, int lc, const ring r)
Definition: matpol.cc:1234
x
Variable x
Definition: cfModGcd.cc:4023
MATELEM
#define MATELEM(mat, i, j)
Definition: matpol.h:30
mp_MultAndShift
static ideal mp_MultAndShift(poly f, ideal B, int s, const ring r)
Definition: matpol.cc:1720
result
return result
Definition: facAbsBiFact.cc:76
mp_permmatrix::mpPivotBareiss
int mpPivotBareiss(row_col_weight *)
Definition: matpol.cc:1059
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3633
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
mp_ElimBar
static void mp_ElimBar(matrix a0, matrix re, poly div, int lr, int lc, const ring R)
Definition: matpol.cc:1349
p_Head
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:825
p_Neg
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1043
mp_Select
static poly mp_Select(poly fro, poly what, const ring)
Definition: matpol.cc:670
mp_Exdiv
static poly mp_Exdiv(poly m, poly d, poly vars, const ring)
Definition: matpol.cc:483
mp_PrepareRow
static int mp_PrepareRow(matrix a, int lr, int lc, const ring R)
Definition: matpol.cc:1281
mp_InitP
matrix mp_InitP(int r, int c, poly p, const ring R)
make it a p * unit matrix
Definition: matpol.cc:112
idGetNextChoise
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:855
sign
static int sign(int x)
Definition: ring.cc:3328
__p_GetComp
#define __p_GetComp(p, r)
Definition: monomials.h:70
mp_RecMin
void mp_RecMin(int ar, ideal result, int &elems, matrix a, int lr, int lc, poly barDiv, ideal R, const ring r)
produces recursively the ideal of all arxar-minors of a
Definition: matpol.cc:1503
mp_PartClean
static void mp_PartClean(matrix a, int lr, int lc, const ring R)
Definition: matpol.cc:704
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Variable::next
Variable next() const
Definition: factory.h:137
StringEndS
char * StringEndS()
Definition: reporter.cc:151
loop
#define loop
Definition: structs.h:78
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
mp_permmatrix::mpGetElem
poly mpGetElem(int, int)
Definition: matpol.cc:1136
b
CanonicalForm b
Definition: cfModGcd.cc:4044
ap
Definition: ap.h:39
mpFinalClean
static void mpFinalClean(matrix a)
Definition: matpol.cc:1495
mp_permmatrix::mpColReorder
void mpColReorder()
Definition: matpol.cc:998
p_SetmComp
#define p_SetmComp
Definition: p_polys.h:244
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:488
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:192
mp_permmatrix::mpElimBareiss
void mpElimBareiss(poly)
Definition: matpol.cc:1144
mp_MinorToResult
void mp_MinorToResult(ideal result, int &elems, matrix a, int r, int c, ideal R, const ring)
entries of a are minors and go to result (only if not in R)
Definition: matpol.cc:1407
row_col_weight
Definition: matpol.cc:788
mpSwapCol
static void mpSwapCol(matrix a, int pos, int lr, int lc)
Definition: matpol.cc:1319
for
for(int i=0;i<=n;i++) degsf[i]
Definition: cfEzgcd.cc:65
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:812
mp_permmatrix::mpGetRdim
int mpGetRdim()
Definition: matpol.cc:848
p_DecomposeComp
static void p_DecomposeComp(poly p, poly *a, int l, const ring r)
Definition: matpol.cc:1701
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
ip_smatrix::nrows
int nrows
Definition: matpol.h:22
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: simpleideals.cc:114
rHasLocalOrMixedOrdering
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
p_Sub
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1937
res
CanonicalForm res
Definition: facAbsFact.cc:64
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
lc
CanonicalForm lc(const CanonicalForm &f)
Definition: canonicalform.h:297
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
p_Cmp
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1662
omfreeSize
#define omfreeSize(addr, size)
Definition: omAllocDecl.h:236
sm_MultDiv
poly sm_MultDiv(poly a, poly b, const poly c, const ring R)
Definition: sparsmat.cc:1814
h
static Poly * h
Definition: janet.cc:972
mp_PreparePiv
static int mp_PreparePiv(matrix a, int lr, int lc, const ring r)
Definition: matpol.cc:1339
ip_smatrix::m
poly * m
Definition: matpol.h:20
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:711
p_String0
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:134
pp_Mult_qq
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1093
p_Write
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
pIter
#define pIter(p)
Definition: monomials.h:44
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:210
mp_permmatrix
Definition: matpol.cc:825
p_Compare
int p_Compare(const poly a, const poly b, const ring R)
Definition: p_polys.cc:4790
sm_SpecialPolyDiv
void sm_SpecialPolyDiv(poly a, poly b, const ring R)
Definition: sparsmat.cc:1895
pp
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:253
p_IsUnit
static BOOLEAN p_IsUnit(const poly p, const ring r)
Definition: p_polys.h:1950
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:36
p_Shift
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4590
mpSwapRow
static void mpSwapRow(matrix a, int pos, int lr, int lc)
Definition: matpol.cc:1261
mp_permmatrix::mpRowReorder
void mpRowReorder()
Definition: matpol.cc:1019
mp_permmatrix::mpGetCdim
int mpGetCdim()
Definition: matpol.cc:849
div
CF_NO_INLINE CanonicalForm div(const CanonicalForm &, const CanonicalForm &)
CF_INLINE CanonicalForm div, mod ( const CanonicalForm & lhs, const CanonicalForm & rhs )
Definition: cf_inline.cc:553
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:857
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:892
p_One
poly p_One(const ring r)
Definition: p_polys.cc:1305
p_EqualPolys
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4396
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:128
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
Print
#define Print
Definition: emacs.cc:80
B
b *CanonicalForm B
Definition: facBivar.cc:52
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:189
idInitChoise
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:833
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
p_Vec2Polys
void p_Vec2Polys(poly v, poly **p, int *len, const ring r)
Definition: p_polys.cc:3527
m
int m
Definition: cfEzgcd.cc:121
MATCOLS
#define MATCOLS(i)
Definition: matpol.h:29
assume
#define assume(x)
Definition: mod2.h:390
ip_smatrix::rank
long rank
Definition: matpol.h:21
NULL
#define NULL
Definition: omList.c:10
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:247
l
int l
Definition: cfEzgcd.cc:93
binom
int binom(int n, int r)
Definition: simpleideals.cc:913
R
#define R
Definition: sirandom.c:26
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
mp_DetBareiss
poly mp_DetBareiss(matrix a, const ring r)
returns the determinant of the matrix m; uses Bareiss algorithm
Definition: matpol.cc:1576
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
ip_smatrix::ncols
int ncols
Definition: matpol.h:23
p
int p
Definition: cfModGcd.cc:4019
p_IsConstant
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1923
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:26
mp_AddSubMat
static void mp_AddSubMat(ideal res, ideal sm, int col, const ring r)
Definition: matpol.cc:1739
mp_permmatrix::mpSaveArray
void mpSaveArray()
Definition: matpol.cc:852
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1289
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1050
mp_PolyWeight
static float mp_PolyWeight(poly p, const ring r)
Definition: matpol.cc:1202
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:51
prCopyR_NoSort
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:77
n_Size
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:571
mp_Copy
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:63
id_Test
#define id_Test(A, lR)
Definition: simpleideals.h:80
MATROWS
#define MATROWS(i)
Definition: matpol.h:28
omFreeBin
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
p_Insert
static poly p_Insert(poly p1, poly p2, const ring R)
Definition: matpol.cc:612
A
#define A
Definition: sirandom.c:23
pNext
#define pNext(p)
Definition: monomials.h:43
pReverse
static poly pReverse(poly p)
Definition: p_polys.h:335
mp_PivRow
static int mp_PivRow(matrix a, int lr, int lc, const ring r)
Definition: matpol.cc:1294
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
mp_permmatrix::mpGetSign
int mpGetSign()
Definition: matpol.cc:850