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

Function id_Matrix2Module

libpolys/polys/simpleideals.cc:1485–1514  ·  view source on GitHub ↗

converts mat to module, destroys mat

Source from the content-addressed store, hash-verified

1483
1484/// converts mat to module, destroys mat
1485ideal id_Matrix2Module(matrix mat, const ring R)
1486{
1487 int mc=MATCOLS(mat);
1488 int mr=MATROWS(mat);
1489 ideal result = idInit(mc,mr);
1490 int i,j,l;
1491 poly h;
1492 sBucket_pt bucket = sBucketCreate(R);
1493
1494 for(j=0;j<mc /*MATCOLS(mat)*/;j++) /* j is also index in result->m */
1495 {
1496 for (i=0;i<mr /*MATROWS(mat)*/;i++)
1497 {
1498 h = MATELEM0(mat,i,j);
1499 if (h!=NULL)
1500 {
1501 l=pLength(h);
1502 MATELEM0(mat,i,j)=NULL;
1503 p_SetCompP(h,i+1, R);
1504 sBucket_Merge_p(bucket, h, l);
1505 }
1506 }
1507 sBucketClearMerge(bucket, &(result->m[j]), &l);
1508 }
1509 sBucketDestroy(&bucket);
1510
1511 // obachman: need to clean this up
1512 id_Delete((ideal*) &mat,R);
1513 return result;
1514}
1515
1516/*2
1517* converts a module into a matrix, destroyes the input

Callers 6

mp_DetFunction · 0.85
jjOPPOSEFunction · 0.85
iiMa2MoFunction · 0.85
idMinorsFunction · 0.85
getMatrixMethod · 0.85
getSubMatrixMethod · 0.85

Calls 8

idInitFunction · 0.85
sBucketCreateFunction · 0.85
pLengthFunction · 0.85
p_SetCompPFunction · 0.85
sBucket_Merge_pFunction · 0.85
sBucketClearMergeFunction · 0.85
sBucketDestroyFunction · 0.85
id_DeleteFunction · 0.85

Tested by

no test coverage detected