MCPcopy Create free account
hub / github.com/Singular/Singular / writemonLP

Function writemonLP

libpolys/polys/polys0.cc:104–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102*/
103#ifdef HAVE_SHIFTBBA
104static void writemonLP(poly p, int ko, const ring r)
105{
106 assume(r != NULL);
107 const coeffs C = r->cf;
108 assume(C != NULL);
109
110 BOOLEAN wroteCoef=FALSE,writeGen=FALSE;
111
112 if (((p_GetComp(p,r) == ko)
113 &&(p_LmIsConstantComp(p, r)))
114 || ((!n_IsOne(pGetCoeff(p),C))
115 && (!n_IsMOne(pGetCoeff(p),C))
116 )
117 )
118 {
119 n_WriteLong(pGetCoeff(p),C);
120
121 wroteCoef=TRUE;
122 writeGen=TRUE;
123 }
124 else if (n_IsMOne(pGetCoeff(p),C))
125 {
126 if (n_GreaterZero(pGetCoeff(p),C))
127 {
128 n_WriteLong(pGetCoeff(p),C);
129
130 wroteCoef=TRUE;
131 writeGen=TRUE;
132 }
133 else
134 StringAppendS("-");
135 }
136
137 int i;
138 {
139 int lV = r->isLPring;
140 int lastVar = p_mLastVblock(p, r) * lV;
141 BOOLEAN wroteBlock = FALSE;
142 for (i=0; i<rVar(r); i++)
143 {
144 {
145 long ee = p_GetExp(p,i+1,r);
146 BOOLEAN endOfBlock = ((i+1) % lV) == 0;
147 BOOLEAN writeEmptyBlock = ee==0L && endOfBlock && !wroteBlock && i < lastVar;
148 if (ee!=0L || writeEmptyBlock)
149 {
150 if (wroteBlock)
151 StringAppendS("&");
152 else if (wroteCoef)
153 StringAppendS("*");
154 //else
155 wroteCoef=TRUE; //(bNotShortOut);
156 writeGen=TRUE;
157 if (writeEmptyBlock)
158 StringAppendS("_");
159 else
160 {
161 StringAppendS(rRingVar(i, r));

Callers 1

p_String0Function · 0.85

Calls 11

p_LmIsConstantCompFunction · 0.85
n_IsOneFunction · 0.85
n_IsMOneFunction · 0.85
n_WriteLongFunction · 0.85
n_GreaterZeroFunction · 0.85
StringAppendSFunction · 0.85
p_mLastVblockFunction · 0.85
rVarFunction · 0.85
p_GetExpFunction · 0.85
rRingVarFunction · 0.85
StringAppendFunction · 0.85

Tested by

no test coverage detected