54 Werror(
"internal error: creating matrix[%d][%d]",r,c);
63 int s=r*c*
sizeof(
poly);
82 for (i=m*n-1; i>=0; i--)
105 for (i=m*n-1; i>=0; i--)
127 int i=
si_min(r,c), n = c*(i-1)+i-1, inc = c+1;
152 for (k=
m*n-1; k>0; k--)
164 for (k=
m*n-1; k>0; k--)
181 for (k=
m*n-1; k>0; k--)
202 for (k=
m*n-1; k>=0; k--)
219 for (k=
m*n-1; k>=0; k--)
255 if ( (*cij)==
NULL) (*cij)=
s;
256 else (*cij) =
p_Add_q((*cij) ,s, R);
333 for (i=
IDELEMS(I)-1; i>=0; i--)
346 for (i=
IDELEMS(I)-1; i>=0; i--)
362 MATELEM(co,(c-1)*(m+1)+l+1,i+1)
500 for (i=1; i<=
rVar(R); i++)
623 if (p2==
NULL)
return p1;
629 c =
p_Cmp(a1, a2, R);
683 for (i=1; i<=
rVar(R); i++)
714 for (i=lr-1;i>=0;i--)
717 for (j=lc-1;j>=0;j--)
if(q1[j])
p_Delete(&q1[j], R);
745 for (i=0; i<=ii; i++)
747 for (j=0; j<=jj; j++)
750 Print(
"%-*.*s",spaces,spaces,
" ");
751 if (dim == 2)
Print(
"%s[%u,%u]=",n,i+1,j+1);
752 else if (dim == 1)
Print(
"%s[%u]=",n,j+1);
753 else if (dim == 0)
Print(
"%s=",n);
754 if ((i<ii)||(j<jj))
p_Write(*pp++, r);
781 s[strlen(s)- (dim > 1 ? 2 : 1)]=
'\0';
833 int a_m, a_n, s_m, s_n,
sign, piv_s;
839 {
return &(Xarray[a_n*qrow[
r]]); }
841 {
return &(Xarray[qcol[c]]); }
842 void mpRowWeight(
float *);
843 void mpColWeight(
float *);
844 void mpRowSwap(
int,
int);
845 void mpColSwap(
int,
int);
856 void mpSetSearch(
int s);
858 poly mpGetElem(
int,
int);
859 void mpSetElem(
poly,
int,
int);
860 void mpDelElem(
int,
int);
861 void mpElimBareiss(
poly);
864 void mpToIntvec(
intvec *);
888 for (i=
a_m-1; i>=0; i--)
892 for (j=
a_n-1; j>=0; j--)
913 for (k=
a_m*
a_n-1; k>=0; k--)
928 for (j=
s_n; j>=0; j--)
932 for(i=
s_m; i>=0; i--)
947 for (i=
s_m; i>=0; i--)
951 for(j=
s_n; j>=0; j--)
968 for (j=
a_n-1; j>= 0; j--)
983 for (i=0; i<
k; i+=
a_n)
999 for (k=
a_m-1; k>=0; k--)
qrow[k] = k;
1000 for (k=
a_n-1; k>=0; k--)
qcol[k] = k;
1011 for (j=
a_n-1; j>=
k; j--)
1018 while (
qcol[j2] != j) j2++;
1032 for (i=
a_m-1; i>=
k; i--)
1039 while (
qrow[i2] != i) i2++;
1067 int i,
j, iopt, jopt;
1068 float sum, f1, f2, fo,
r, ro, lp;
1069 float *dr = C->
wrow, *dc = C->
wcol;
1081 for(i=
s_m; i>=0; i--)
1105 for(i=
s_m; i>=0; i--)
1107 for(i=
s_m; i>=0; i--)
1111 for(j=
s_n; j>=0; j--)
1118 f1 = ro * (dc[
j]-lp);
1121 f2 = lp * (sum - ro - dc[
j]);
1151 poly piv, elim, q1, q2, *ap, *
a;
1156 for(i=
s_m-1; i>=0; i--)
1159 elim = a[qcol[
s_n]];
1163 for (j=
s_n-1; j>=0; j--)
1177 else if (a[jj] !=
NULL)
1181 if ((q2!=
NULL) && div)
1189 for (j=
s_n-1; j>=0; j--)
1215 for (i=
rVar(r);i>0;i--)
1247 for (i=lr-1;i>=0;i--)
1249 q1 = &(a->
m)[i*a->
ncols];
1251 for (j=lc-1;j>=0;j--)
1256 if ((f2!=0.0) && (f2<f1))
1273 a2 = &a2[a->
ncols*(lr-1)];
1274 for (j=lc-1; j>=0; j--)
1307 q1 = &(a->
m)[(lr-1)*a->
ncols];
1308 for (j=lc-1;j>=0;j--)
1329 poly* a1 = &a2[pos-1];
1358 poly piv, elim, q1, q2, *ap, *
a, *q;
1361 ap = &b[r*a0->
ncols];
1363 for(j=c-1; j>=0; j--)
1365 for(i=r-1; i>=0; i--)
1367 a = &b[i*a0->
ncols];
1372 for (j=c-1; j>=0; j--)
1384 else if (ap[j] !=
NULL)
1396 for (j=c-1; j>=0; j--)
1413 ideal
R,
const ring)
1421 for (i=r-1;i>=0;i--)
1423 q1 = &(a->
m)[i*a->
ncols];
1430 for (i=r-1;i>=0;i--)
1432 q1 = &(a->
m)[i*a->
ncols];
1433 for (j=c-1;j>=0;j--)
1443 result->m[elems] = q1[
j];
1509 poly barDiv, ideal
R,
const ring
r)
1512 int kr=lr-1,kc=lc-1;
1659 int *rowchoise,*colchoise;
1668 rowchoise=(
int *)
omAlloc(ar*
sizeof(
int));
1669 colchoise=(
int *)
omAlloc(ar*
sizeof(
int));
1670 result =
mpNew(i,j);
1680 for (i=1; i<=ar; i++)
1682 for (j=1; j<=ar; j++)
1688 if ((k+l) & 1) p=
p_Neg(p, R);
1698 for (i=1; i<=ar; i++)
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
int status int void size_t count
matrix mp_CoeffProc(poly f, poly vars, const ring R)
const CanonicalForm int s
void sm_SpecialPolyDiv(poly a, poly b, const ring R)
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
static int p_Cmp(poly p1, poly p2, ring r)
static poly mp_Select(poly fro, poly what, const ring)
static int si_min(const int a, const int b)
matrix mp_InitP(int r, int c, poly p, const ring R)
make it a p * unit matrix
static int mp_PivBar(matrix a, int lr, int lc, 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
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
poly mp_Trace(matrix a, const ring R)
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
static void mp_ElimBar(matrix a0, matrix re, poly div, int lr, int lc, const ring R)
#define omFreeSize(addr, size)
static BOOLEAN p_IsUnit(const poly p, const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define omfreeSize(addr, size)
void mpColWeight(float *)
static void mpFinalClean(matrix a)
static poly mp_Exdiv(poly m, poly d, poly vars, const ring)
static int mp_PrepareRow(matrix a, int lr, int lc, const ring R)
void mpRowWeight(float *)
static void mp_PartClean(matrix a, 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)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
int mpPivotBareiss(row_col_weight *)
poly p_Sub(poly p1, poly p2, const ring r)
static int pLength(poly a)
static poly p_Copy(poly p, const ring r)
returns a copy of p
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
static void mpSwapCol(matrix a, int pos, int lr, int lc)
static void mpReplace(int j, int n, int &sign, int *perm)
matrix mp_Transp(matrix a, const ring R)
static poly p_Head(poly p, const ring r)
static int mp_PreparePiv(matrix a, int lr, int lc, const ring r)
matrix mp_Wedge(matrix a, int ar, const ring R)
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
static BOOLEAN p_IsConstant(const poly p, const ring r)
void StringSetS(const char *st)
static poly pp_Mult_qq(poly p, poly q, const ring r)
void StringAppendS(const char *st)
matrix mp_MultI(matrix a, int f, const ring R)
c = f*a
void p_Vec2Polys(poly v, poly **p, int *len, const ring r)
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
matrix pMultMp(poly p, matrix a, const ring R)
static int si_max(const int a, const int b)
void mp_Delete(matrix *a, const ring r)
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
void p_Normalize(poly p, const ring r)
void p_Write0(poly p, ring lmRing, ring tailRing)
static void p_Delete(poly *p, const ring r)
matrix mp_MultP(matrix a, poly p, const ring R)
multiply a matrix 'a' by a poly 'p', destroy the args
const Variable & v
< [in] a sqrfree bivariate poly
matrix mp_Mult(matrix a, matrix b, const ring R)
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
static void mpSwapRow(matrix a, int pos, int lr, int lc)
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.
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
matrix mp_Add(matrix a, matrix b, const ring R)
void pEnlargeSet(poly **p, int l, int increment)
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
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
static void p_Setm(poly p, const ring r)
poly sm_MultDiv(poly a, poly b, const poly c, const ring R)
BOOLEAN mp_Equal(matrix a, matrix b, const ring R)
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
static poly p_Neg(poly p, const ring r)
static void p_LmDelete(poly p, const ring r)
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
poly TraceOfProd(matrix a, matrix b, int n, const ring R)
void p_Write(poly p, ring lmRing, ring tailRing)
matrix mp_Sub(matrix a, matrix b, const ring R)
static poly p_Add_q(poly p, poly q, const ring r)
#define omFreeBin(addr, bin)
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
static float mp_PolyWeight(poly p, const ring r)
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...
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
static poly p_Mult_q(poly p, poly q, const ring r)
static poly p_Insert(poly p1, poly p2, const ring R)
void Werror(const char *fmt,...)
#define MATELEM(mat, i, j)
static int mp_PivRow(matrix a, int lr, int lc, const ring r)