Hi, In Sage 5.0, I'm getting the following strange behavior with sparse matrices. As they should, the following two methods produce the same cyclic permutation matrix:
sage> A = matrix(QQ,5,{(j,mod(j+1,5)):1 for j in range(5)}); A [0 1 0 0 0] [0 0 1 0 0] [0 0 0 1 0] [0 0 0 0 1] [1 0 0 0 0] sage> B = matrix(QQ,5,{(0, 1): 1, (1, 2): 1, (3, 4): 1, (2, 3): 1, (4, 0): 1}); B [0 1 0 0 0] [0 0 1 0 0] [0 0 0 1 0] [0 0 0 0 1] [1 0 0 0 0] sage: A == B True However, when I replace QQ with a number field (or CC,CDF, CLF, etc), the first way displays incorrectly even though they are still equal: sage: A = matrix(QuadraticField(2),5,{(j,mod(j+1,5)):1 for j in range(5)}); A [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] sage: B = matrix(QuadraticField(2),5,{(0, 1): 1, (1, 2): 1, (3, 4): 1, (2, 3): 1, (4, 0): 1}); B [0 1 0 0 0] [0 0 1 0 0] [0 0 0 1 0] [0 0 0 0 1] [1 0 0 0 0] sage> A == B True So is this a bug, or is there some subtle aspect of the set { ... } constuction that I'm misusing? Thanks, Jon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org