Data Structures | Macros | Typedefs | Functions | Variables
matpol.h File Reference
#include <polys/monomials/ring.h>

Go to the source code of this file.

Data Structures

class  ip_smatrix
 

Macros

#define MATROWS(i)   ((i)->nrows)
 
#define MATCOLS(i)   ((i)->ncols)
 
#define MATELEM(mat, i, j)   ((mat)->m)[MATCOLS((mat)) * ((i)-1) + (j)-1]
 

Typedefs

typedef ip_smatrixmatrix
 

Functions

matrix mpNew (int r, int c)
 create a r x c zero-matrix More...
 
static matrix mp_New (int r, int c)
 
void mp_Delete (matrix *a, const ring r)
 
matrix mp_Copy (const matrix a, const ring rSrc, const ring rDst)
 copies matrix a from rSrc into rDst More...
 
matrix mp_Copy (matrix a, const ring r)
 copies matrix a (from ring r to r) 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)
 
BOOLEAN mp_Equal (matrix a, matrix b, const ring r)
 
poly mp_Trace (matrix a, const ring r)
 
poly TraceOfProd (matrix a, matrix b, int n, const ring r)
 
matrix mp_Wedge (matrix a, int ar, const ring r)
 
poly mp_DetBareiss (matrix a, const ring r)
 returns the determinant of the matrix m; uses Bareiss algorithm More...
 
void mp_Monomials (matrix c, int r, int var, matrix m, 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...
 
matrix mp_CoeffProc (poly f, poly vars, const ring r)
 
void mp_Coef2 (poly v, poly vars, 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...
 
void mp_RecMin (int, ideal, int &, matrix, int, int, poly, ideal, const ring)
 for minors with Bareiss More...
 
void mp_MinorToResult (ideal, int &, matrix, int, int, ideal, const ring)
 entries of a are minors and go to result (only if not in R) More...
 
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=',')
 
int mp_Compare (matrix a, matrix b, const ring r)
 

Variables

omBin ip_smatrix_bin
 

Macro Definition Documentation

§ MATCOLS

#define MATCOLS (   i)    ((i)->ncols)

Definition at line 28 of file matpol.h.

§ MATELEM

#define MATELEM (   mat,
  i,
  j 
)    ((mat)->m)[MATCOLS((mat)) * ((i)-1) + (j)-1]

Definition at line 29 of file matpol.h.

§ MATROWS

#define MATROWS (   i)    ((i)->nrows)

Definition at line 27 of file matpol.h.

Typedef Documentation

§ matrix

typedef ip_smatrix* matrix

Definition at line 32 of file matpol.h.

Function Documentation

§ iiStringMatrix()

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

Definition at line 767 of file matpol.cc.

