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

Method getMatrix

kernel/numeric/mpr_base.cc:1734–1789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1732}
1733
1734ideal resMatrixSparse::getMatrix()
1735{
1736 int i,/*j,*/cp;
1737 poly pp,phelp,piter,pgls;
1738
1739 // copy original sparse res matrix
1740 if (rmat==NULL) return NULL; //in case of error before
1741 ideal rmat_out= idCopy(rmat);
1742
1743 // now fill in coeffs of f0
1744 for ( i= 1; i <= numSet0; i++ )
1745 {
1746
1747 pgls= (gls->m)[0]; // f0
1748
1749 // get matrix row and delete it
1750 pp= (rmat_out->m)[IMATELEM(*uRPos,i,1)];
1751 pDelete( &pp );
1752 pp= NULL;
1753 phelp= pp;
1754 piter= NULL;
1755
1756 // u_1,..,u_k
1757 cp=2;
1758 while ( pNext(pgls)!=NULL )
1759 {
1760 phelp= pOne();
1761 pSetCoeff( phelp, nCopy(pGetCoeff(pgls)) );
1762 pSetComp( phelp, IMATELEM(*uRPos,i,cp) );
1763 pSetmComp( phelp );
1764 if ( piter!=NULL )
1765 {
1766 pNext(piter)= phelp;
1767 piter= phelp;
1768 }
1769 else
1770 {
1771 pp= phelp;
1772 piter= phelp;
1773 }
1774 cp++;
1775 pIter( pgls );
1776 }
1777 // u0, now pgls points to last monom
1778 phelp= pOne();
1779 pSetCoeff( phelp, nCopy(pGetCoeff(pgls)) );
1780 //pSetComp( phelp, IMATELEM(*uRPos,i,idelem+1) );
1781 pSetComp( phelp, IMATELEM(*uRPos,i,pLength((gls->m)[0])+1) );
1782 pSetmComp( phelp );
1783 if (piter!=NULL) pNext(piter)= phelp;
1784 else pp= phelp;
1785 (rmat_out->m)[IMATELEM(*uRPos,i,1)]= pp;
1786 }
1787
1788 return rmat_out;
1789}
1790
1791// Fills in resMat[][] with evpoint[] and gets determinant

Callers 1

nuMPResMatFunction · 0.45

Calls 5

idCopyFunction · 0.85
pLengthFunction · 0.85
mpNewFunction · 0.85
id_Matrix2ModuleFunction · 0.85
n_ParamFunction · 0.50

Tested by

no test coverage detected