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

Function _p_Test

libpolys/polys/pDebug.cc:211–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211BOOLEAN _p_Test(poly p, ring r, int level)
212{
213 assume(r->cf !=NULL);
214
215 if (PDEBUG > level) level = PDEBUG;
216 if (level < 0 || p == NULL) return TRUE;
217
218 poly p_prev = NULL;
219
220 #ifndef OM_NDEBUG
221 #ifndef X_OMALLOC
222 // check addr with level+1 so as to check bin/page of addr
223 _pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, level+1)
224 == omError_NoError, "memory error",p,r);
225 #endif
226 #endif
227
228 pFalseReturn(p_CheckRing(r));
229
230 // this checks that p does not contain a loop: rather expensive O(length^2)
231 #ifndef OM_NDEBUG
232 if (level > 1)
233 pFalseReturn(omTestList(p, level) == omError_NoError);
234 #endif
235
236 int ismod = p_GetComp(p, r) != 0;
237
238 while (p != NULL)
239 {
240 // ring check
241 pFalseReturn(p_LmCheckIsFromRing(p, r));
242 #ifndef OM_NDEBUG
243 #ifndef X_OMALLOC
244 // omAddr check
245 _pPolyAssumeReturnMsg(omTestBinAddrSize(p, (omSizeWOfBin(r->PolyBin))*SIZEOF_LONG, 1)
246 == omError_NoError, "memory error",p,r);
247 #endif
248 #endif
249 // number/coef check
250 _pPolyAssumeReturnMsg(p->coef != NULL || (n_GetChar(r->cf) >= 2), "NULL coef",p,r);
251
252 #ifdef LDEBUG
253 _pPolyAssumeReturnMsg(n_Test(p->coef,r->cf),"coeff err",p,r);
254 #endif
255 _pPolyAssumeReturnMsg(!n_IsZero(p->coef, r->cf), "Zero coef",p,r);
256
257 // check for valid comp
258 _pPolyAssumeReturnMsg(p_GetComp(p, r) >= 0 && (p_GetComp(p, r)<65000), "component out of range ?",p,r);
259 // check for mix poly/vec representation
260 _pPolyAssumeReturnMsg(ismod == (p_GetComp(p, r) != 0), "mixed poly/vector",p,r);
261
262 // special check for ringorder_s/S
263 if ((r->typ!=NULL) && (r->typ[0].ord_typ == ro_syzcomp))
264 {
265 long c1, cc1, ccc1, ec1;
266 sro_ord* o = &(r->typ[0]);
267
268 c1 = p_GetComp(p, r);

Callers 2

_p_LmTestFunction · 0.85
_pp_TestFunction · 0.85

Calls 11

omTestBinAddrSizeFunction · 0.85
p_CheckRingFunction · 0.85
p_LmCheckIsFromRingFunction · 0.85
n_GetCharFunction · 0.85
n_IsZeroFunction · 0.85
dPolyReportErrorFunction · 0.85
p_DebugInitFunction · 0.85
p_LmFreeFunction · 0.85
p_LmCmpFunction · 0.85
p_GetExpFunction · 0.85
p_ExpVectorEqualFunction · 0.50

Tested by

no test coverage detected