Macaulay2 » Documentation
Packages » NCAlgebra :: sparseCoeffs
next | previous | forward | backward | up | index | toc

sparseCoeffs -- Converts ring elements into vectors over the coefficient ring

Description

This method converts a list of ring elements to coordinate vectors - returned as a matrix - relative to a list of monomials. If the user does not supply a monomial list, the list is taken to be the monomials occurring in the elements of the list (with repetition).

i1 : A=QQ{a, b, c, d, e, f, g, h}

o1 = A

o1 : NCPolynomialRing
i2 : F = a^2+b^2+c^2+d^2+e^2+f^2+g^2+h^2;
i3 : sparseCoeffs(F)

o3 = | 1 |
     | 1 |
     | 1 |
     | 1 |
     | 1 |
     | 1 |
     | 1 |
     | 1 |

              8       1
o3 : Matrix QQ  <-- QQ
i4 : bas = flatten entries basis(2,A);
i5 : #bas

o5 = 64
i6 : sparseCoeffs(F,Monomials=>bas)

o6 = | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 0 |
     | 1 |

              64       1
o6 : Matrix QQ   <-- QQ
i7 : sparseCoeffs(toList (10:F),Monomials=>bas)

o7 = | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 0 0 0 0 0 0 0 0 0 0 |
     | 1 1 1 1 1 1 1 1 1 1 |

              64       10
o7 : Matrix QQ   <-- QQ

Ways to use sparseCoeffs:

  • sparseCoeffs(List)
  • sparseCoeffs(NCRingElement)

For the programmer

The object sparseCoeffs is a method function with options.


The source of this document is in NCAlgebra/NCAlgebraDoc.m2:2879:0.