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

Function id_Module2Matrix

libpolys/polys/simpleideals.cc:1519–1563  ·  view source on GitHub ↗

2 * converts a module into a matrix, destroyes the input */

Source from the content-addressed store, hash-verified

1517* converts a module into a matrix, destroyes the input
1518*/
1519matrix id_Module2Matrix(ideal mod, const ring R)
1520{
1521 matrix result = mpNew(mod->rank,IDELEMS(mod));
1522 long i; long cp;
1523 poly p,h;
1524
1525 for(i=0;i<IDELEMS(mod);i++)
1526 {
1527 p=pReverse(mod->m[i]);
1528 mod->m[i]=NULL;
1529 while (p!=NULL)
1530 {
1531 h=p;
1532 pIter(p);
1533 pNext(h)=NULL;
1534 cp = si_max(1L,p_GetComp(h, R)); // if used for ideals too
1535 //cp = p_GetComp(h,R);
1536 p_SetComp(h,0,R);
1537 p_SetmComp(h,R);
1538#ifdef TEST
1539 if (cp>mod->rank)
1540 {
1541 Print("## inv. rank %ld -> %ld\n",mod->rank,cp);
1542 int k,l,o=mod->rank;
1543 mod->rank=cp;
1544 matrix d=mpNew(mod->rank,IDELEMS(mod));
1545 for (l=0; l<o; l++)
1546 {
1547 for (k=0; k<IDELEMS(mod); k++)
1548 {
1549 MATELEM0(d,l,k)=MATELEM0(result,l,k);
1550 MATELEM0(result,l,k)=NULL;
1551 }
1552 }
1553 id_Delete((ideal *)&result,R);
1554 result=d;
1555 }
1556#endif
1557 MATELEM0(result,cp-1,i) = p_Add_q(MATELEM0(result,cp-1,i),h,R);
1558 }
1559 }
1560 // obachman 10/99: added the following line, otherwise memory leack!
1561 id_Delete(&mod,R);
1562 return result;
1563}
1564
1565matrix id_Module2formatedMatrix(ideal mod,int rows, int cols, const ring R)
1566{

Callers 12

sm_DetFunction · 0.85
jjEXTENDED_SYSTEMFunction · 0.85
jjOPPOSEFunction · 0.85
jjDIVISION4Function · 0.85
iiMo2MaFunction · 0.85
PrintMethod · 0.85
jjPRINTFunction · 0.85
idPrepare_printFunction · 0.85
idPrepareFunction · 0.85
idExtractG_T_SFunction · 0.85
idDivRemFunction · 0.85
Approx_StepFunction · 0.85

Calls 7

mpNewFunction · 0.85
pReverseFunction · 0.85
si_maxFunction · 0.85
p_SetCompFunction · 0.85
id_DeleteFunction · 0.85
p_Add_qFunction · 0.85
PrintFunction · 0.50

Tested by

no test coverage detected