| 1 | initial version |
Matrices over ComplexField don't implement round(), unfortunately. But the following variant of John's answer works:
sage: mat = matrix(3, 3, [2+1e-15+i*1e-15]*9)
sage: mat.change_ring(CDF).round()
[2.0 2.0 2.0]
[2.0 2.0 2.0]
[2.0 2.0 2.0]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.