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

Function idSect

kernel/ideals.cc:315–465  ·  view source on GitHub ↗

2 * h3 := h1 intersect h2 */

Source from the content-addressed store, hash-verified

313* h3 := h1 intersect h2
314*/
315ideal idSect (ideal h1,ideal h2, GbVariant alg)
316{
317 int i,j,k;
318 unsigned length;
319 int flength = id_RankFreeModule(h1,currRing);
320 int slength = id_RankFreeModule(h2,currRing);
321 int rank=si_max(h1->rank,h2->rank);
322 if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
323
324 BITSET save_opt;
325 SI_SAVE_OPT1(save_opt);
326 si_opt_1 |= Sy_bit(OPT_REDTAIL_SYZ);
327
328 ideal first,second,temp,temp1,result;
329 poly p,q;
330
331 if (IDELEMS(h1)<IDELEMS(h2))
332 {
333 first = h1;
334 second = h2;
335 }
336 else
337 {
338 first = h2;
339 second = h1;
340 int t=flength; flength=slength; slength=t;
341 }
342 length = si_max(flength,slength);
343 if (length==0)
344 {
345 if ((currRing->qideal==NULL)
346 && (currRing->OrdSgn==1)
347 && (!rIsPluralRing(currRing))
348 && ((TEST_V_INTERSECT_ELIM) || (!TEST_V_INTERSECT_SYZ)))
349 return idSectWithElim(first,second,alg);
350 else length = 1;
351 }
352 if (TEST_OPT_PROT) PrintS("intersect by syzygy methods\n");
353 j = IDELEMS(first);
354
355 ring orig_ring=currRing;
356 ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
357 rSetSyzComp(length,syz_ring);
358 rChangeCurrRing(syz_ring);
359
360 while ((j>0) && (first->m[j-1]==NULL)) j--;
361 temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
362 k = 0;
363 for (i=0;i<j;i++)
364 {
365 if (first->m[i]!=NULL)
366 {
367 if (syz_ring==orig_ring)
368 temp->m[k] = pCopy(first->m[i]);
369 else
370 temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
371 q = pOne();
372 pSetComp(q,i+1+length);

Callers 2

jjINTERSECTFunction · 0.85
jjINTERSEC3SFunction · 0.85

Calls 15

si_maxFunction · 0.85
idIs0Function · 0.85
idInitFunction · 0.85
rIsPluralRingFunction · 0.85
idSectWithElimFunction · 0.85
PrintSFunction · 0.85
rAssure_SyzOrderFunction · 0.85
rSetSyzCompFunction · 0.85
rChangeCurrRingFunction · 0.85
prCopyRFunction · 0.85
p_ShiftFunction · 0.85
WarnSFunction · 0.85

Tested by

no test coverage detected