version 1.12, 2003/08/24 05:19:42 |
version 1.16, 2005/07/03 11:08:54 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/poly4.c,v 1.11 2003/08/23 02:28:38 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/poly4.c,v 1.15 2005/06/16 05:07:23 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
|
#include <string.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
#include "extern.h" |
#include "extern.h" |
Line 9 static void shell(int v[],int n); |
|
Line 10 static void shell(int v[],int n); |
|
static int degreeOfPrincipalPart(POLY f); |
static int degreeOfPrincipalPart(POLY f); |
static int degreeOfInitW(POLY f,int w[]); |
static int degreeOfInitW(POLY f,int w[]); |
static int degreeOfInitWS(POLY f,int w[],int s[]); |
static int degreeOfInitWS(POLY f,int w[],int s[]); |
|
static int dDegree(POLY f); |
|
static POLY dHomogenize(POLY f); |
|
|
|
|
static void shell(v,n) |
static void shell(v,n) |
int v[]; |
int v[]; |
int n; |
int n; |
Line 40 struct matrixOfPOLY *parts(f,v) |
|
Line 42 struct matrixOfPOLY *parts(f,v) |
|
int *ev; |
int *ev; |
struct object *evList; |
struct object *evList; |
struct object *list; |
struct object *list; |
struct object ob; |
struct object ob = OINIT; |
POLY ans; |
POLY ans; |
POLY h; |
POLY h; |
extern struct ring *CurrentRingp; |
extern struct ring *CurrentRingp; |
Line 127 struct object parts2(f,v) |
|
Line 129 struct object parts2(f,v) |
|
int *ev; |
int *ev; |
struct object *evList; |
struct object *evList; |
struct object *list; |
struct object *list; |
struct object ob; |
struct object ob = OINIT; |
POLY ans; |
POLY ans; |
POLY h; |
POLY h; |
POLY ft; |
POLY ft; |
struct object ob1,ob2,rob; |
struct object ob1 = OINIT; |
|
struct object ob2 = OINIT; |
|
struct object rob = OINIT; |
|
|
|
|
if (f ISZERO || v ISZERO) { |
if (f ISZERO || v ISZERO) { |
Line 306 POLY homogenize(f) |
|
Line 310 POLY homogenize(f) |
|
POLY t; |
POLY t; |
int maxg; |
int maxg; |
int flag,d; |
int flag,d; |
|
extern int Homogenize; |
|
|
if (f == ZERO) return(f); |
if (f == ZERO) return(f); |
|
if (Homogenize == 3) { /* double homogenization Dx x = x Dx + h H */ |
|
return dHomogenize(f); |
|
} |
t = f; maxg = (*grade)(f); flag = 0; |
t = f; maxg = (*grade)(f); flag = 0; |
while (t != POLYNULL) { |
while (t != POLYNULL) { |
d = (*grade)(t); |
d = (*grade)(t); |
Line 375 int isHomogenized_vec(f) |
|
Line 383 int isHomogenized_vec(f) |
|
return(1); |
return(1); |
} |
} |
|
|
|
static POLY dHomogenize(f) |
|
POLY f; |
|
{ |
|
POLY t; |
|
int maxg, maxdg; |
|
int flag,d,dd,neg; |
|
|
|
if (f == ZERO) return(f); |
|
|
|
t = f; |
|
maxg = (*grade)(f); |
|
while (t != POLYNULL) { |
|
dd = (*grade)(t); |
|
if (maxg < dd) maxg = dd; |
|
t = t->next; |
|
} |
|
/* fprintf(stderr,"maxg=%d\n",maxg); */ |
|
|
|
t = f; |
|
maxdg = dDegree(f); |
|
while (t != POLYNULL) { |
|
dd = dDegree(t); |
|
if (maxdg < dd) maxdg = dd; |
|
t = t->next; |
|
} |
|
/* fprintf(stderr,"maxdg=%d\n",maxdg); */ |
|
|
|
t = f; |
|
flag = 0; |
|
while (t != POLYNULL) { |
|
d = (*grade)(t); |
|
if (d != maxg) flag = 1; |
|
if (d > maxg) { |
|
maxg = d; |
|
} |
|
d = dDegree(f); |
|
if (d > maxdg) { |
|
maxdg = d; |
|
} |
|
t = t->next; |
|
} |
|
if (flag == 0) return(f); |
|
|
|
t = f; neg = 0; |
|
while (t != POLYNULL) { |
|
d = (*grade)(t); |
|
dd = dDegree(t); |
|
if (maxg-d-(maxdg-dd) < neg) { |
|
neg = maxg-d-(maxdg-dd); |
|
} |
|
t = t->next; |
|
} |
|
neg = -neg; |
|
|
|
f = pmCopy(f); /* You can rewrite the monomial parts */ |
|
t = f; |
|
while (t != POLYNULL) { |
|
d = (*grade)(t); |
|
dd = dDegree(t); |
|
t->m->e[0].D += maxdg-dd; /* h */ |
|
t->m->e[0].x += maxg-d-(maxdg-dd)+neg; /* Multiply H */ |
|
/* example Dx^2+Dx+x */ |
|
t = t->next; |
|
} |
|
return(f); |
|
} |
|
|
static int degreeOfPrincipalPart(f) |
static int degreeOfPrincipalPart(f) |
POLY f; |
POLY f; |
{ |
{ |
Line 384 static int degreeOfPrincipalPart(f) |
|
Line 458 static int degreeOfPrincipalPart(f) |
|
n = f->m->ringp->n; dd = 0; |
n = f->m->ringp->n; dd = 0; |
/* D[0] is homogenization var */ |
/* D[0] is homogenization var */ |
for (i=1; i<n; i++) { |
for (i=1; i<n; i++) { |
|
dd += f->m->e[i].D; |
|
} |
|
return(dd); |
|
} |
|
|
|
static int dDegree(f) |
|
POLY f; |
|
{ |
|
int nn,i,dd,m; |
|
if (f ISZERO) return(0); |
|
nn = f->m->ringp->nn; dd = 0; |
|
m = f->m->ringp->m; |
|
for (i=m; i<nn; i++) { |
dd += f->m->e[i].D; |
dd += f->m->e[i].D; |
} |
} |
return(dd); |
return(dd); |