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

Function idDivRem

kernel/GBEngine/kLiftstd.cc:347–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345 }
346}
347ideal idDivRem(ideal A,const ideal quot, ideal &factor,ideal *unit,int lazyReduce)
348{
349 /* special cases */
350 if (idIs0(A) || idIs0(quot))
351 {
352 factor=idInit(1,IDELEMS(quot));
353 setUnit(A->rank,unit);
354 return idCopy(A);
355 }
356 /* ideal or module? */
357 ring orig_ring=currRing;
358 int k=id_RankFreeModule(quot,orig_ring);
359 int lsmod=0;
360 if (k==0) { lsmod=1;k=1;} /*ideal*/
361 /* NF(A 0 E,quot E 0)
362 * A,quot: 1..k, 0,E: k+1..k+IDELEMS(quot),
363 * E,0: k+IDELEMS(quot)..k+IDELEMS(quot)+IDELEMS(A) */
364 /* new ring */
365 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
366 rSetSyzComp(1,syz_ring);
367 rChangeCurrRing(syz_ring);
368 /* move ideals to new ring */
369 ideal s_quot;
370 ideal s_A;
371 if (orig_ring != syz_ring)
372 {
373 s_quot=idrCopyR_NoSort(quot,orig_ring,syz_ring);
374 s_A=idrCopyR_NoSort(A,orig_ring,syz_ring);
375 }
376 else
377 {
378 s_quot=id_Copy(quot,syz_ring);
379 s_A=id_Copy(A,syz_ring);
380 }
381 /* quot[i] -> quot[i]+e(k+i+1) */
382 for(int i=0;i<IDELEMS(s_quot);i++)
383 {
384 p_Shift(&s_quot->m[i],lsmod,syz_ring);
385 poly p=p_One(syz_ring);
386 p_SetComp(p,k+i+2,syz_ring);
387 p_Setm(p,syz_ring);
388 s_quot->m[i]=p_Add_q(s_quot->m[i],p,syz_ring);
389 }
390 s_quot->rank=k+IDELEMS(quot)+1;
391 /* A[i] -> A[i]*e(1) */
392 if (lsmod==1)
393 {
394 for(int i=0;i<IDELEMS(s_A);i++)
395 {
396 p_Shift(&s_A->m[i],1,syz_ring);
397 }
398 }
399 if (unit!=NULL)
400 {
401 int u_k=k+IDELEMS(quot)+2;
402 for(int i=0;i<IDELEMS(s_A);i++)
403 {
404 poly p=p_One(syz_ring);

Callers 1

jjEXTENDED_SYSTEMFunction · 0.85

Calls 15

idIs0Function · 0.85
idInitFunction · 0.85
setUnitFunction · 0.85
idCopyFunction · 0.85
rAssure_SyzOrderFunction · 0.85
rSetSyzCompFunction · 0.85
rChangeCurrRingFunction · 0.85
idrCopyR_NoSortFunction · 0.85
id_CopyFunction · 0.85
p_ShiftFunction · 0.85
p_OneFunction · 0.85
p_SetCompFunction · 0.85

Tested by

no test coverage detected