Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

matrix entry-wise comparison (masking)


I've heard that in some programming languages it is possible to "mask" your matrix. That is, I should be able to do something like

sage: M = Matrix([[1,2,3],[0,4,5],[0,0,6]])
sage: Z = zero_matrix(ZZ, 3)
sage: ( M == Z )
[False False False]
[True  False False]
[True  True  False]

Or perhaps the matrix outputted would have 0's and 1's (that would be more convenient). Is there a way to do this in Sage, perhaps using some object other than a matrix?