768 {
769  int i,ii = MATROWS(im);
770  int j,jj = MATCOLS(im);
771  poly *pp = im->m;
772  char ch_s[2];
773  ch_s[0]=ch;
774  ch_s[1]='\0';
775 
776  StringSetS("");
777 
778  for (i=0; i<ii; i++)
779  {
780  for (j=0; j<jj; j++)
781  {
782  p_String0(*pp++, r);
783  StringAppendS(ch_s);
784  if (dim > 1) StringAppendS("\n");
785  }
786  }
787  char *s=StringEndS();
788  s[strlen(s)- (dim > 1 ? 2 : 1)]='\0';
789  return s;
790 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * StringEndS()
Definition: reporter.cc:151
poly pp
Definition: myNF.cc:296
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
int dim(ideal I, ring r)
int i
Definition: cfEzgcd.cc:123
#define MATCOLS(i)
Definition: matpol.h:28
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
Definition: polys0.cc:136
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10

§ iiWriteMatrix()

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

set spaces to zero by default

Definition at line 746 of file matpol.cc.

747 {
748  int i,ii = MATROWS(im)-1;
749  int j,jj = MATCOLS(im)-1;
750  poly *pp = im->m;
751 
752  for (i=0; i<=ii; i++)
753  {
754  for (j=0; j<=jj; j++)
755  {
756  if (spaces>0)
757  Print("%-*.*s",spaces,spaces," ");
758  if (dim == 2) Print("%s[%u,%u]=",n,i+1,j+1);
759  else if (dim == 1) Print("%s[%u]=",n,j+1);
760  else if (dim == 0) Print("%s=",n);
761  if ((i<ii)||(j<jj)) p_Write(*pp++, r);
762  else p_Write0(*pp, r);
763  }
764  }
765 }
#define Print
Definition: emacs.cc:83
poly pp
Definition: myNF.cc:296
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int dim(ideal I, ring r)
int i
Definition: cfEzgcd.cc:123
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:196
#define MATCOLS(i)
Definition: matpol.h:28
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10

§ mp_Add()

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

Definition at line 189 of file matpol.cc.

190 {
191  int k, n = a->nrows, m = a->ncols;
192  if ((n != b->nrows) || (m != b->ncols))
193  {
194 /*
195 * Werror("cannot add %dx%d matrix and %dx%d matrix",
196 * m,n,b->cols(),b->rows());
197 */
198  return NULL;
199  }
200  matrix c = mpNew(n,m);
201  for (k=m*n-1; k>=0; k--)
202  c->m[k] = p_Add_q(p_Copy(a->m[k], R), p_Copy(b->m[k], R), R);
203  return c;
204 }
int ncols
Definition: matpol.h:22
int k
Definition: cfEzgcd.cc:93
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
int nrows
Definition: matpol.h:21
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define NULL
Definition: omList.c:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877

§ mp_Coef2()

void mp_Coef2 ( poly  v,
poly  vars,
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 515 of file matpol.cc.

516 {
517  poly* s;
518  poly p;
519  int sl,i,j;
520  int l=0;
521  poly sel=mp_Select(v,mon, R);
522 
523  p_Vec2Polys(sel,&s,&sl, R);
524  for (i=0; i<sl; i++)
525  l=si_max(l,pLength(s[i]));
526  *c=mpNew(sl,l);
527  *m=mpNew(sl,l);
528  poly h;
529  int isConst;
530  for (j=1; j<=sl;j++)
531  {
532  p=s[j-1];
533  if (p_IsConstant(p, R)) /*p != NULL */
534  {
535  isConst=-1;
536  i=l;
537  }
538  else
539  {
540  isConst=1;
541  i=1;
542  }
543  while(p!=NULL)
544  {
545  h = p_Head(p, R);
546  MATELEM(*m,j,i) = h;
547  i+=isConst;
548  p = p->next;
549  }
550  }
551  while (v!=NULL)
552  {
553  i = 1;
554  j = p_GetComp(v, R);
555  loop
556  {
557  poly mp=MATELEM(*m,j,i);
558  if (mp!=NULL)
559  {
560  h = mp_Exdiv(v, mp /*MATELEM(*m,j,i)*/, mp, R);
561  if (h!=NULL)
562  {
563  p_SetComp(h,0, R);
564  MATELEM(*c,j,i) = p_Add_q(MATELEM(*c,j,i), h, R);
565  break;
566  }
567  }
568  if (i < l)
569  i++;
570  else
571  break;
572  }
573  v = v->next;
574  }
575 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static poly mp_Select(poly fro, poly what, const ring)
Definition: matpol.cc:682
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly mp_Exdiv(poly m, poly d, poly vars, const ring)
Definition: matpol.cc:495
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
int j
Definition: myNF.cc:70
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
void p_Vec2Polys(poly v, poly **p, int *len, const ring r)
Definition: p_polys.cc:3474
const ring R
Definition: DebugPrint.cc:36
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189
Variable next() const
Definition: factory.h:135
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_CoeffProc()

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

Definition at line 413 of file matpol.cc.

414 {
415  assume(vars!=NULL);
416  poly sel, h;
417  int l, i;
418  int pos_of_1 = -1;
419  matrix co;
420 
421  if (f==NULL)
422  {
423  co = mpNew(2, 1);
424  MATELEM(co,1,1) = p_One(R);
425  MATELEM(co,2,1) = NULL;
426  return co;
427  }
428  sel = mp_Select(f, vars, R);
429  l = pLength(sel);
430  co = mpNew(2, l);
431 
433  {
434  for (i=l; i>=1; 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  else
445  {
446  for (i=1; i<=l; i++)
447  {
448  h = sel;
449  pIter(sel);
450  pNext(h)=NULL;
451  MATELEM(co,1,i) = h;
452  MATELEM(co,2,i) = NULL;
453  if (p_IsConstant(h, R)) pos_of_1 = i;
454  }
455  }
456  while (f!=NULL)
457  {
458  i = 1;
459  loop
460  {
461  if (i!=pos_of_1)
462  {
463  h = mp_Exdiv(f, MATELEM(co,1,i),vars, R);
464  if (h!=NULL)
465  {
466  MATELEM(co,2,i) = p_Add_q(MATELEM(co,2,i), h, R);
467  break;
468  }
469  }
470  if (i == l)
471  {
472  // check monom 1 last:
473  if (pos_of_1 != -1)
474  {
475  h = mp_Exdiv(f, MATELEM(co,1,pos_of_1),vars, R);
476  if (h!=NULL)
477  {
478  MATELEM(co,2,pos_of_1) = p_Add_q(MATELEM(co,2,pos_of_1), h, R);
479  }
480  }
481  break;
482  }
483  i ++;
484  }
485  pIter(f);
486  }
487  return co;
488 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
static poly mp_Select(poly fro, poly what, const ring)
Definition: matpol.cc:682
loop
Definition: myNF.cc:98
f
Definition: cfModGcd.cc:4022
static poly mp_Exdiv(poly m, poly d, poly vars, const ring)
Definition: matpol.cc:495
#define pIter(p)
Definition: monomials.h:44
poly p_One(const ring r)
Definition: p_polys.cc:1312
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1876
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ 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 326 of file matpol.cc.

327 {
328  poly h,f;
329  int l, i, c, m=0;
330  matrix co;
331  /* look for maximal power m of x_var in I */
332  for (i=IDELEMS(I)-1; i>=0; i--)
333  {
334  f=I->m[i];
335  while (f!=NULL)
336  {
337  l=p_GetExp(f,var, R);
338  if (l>m) m=l;
339  pIter(f);
340  }
341  }
342  co=mpNew((m+1)*I->rank,IDELEMS(I));
343  /* divide each monomial by a power of x_var,
344  * remember the power in l and the component in c*/
345  for (i=IDELEMS(I)-1; i>=0; i--)
346  {
347  f=I->m[i];
348  I->m[i]=NULL;
349  while (f!=NULL)
350  {
351  l=p_GetExp(f,var, R);
352  p_SetExp(f,var,0, R);
353  c=si_max((int)p_GetComp(f, R),1);
354  p_SetComp(f,0, R);
355  p_Setm(f, R);
356  /* now add the resulting monomial to co*/
357  h=pNext(f);
358  pNext(f)=NULL;
359  //MATELEM(co,c*(m+1)-l,i+1)
360  // =p_Add_q(MATELEM(co,c*(m+1)-l,i+1),f, R);
361  MATELEM(co,(c-1)*(m+1)+l+1,i+1)
362  =p_Add_q(MATELEM(co,(c-1)*(m+1)+l+1,i+1),f, R);
363  /* iterate f*/
364  f=h;
365  }
366  }
367  id_Delete(&I, R);
368  return co;
369 }
f
Definition: cfModGcd.cc:4022
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define pIter(p)
Definition: monomials.h:44
poly * m
Definition: matpol.h:19
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_Compare()

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

Definition at line 577 of file matpol.cc.

578 {
579  if (MATCOLS(a)<MATCOLS(b)) return -1;
580  else if (MATCOLS(a)>MATCOLS(b)) return 1;
581  if (MATROWS(a)<MATROWS(b)) return -1;
582  else if (MATROWS(a)<MATROWS(b)) return 1;
583 
584  unsigned ii=MATCOLS(a)*MATROWS(a)-1;
585  unsigned j=0;
586  int r=0;
587  while (j<=ii)
588  {
589  r=p_Compare(a->m[j],b->m[j],R);
590  if (r!=0) return r;
591  j++;
592  }
593  return r;
594 }
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
const ring R
Definition: DebugPrint.cc:36
int p_Compare(const poly a, const poly b, const ring R)
Definition: p_polys.cc:4713
#define MATCOLS(i)
Definition: matpol.h:28
#define MATROWS(i)
Definition: matpol.h:27

§ 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 95 of file matpol.cc.

96 {
97  id_Test((ideal)a, rSrc);
98 
99  poly t;
100  int i, m=MATROWS(a), n=MATCOLS(a);
101 
102  matrix b = mpNew(m, n);
103 
104  for (i=m*n-1; i>=0; i--)
105  {
106  t = a->m[i];
107  if (t!=NULL)
108  {
109  b->m[i] = prCopyR_NoSort(t, rSrc, rDst);
110  p_Normalize(b->m[i], rDst);
111  }
112  }
113  b->rank=a->rank;
114 
115  id_Test((ideal)b, rDst);
116 
117  return b;
118 }
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:78
#define id_Test(A, lR)
Definition: simpleideals.h:80
poly * m
Definition: matpol.h:19
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3633
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213
long rank
Definition: matpol.h:20

§ mp_Copy() [2/2]

matrix mp_Copy ( matrix  a,
const ring  r 
)

copies matrix a (from ring r to r)

Definition at line 74 of file matpol.cc.

75 {
76  id_Test((ideal)a, r);
77  poly t;
78  int i, m=MATROWS(a), n=MATCOLS(a);
79  matrix b = mpNew(m, n);
80 
81  for (i=m*n-1; i>=0; i--)
82  {
83  t = a->m[i];
84  if (t!=NULL)
85  {
86  p_Normalize(t, r);
87  b->m[i] = p_Copy(t, r);
88  }
89  }
90  b->rank=a->rank;
91  return b;
92 }
#define id_Test(A, lR)
Definition: simpleideals.h:80
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3633
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213
long rank
Definition: matpol.h:20

§ mp_Delete()

void mp_Delete ( matrix a,
const ring  r 
)

Definition at line 792 of file matpol.cc.

793 {
794  id_Delete((ideal *) a, r);
795 }
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
const ring r
Definition: syzextra.cc:208

§ mp_DetBareiss()

poly mp_DetBareiss ( matrix  a,
const ring  r 
)

returns the determinant of the matrix m; uses Bareiss algorithm

Definition at line 1588 of file matpol.cc.

1589 {
1590  int s;
1591  poly div, res;
1592  if (MATROWS(a) != MATCOLS(a))
1593  {
1594  Werror("det of %d x %d matrix",MATROWS(a),MATCOLS(a));
1595  return NULL;
1596  }
1597  matrix c = mp_Copy(a,r);
1598  mp_permmatrix *Bareiss = new mp_permmatrix(c,r);
1599  row_col_weight w(Bareiss->mpGetRdim(), Bareiss->mpGetCdim());
1600 
1601  /* Bareiss */
1602  div = NULL;
1603  while(Bareiss->mpPivotBareiss(&w))
1604  {
1605  Bareiss->mpElimBareiss(div);
1606  div = Bareiss->mpGetElem(Bareiss->mpGetRdim(), Bareiss->mpGetCdim());
1607  }
1608  Bareiss->mpRowReorder();
1609  Bareiss->mpColReorder();
1610  Bareiss->mpSaveArray();
1611  s = Bareiss->mpGetSign();
1612  delete Bareiss;
1613 
1614  /* result */
1615  res = MATELEM(c,1,1);
1616  MATELEM(c,1,1) = NULL;
1617  id_Delete((ideal *)&c,r);
1618  if (s < 0)
1619  res = p_Neg(res,r);
1620  return res;
1621 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
void mpElimBareiss(poly)
Definition: matpol.cc:1156
int mpGetSign()
Definition: matpol.cc:862
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void mpSaveArray()
Definition: matpol.cc:864
int mpPivotBareiss(row_col_weight *)
Definition: matpol.cc:1071
void mpRowReorder()
Definition: matpol.cc:1031
poly res
Definition: myNF.cc:322
void mpColReorder()
Definition: matpol.cc:1010
const ring r
Definition: syzextra.cc:208
int mpGetCdim()
Definition: matpol.cc:861
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
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
int mpGetRdim()
Definition: matpol.cc:860
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
poly mpGetElem(int, int)
Definition: matpol.cc:1148
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_Equal()

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

Definition at line 596 of file matpol.cc.

597 {
598  if ((MATCOLS(a)!=MATCOLS(b)) || (MATROWS(a)!=MATROWS(b)))
599  return FALSE;
600  int i=MATCOLS(a)*MATROWS(a)-1;
601  while (i>=0)
602  {
603  if (a->m[i]==NULL)
604  {
605  if (b->m[i]!=NULL) return FALSE;
606  }
607  else if (b->m[i]==NULL) return FALSE;
608  else if (p_Cmp(a->m[i],b->m[i], R)!=0) return FALSE;
609  i--;
610  }
611  i=MATCOLS(a)*MATROWS(a)-1;
612  while (i>=0)
613  {
614  if(!p_EqualPolys(a->m[i],b->m[i], R)) return FALSE;
615  i--;
616  }
617  return TRUE;
618 }
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1615
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
poly * m
Definition: matpol.h:19
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4320
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27

§ mp_InitI()

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

make it a v * unit matrix

Definition at line 139 of file matpol.cc.

140 {
141  return mp_InitP(r, c, p_ISet(v, R), R);
142 }
matrix mp_InitP(int r, int c, poly p, const ring R)
make it a p * unit matrix
Definition: matpol.cc:123
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1296

§ mp_InitP()

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

make it a p * unit matrix

Definition at line 123 of file matpol.cc.

124 {
125  matrix rc = mpNew(r,c);
126  int i=si_min(r,c), n = c*(i-1)+i-1, inc = c+1;
127 
128  p_Normalize(p, R);
129  while (n>0)
130  {
131  rc->m[n] = p_Copy(p, R);
132  n -= inc;
133  }
134  rc->m[0]=p;
135  return rc;
136 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
return P p
Definition: myNF.cc:203
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3633

§ mp_IsDiagUnit()

BOOLEAN mp_IsDiagUnit ( matrix  U,
const ring  r 
)

Definition at line 728 of file matpol.cc.

729 {
730  if(MATROWS(U)!=MATCOLS(U))
731  return FALSE;
732  for(int i=MATCOLS(U);i>=1;i--)
733  {
734  for(int j=MATCOLS(U); j>=1; j--)
735  {
736  if (i==j)
737  {
738  if (!p_IsUnit(MATELEM(U,i,i), R)) return FALSE;
739  }
740  else if (MATELEM(U,i,j)!=NULL) return FALSE;
741  }
742  }
743  return TRUE;
744 }
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_IsUnit(const poly p, const ring r)
Definition: p_polys.h:1903
#define TRUE
Definition: auxiliary.h:98
int j
Definition: myNF.cc:70
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_MinorToResult()

void mp_MinorToResult ( ideal  ,
int &  ,
matrix  ,
int  ,
int  ,
ideal  ,
const ring   
)

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

Definition at line 1419 of file matpol.cc.

1421 {
1422  poly *q1;
1423  int e=IDELEMS(result);
1424  int i,j;
1425 
1426  if (R != NULL)
1427  {
1428  for (i=r-1;i>=0;i--)
1429  {
1430  q1 = &(a->m)[i*a->ncols];
1431  //for (j=c-1;j>=0;j--)
1432  //{
1433  // if (q1[j]!=NULL) q1[j] = kNF(R,currRing->qideal,q1[j]);
1434  //}
1435  }
1436  }
1437  for (i=r-1;i>=0;i--)
1438  {
1439  q1 = &(a->m)[i*a->ncols];
1440  for (j=c-1;j>=0;j--)
1441  {
1442  if (q1[j]!=NULL)
1443  {
1444  if (elems>=e)
1445  {
1446  pEnlargeSet(&(result->m),e,e);
1447  e += e;
1448  IDELEMS(result) =e;
1449  }
1450  result->m[elems] = q1[j];
1451  q1[j] = NULL;
1452  elems++;
1453  }
1454  }
1455  }
1456 }
const poly a
Definition: syzextra.cc:212
const ring r
Definition: syzextra.cc:208
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
Definition: cfEzgcd.cc:66
int j
Definition: myNF.cc:70
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3555
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

§ mp_Monomials()

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

Definition at line 376 of file matpol.cc.

377 {
378  /* clear contents of m*/
379  int k,l;
380  for (k=MATROWS(m);k>0;k--)
381  {
382  for(l=MATCOLS(m);l>0;l--)
383  {
384  p_Delete(&MATELEM(m,k,l), R);
385  }
386  }
387  omfreeSize((ADDRESS)m->m,MATROWS(m)*MATCOLS(m)*sizeof(poly));
388  /* allocate monoms in the right size r x MATROWS(c)*/
389  m->m=(poly*)omAlloc0(r*MATROWS(c)*sizeof(poly));
390  MATROWS(m)=r;
391  MATCOLS(m)=MATROWS(c);
392  m->rank=r;
393  /* the maximal power p of x_var: MATCOLS(m)=r*(p+1) */
394  int p=MATCOLS(m)/r-1;
395  /* fill in the powers of x_var=h*/
396  poly h=p_One(R);
397  for(k=r;k>0; k--)
398  {
399  MATELEM(m,k,k*(p+1))=p_One(R);
400  }
401  for(l=p;l>=0; l--)
402  {
403  p_SetExp(h,var,p-l, R);
404  p_Setm(h, R);
405  for(k=r;k>0; k--)
406  {
407  MATELEM(m,k,k*(p+1)-l)=p_Copy(h, R);
408  }
409  }
410  p_Delete(&h, R);
411 }
return P p
Definition: myNF.cc:203
#define omfreeSize(addr, size)
Definition: omAllocDecl.h:236
void * ADDRESS
Definition: auxiliary.h:115
int k
Definition: cfEzgcd.cc:93
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1312
const ring R
Definition: DebugPrint.cc:36
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define MATCOLS(i)
Definition: matpol.h:28
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
long rank
Definition: matpol.h:20
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_Mult()

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

Definition at line 223 of file matpol.cc.

224 {
225  int i, j, k;
226  int m = MATROWS(a);
227  int p = MATCOLS(a);
228  int q = MATCOLS(b);
229 
230  if (p!=MATROWS(b))
231  {
232 /*
233 * Werror("cannot multiply %dx%d matrix and %dx%d matrix",
234 * m,p,b->rows(),q);
235 */
236  return NULL;
237  }
238  matrix c = mpNew(m,q);
239 
240  for (i=1; i<=m; i++)
241  {
242  for (k=1; k<=p; k++)
243  {
244  poly aik;
245  if ((aik=MATELEM(a,i,k))!=NULL)
246  {
247  for (j=1; j<=q; j++)
248  {
249  poly bkj;
250  if ((bkj=MATELEM(b,k,j))!=NULL)
251  {
252  poly *cij=&(MATELEM(c,i,j));
253  poly s = pp_Mult_qq(aik /*MATELEM(a,i,k)*/, bkj/*MATELEM(b,k,j)*/, R);
254  if (/*MATELEM(c,i,j)*/ (*cij)==NULL) (*cij)=s;
255  else (*cij) = p_Add_q((*cij) /*MATELEM(c,i,j)*/ ,s, R);
256  }
257  }
258  }
259  // pNormalize(t);
260  // MATELEM(c,i,j) = t;
261  }
262  }
263  for(i=m*q-1;i>=0;i--) p_Normalize(c->m[i], R);
264  return c;
265 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
poly * m
Definition: matpol.h:19
int j
Definition: myNF.cc:70
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1070
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3633
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_MultI()

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

c = f*a

Definition at line 145 of file matpol.cc.

146 {
147  int k, n = a->nrows, m = a->ncols;
148  poly p = p_ISet(f, R);
149  matrix c = mpNew(n,m);
150 
151  for (k=m*n-1; k>0; k--)
152  c->m[k] = pp_Mult_qq(a->m[k], p, R);
153  c->m[0] = p_Mult_q(p_Copy(a->m[0], R), p, R);
154  return c;
155 }
int ncols
Definition: matpol.h:22
return P p
Definition: myNF.cc:203
f
Definition: cfModGcd.cc:4022
int k
Definition: cfEzgcd.cc:93
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
int nrows
Definition: matpol.h:21
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1070
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1296
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

§ 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 158 of file matpol.cc.

159 {
160  int k, n = a->nrows, m = a->ncols;
161 
162  p_Normalize(p, R);
163  for (k=m*n-1; k>0; k--)
164  {
165  if (a->m[k]!=NULL)
166  a->m[k] = p_Mult_q(a->m[k], p_Copy(p, R), R);
167  }
168  a->m[0] = p_Mult_q(a->m[0], p, R);
169  return a;
170 }
const poly a
Definition: syzextra.cc:212
int ncols
Definition: matpol.h:22
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
int nrows
Definition: matpol.h:21
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3633
#define NULL
Definition: omList.c:10
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

§ mp_New()

static matrix mp_New ( int  r,
int  c 
)
inlinestatic

Definition at line 35 of file matpol.h.

35 { return mpNew(r,c); }
const ring r
Definition: syzextra.cc:208
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47

§ mp_RecMin()

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

for minors with Bareiss

for minors with Bareiss

Definition at line 1515 of file matpol.cc.

1517 {
1518  int k;
1519  int kr=lr-1,kc=lc-1;
1520  matrix nextLevel=mpNew(kr,kc);
1521 
1522  loop
1523  {
1524 /*--- look for an optimal row and bring it to last position ------------*/
1525  if(mp_PrepareRow(a,lr,lc,r)==0) break;
1526 /*--- now take all pivots from the last row ------------*/
1527  k = lc;
1528  loop
1529  {
1530  if(mp_PreparePiv(a,lr,k,r)==0) break;
1531  mp_ElimBar(a,nextLevel,barDiv,lr,k,r);
1532  k--;
1533  if (ar>1)
1534  {
1535  mp_RecMin(ar-1,result,elems,nextLevel,kr,k,a->m[kr*a->ncols+k],R,r);
1536  mp_PartClean(nextLevel,kr,k, r);
1537  }
1538  else mp_MinorToResult(result,elems,nextLevel,kr,k,R,r);
1539  if (ar>k-1) break;
1540  }
1541  if (ar>=kr) break;
1542 /*--- now we have to take out the last row...------------*/
1543  lr = kr;
1544  kr--;
1545  }
1546  mpFinalClean(nextLevel);
1547 }
int ncols
Definition: matpol.h:22
loop
Definition: myNF.cc:98
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:1515
static void mp_ElimBar(matrix a0, matrix re, poly div, int lr, int lc, const ring R)
Definition: matpol.cc:1361
static void mpFinalClean(matrix a)
Definition: matpol.cc:1507
static int mp_PrepareRow(matrix a, int lr, int lc, const ring R)
Definition: matpol.cc:1293
int k
Definition: cfEzgcd.cc:93
static void mp_PartClean(matrix a, int lr, int lc, const ring R)
Definition: matpol.cc:716
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:1419
CanonicalForm lc(const CanonicalForm &f)
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
static int mp_PreparePiv(matrix a, int lr, int lc, const ring r)
Definition: matpol.cc:1351
const ring R
Definition: DebugPrint.cc:36
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
return result
Definition: facAbsBiFact.cc:76

§ mp_Sub()

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

Definition at line 206 of file matpol.cc.

207 {
208  int k, n = a->nrows, m = a->ncols;
209  if ((n != b->nrows) || (m != b->ncols))
210  {
211 /*
212 * Werror("cannot sub %dx%d matrix and %dx%d matrix",
213 * m,n,b->cols(),b->rows());
214 */
215  return NULL;
216  }
217  matrix c = mpNew(n,m);
218  for (k=m*n-1; k>=0; k--)
219  c->m[k] = p_Sub(p_Copy(a->m[k], R), p_Copy(b->m[k], R), R);
220  return c;
221 }
int ncols
Definition: matpol.h:22
int k
Definition: cfEzgcd.cc:93
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1911
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
int nrows
Definition: matpol.h:21
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define NULL
Definition: omList.c:10

§ mp_Trace()

poly mp_Trace ( matrix  a,
const ring  r 
)

Definition at line 288 of file matpol.cc.

289 {
290  int i;
291  int n = (MATCOLS(a)<MATROWS(a)) ? MATCOLS(a) : MATROWS(a);
292  poly t = NULL;
293 
294  for (i=1; i<=n; i++)
295  t = p_Add_q(t, p_Copy(MATELEM(a,i,i), R), R);
296  return t;
297 }
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mp_Transp()

matrix mp_Transp ( matrix  a,
const ring  r 
)

Definition at line 267 of file matpol.cc.

268 {
269  int i, j, r = MATROWS(a), c = MATCOLS(a);
270  poly *p;
271  matrix b = mpNew(c,r);
272 
273  p = b->m;
274  for (i=0; i<c; i++)
275  {
276  for (j=0; j<r; j++)
277  {
278  if (a->m[j*c+i]!=NULL) *p = p_Copy(a->m[j*c+i], R);
279  p++;
280  }
281  }
282  return b;
283 }
return P p
Definition: myNF.cc:203
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
#define MATROWS(i)
Definition: matpol.h:27
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213

§ mp_Wedge()

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

Definition at line 1663 of file matpol.cc.

1664 {
1665  int i,j,k,l;
1666  int *rowchoise,*colchoise;
1667  BOOLEAN rowch,colch;
1668  matrix result;
1669  matrix tmp;
1670  poly p;
1671 
1672  i = binom(a->nrows,ar);
1673  j = binom(a->ncols,ar);
1674 
1675  rowchoise=(int *)omAlloc(ar*sizeof(int));
1676  colchoise=(int *)omAlloc(ar*sizeof(int));
1677  result = mpNew(i,j);
1678  tmp = mpNew(ar,ar);
1679  l = 1; /* k,l:the index in result*/
1680  idInitChoise(ar,1,a->nrows,&rowch,rowchoise);
1681  while (!rowch)
1682  {
1683  k=1;
1684  idInitChoise(ar,1,a->ncols,&colch,colchoise);
1685  while (!colch)
1686  {
1687  for (i=1; i<=ar; i++)
1688  {
1689  for (j=1; j<=ar; j++)
1690  {
1691  MATELEM(tmp,i,j) = MATELEM(a,rowchoise[i-1],colchoise[j-1]);
1692  }
1693  }
1694  p = mp_DetBareiss(tmp, R);
1695  if ((k+l) & 1) p=p_Neg(p, R);
1696  MATELEM(result,l,k) = p;
1697  k++;
1698  idGetNextChoise(ar,a->ncols,&colch,colchoise);
1699  }
1700  idGetNextChoise(ar,a->nrows,&rowch,rowchoise);
1701  l++;
1702  }
1703 
1704  /*delete the matrix tmp*/
1705  for (i=1; i<=ar; i++)
1706  {
1707  for (j=1; j<=ar; j++) MATELEM(tmp,i,j) = NULL;
1708  }
1709  id_Delete((ideal *) &tmp, R);
1710  return (result);
1711 }
int ncols
Definition: matpol.h:22
return P p
Definition: myNF.cc:203
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
int nrows
Definition: matpol.h:21
int j
Definition: myNF.cc:70
const ring R
Definition: DebugPrint.cc:36
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define NULL
Definition: omList.c:10
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
poly mp_DetBareiss(matrix a, const ring r)
returns the determinant of the matrix m; uses Bareiss algorithm
Definition: matpol.cc:1588
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
int binom(int n, int r)
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mpNew()

matrix mpNew ( int  r,
int  c 
)

create a r x c zero-matrix

Definition at line 47 of file matpol.cc.

48 {
49  int rr=r;
50  if (rr<=0) rr=1;
51  //if ( (((int)(MAX_INT_VAL/sizeof(poly))) / rr) <= c)
52  //{
53  // Werror("internal error: creating matrix[%d][%d]",r,c);
54  // return NULL;
55  //}
57  rc->nrows = r;
58  rc->ncols = c;
59  rc->rank = r;
60  if ((c != 0)&&(r!=0))
61  {
62  size_t s=r*c*sizeof(poly);
63  rc->m = (poly*)omAlloc0(s);
64  //if (rc->m==NULL)
65  //{
66  // Werror("internal error: creating matrix[%d][%d]",r,c);
67  // return NULL;
68  //}
69  }
70  return rc;
71 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
int ncols
Definition: matpol.h:22
omBin sip_sideal_bin
Definition: simpleideals.cc:30
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int nrows
Definition: matpol.h:21
ip_smatrix * matrix
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
long rank
Definition: matpol.h:20

§ pMultMp()

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

Definition at line 175 of file matpol.cc.

176 {
177  int k, n = a->nrows, m = a->ncols;
178 
179  p_Normalize(p, R);
180  for (k=m*n-1; k>0; k--)
181  {
182  if (a->m[k]!=NULL)
183  a->m[k] = p_Mult_q(p_Copy(p, R), a->m[k], R);
184  }
185  a->m[0] = p_Mult_q(p, a->m[0], R);
186  return a;
187 }
const poly a
Definition: syzextra.cc:212
int ncols
Definition: matpol.h:22
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly * m
Definition: matpol.h:19
int nrows
Definition: matpol.h:21
const ring R
Definition: DebugPrint.cc:36
int m
Definition: cfEzgcd.cc:119
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3633
#define NULL
Definition: omList.c:10
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

§ TraceOfProd()

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

Definition at line 302 of file matpol.cc.

303 {
304  int i, j;
305  poly p, t = NULL;
306 
307  for (i=1; i<=n; i++)
308  {
309  for (j=1; j<=n; j++)
310  {
311  p = pp_Mult_qq(MATELEM(a,i,j), MATELEM(b,j,i), R);
312  t = p_Add_q(t, p, R);
313  }
314  }
315  return t;
316 }
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1070
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#define MATELEM(mat, i, j)
Definition: matpol.h:29

Variable Documentation

§ ip_smatrix_bin

omBin ip_smatrix_bin