version 1.6, 2006/12/21 05:29:49 |
version 1.7, 2011/10/05 05:46:14 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/output.c,v 1.5 2005/07/03 11:08:54 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/output.c,v 1.6 2006/12/21 05:29:49 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
Line 60 char *POLYToString(f,multSym,brace) |
|
Line 60 char *POLYToString(f,multSym,brace) |
|
{ |
{ |
extern int Wrap; |
extern int Wrap; |
extern int UseDsmall; |
extern int UseDsmall; |
|
extern int COutput; |
int i,j,jj,fi; |
int i,j,jj,fi; |
int printed = 0; |
int printed = 0; |
int vi; /* index for variables */ |
int vi; /* index for variables */ |
Line 131 char *POLYToString(f,multSym,brace) |
|
Line 132 char *POLYToString(f,multSym,brace) |
|
for (jj=0; jj<n*2; jj++) { |
for (jj=0; jj<n*2; jj++) { |
j = xout[jj]; |
j = xout[jj]; |
if (j <n) { |
if (j <n) { |
if (f->m->e[j].x) { |
if (COutput) { |
vi++; |
if (f->m->e[j].x) { |
if (vi != 1) putstr(multStr(multSym),&oq); |
vi++; |
putstr(xnames[j],&oq); |
if (vi != 1) putstr(multStr(multSym),&oq); |
if (f->m->e[j].x >= 2) { |
if (f->m->e[j].x == 1) { |
putstr("^",&oq); |
putstr(xnames[j],&oq); |
putstr(intToString(f->m->e[j].x),&oq); |
} else { |
}else if (f->m->e[j].x < 0) { |
putstr("sm1power(",&oq); |
putstr("^(",&oq); |
putstr(xnames[j],&oq); |
putstr(intToString(f->m->e[j].x),&oq); |
putstr(",",&oq); |
putstr(")",&oq); |
putstr(intToString(f->m->e[j].x),&oq); |
} |
putstr(")",&oq); |
} |
} |
|
} |
|
}else{ |
|
if (f->m->e[j].x) { |
|
vi++; |
|
if (vi != 1) putstr(multStr(multSym),&oq); |
|
putstr(xnames[j],&oq); |
|
if (f->m->e[j].x >= 2) { |
|
putstr("^",&oq); |
|
putstr(intToString(f->m->e[j].x),&oq); |
|
}else if (f->m->e[j].x < 0) { |
|
putstr("^(",&oq); |
|
putstr(intToString(f->m->e[j].x),&oq); |
|
putstr(")",&oq); |
|
} |
|
} |
|
} |
}else { |
}else { |
j = j-n; |
if (COutput) { |
if (f->m->e[j].D) { |
j = j-n; |
vi++; |
if (f->m->e[j].D) { |
if (vi != 1) putstr(multStr(multSym),&oq); |
vi++; |
putstr(dnames[j],&oq); |
if (vi != 1) putstr(multStr(multSym),&oq); |
if (f->m->e[j].D >= 2) { |
if (f->m->e[j].D == 1) { |
putstr("^",&oq); |
putstr(dnames[j],&oq); |
putstr(intToString(f->m->e[j].D),&oq); |
}else { |
}else if (f->m->e[j].D < 0) { |
if (f->m->e[j].D) putstr("sm1power(",&oq); |
putstr("^(",&oq); |
putstr(dnames[j],&oq); |
putstr(intToString(f->m->e[j].D),&oq); |
putstr(",",&oq); |
putstr(")",&oq); |
putstr(intToString(f->m->e[j].D),&oq); |
} |
putstr(")",&oq); |
} |
} |
|
} |
|
}else{ |
|
j = j-n; |
|
if (f->m->e[j].D) { |
|
vi++; |
|
if (vi != 1) putstr(multStr(multSym),&oq); |
|
putstr(dnames[j],&oq); |
|
if (f->m->e[j].D >= 2) { |
|
putstr("^",&oq); |
|
putstr(intToString(f->m->e[j].D),&oq); |
|
}else if (f->m->e[j].D < 0) { |
|
putstr("^(",&oq); |
|
putstr(intToString(f->m->e[j].D),&oq); |
|
putstr(")",&oq); |
|
} |
|
} |
|
} |
} |
} |
} |
} |
fi++; |
fi++; |