# Revision history [back]

Here is a silly answer, along with hopefully less silly ones.

Silly answer: just make the font size small enough so lines fit in the screen's width:

Less silly: the visualize_structure method gives a graphical view of the nonzero positions:

sage: A.visualize_structure()


Listing nonzero positions in each row is also a sensible (and copy-pasteable) way to visualize the matrix:

sage: dict((i, A.nonzero_positions_in_row(i)) for i in range(A.nrows()))
{0: [0, 7, 14, 67],
1: [13, 85, 86, 93],
2: [4, 11, 12, 38],
3: [8, 16, 40, 75],
4: [3, 32, 39, 78],
5: [22, 47, 58, 79],
6: [5, 26, 57, 68],
7: [44, 65, 81, 87],
8: [37, 88, 90, 91],
9: [6, 46, 52, 84],
10: [36, 43, 61, 95],
11: [9, 20, 49, 92],
12: [33, 34, 45, 71],
13: [27, 50, 56, 69],
14: [25, 41, 55, 72],
15: [1, 19, 23, 30],
16: [17, 64, 73, 80],
17: [24, 48, 60, 74],
18: [54, 70, 76, 83],
19: [10, 18, 21, 51],
20: [29, 35, 94, 97],
21: [31, 42, 62, 96],
22: [15, 53, 77, 98],
23: [2, 59, 82, 89],
24: [3, 28, 63, 66]}


One could also skip the whitespace by custom printing the matrix as follows:

sage: for row in A:
....:     print(''.join([str(a) for a in row]))
....:
100000010000001000000000000000000000000000000000000000000000000000010000000000000000000000000000000
000000000000010000000000000000000000000000000000000000000000000000000000000000000000011000000100000
000010000001100000000000000000000000001000000000000000000000000000000000000000000000000000000000000
000000001000000010000000000000000000000010000000000000000000000000000000000100000000000000000000000
000100000000000000000000000000001000000100000000000000000000000000000000000000100000000000000000000
000000000000000000000010000000000000000000000001000000000010000000000000000000010000000000000000000
000001000000000000000000001000000000000000000000000000000100000000001000000000000000000000000000000
000000000000000000000000000000000000000000001000000000000000000001000000000000000100000100000000000
000000000000000000000000000000000000010000000000000000000000000000000000000000000000000010110000000
000000100000000000000000000000000000000000000010000010000000000000000000000000000000100000000000000
000000000000000000000000000000000000100000010000000000000000010000000000000000000000000000000001000
000000000100000000001000000000000000000000000000010000000000000000000000000000000000000000001000000
000000000000000000000000000000000110000000000100000000000000000000000001000000000000000000000000000
000000000000000000000000000100000000000000000000001000001000000000000100000000000000000000000000000
000000000000000000000000010000000000000001000000000000010000000000000000100000000000000000000000000
010000000000000000010001000000100000000000000000000000000000000000000000000000000000000000000000000
000000000000000001000000000000000000000000000000000000000000000010000000010000001000000000000000000
000000000000000000000000100000000000000000000000100000000000100000000000001000000000000000000000000
000000000000000000000000000000000000000000000000000000100000000000000010000010000001000000000000000
000000000010000000100100000000000000000000000000000100000000000000000000000000000000000000000000000
000000000000000000000000000001000001000000000000000000000000000000000000000000000000000000000010010
000000000000000000000000000000010000000000100000000000000000001000000000000000000000000000000000100
000000000000000100000000000000000000000000000000000001000000000000000000000001000000000000000000001
001000000000000000000000000000000000000000000000000000000001000000000000000000000010000001000000000
000100000000000000000000000010000000000000000000000000000000000100100000000000000000000000000000000


or, replacing zeros by dots:

sage: for row in A:
....:     print(''.join([str(a) if a else '.' for a in row]))
....:
1......1......1....................................................1...............................
.............1.......................................................................11......1.....
....1......11.........................1............................................................
........1.......1.......................1..................................1.......................
...1............................1......1......................................1....................
......................1........................1..........1....................1...................
.....1....................1..............................1..........1..............................
............................................1....................1...............1.....1...........
.....................................1..................................................1.11.......
......1.......................................1.....1...............................1..............
....................................1......1.................1.................................1...
.........1..........1............................1..........................................1......
.................................11..........1.........................1...........................
...........................1......................1.....1............1.............................
.........................1...............1.............1................1..........................
.1.................1...1......1....................................................................
.................1..............................................1........1......1..................
........................1.......................1...........1.............1........................
......................................................1...............1.....1......1...............
..........1.......1..1.............................1...............................................
.............................1.....1..........................................................1..1.
...............................1..........1...................1.................................1..
...............1.....................................1.......................1....................1
..1........................................................1......................1......1.........
...1........................1..................................1..1................................


Here is a silly answer, along with hopefully less silly ones.

Silly answer: just make the font size small enough so lines fit in the screen's width:

Less silly: the visualize_structure method gives a graphical view of the nonzero positions:

sage: A.visualize_structure()


Listing nonzero positions in each row is also a sensible (and copy-pasteable) way to visualize the matrix:

sage: dict((i, A.nonzero_positions_in_row(i)) for i in range(A.nrows()))
{0: [0, 7, 14, 67],
1: [13, 85, 86, 93],
2: [4, 11, 12, 38],
3: [8, 16, 40, 75],
4: [3, 32, 39, 78],
5: [22, 47, 58, 79],
6: [5, 26, 57, 68],
7: [44, 65, 81, 87],
8: [37, 88, 90, 91],
9: [6, 46, 52, 84],
10: [36, 43, 61, 95],
11: [9, 20, 49, 92],
12: [33, 34, 45, 71],
13: [27, 50, 56, 69],
14: [25, 41, 55, 72],
15: [1, 19, 23, 30],
16: [17, 64, 73, 80],
17: [24, 48, 60, 74],
18: [54, 70, 76, 83],
19: [10, 18, 21, 51],
20: [29, 35, 94, 97],
21: [31, 42, 62, 96],
22: [15, 53, 77, 98],
23: [2, 59, 82, 89],
24: [3, 28, 63, 66]}


One could also skip the whitespace by custom printing the matrix as follows:

sage: for row in A:
....:     print(''.join([str(a) for a in row]))
....:
100000010000001000000000000000000000000000000000000000000000000000010000000000000000000000000000000
000000000000010000000000000000000000000000000000000000000000000000000000000000000000011000000100000
000010000001100000000000000000000000001000000000000000000000000000000000000000000000000000000000000
000000001000000010000000000000000000000010000000000000000000000000000000000100000000000000000000000
000100000000000000000000000000001000000100000000000000000000000000000000000000100000000000000000000
000000000000000000000010000000000000000000000001000000000010000000000000000000010000000000000000000
000001000000000000000000001000000000000000000000000000000100000000001000000000000000000000000000000
000000000000000000000000000000000000000000001000000000000000000001000000000000000100000100000000000
000000000000000000000000000000000000010000000000000000000000000000000000000000000000000010110000000
000000100000000000000000000000000000000000000010000010000000000000000000000000000000100000000000000
000000000000000000000000000000000000100000010000000000000000010000000000000000000000000000000001000
000000000100000000001000000000000000000000000000010000000000000000000000000000000000000000001000000
000000000000000000000000000000000110000000000100000000000000000000000001000000000000000000000000000
000000000000000000000000000100000000000000000000001000001000000000000100000000000000000000000000000
000000000000000000000000010000000000000001000000000000010000000000000000100000000000000000000000000
010000000000000000010001000000100000000000000000000000000000000000000000000000000000000000000000000
000000000000000001000000000000000000000000000000000000000000000010000000010000001000000000000000000
000000000000000000000000100000000000000000000000100000000000100000000000001000000000000000000000000
000000000000000000000000000000000000000000000000000000100000000000000010000010000001000000000000000
000000000010000000100100000000000000000000000000000100000000000000000000000000000000000000000000000
000000000000000000000000000001000001000000000000000000000000000000000000000000000000000000000010010
000000000000000000000000000000010000000000100000000000000000001000000000000000000000000000000000100
000000000000000100000000000000000000000000000000000001000000000000000000000001000000000000000000001
001000000000000000000000000000000000000000000000000000000001000000000000000000000010000001000000000
000100000000000000000000000010000000000000000000000000000000000100100000000000000000000000000000000


or, replacing zeros by dots:

sage: for row in A:
....:     print(''.join([str(a) if a else '.' for a in row]))
....:
1......1......1....................................................1...............................
.............1.......................................................................11......1.....
....1......11.........................1............................................................
........1.......1.......................1..................................1.......................
...1............................1......1......................................1....................
......................1........................1..........1....................1...................
.....1....................1..............................1..........1..............................
............................................1....................1...............1.....1...........
.....................................1..................................................1.11.......
......1.......................................1.....1...............................1..............
....................................1......1.................1.................................1...
.........1..........1............................1..........................................1......
.................................11..........1.........................1...........................
...........................1......................1.....1............1.............................
.........................1...............1.............1................1..........................
.1.................1...1......1....................................................................
.................1..............................................1........1......1..................
........................1.......................1...........1.............1........................
......................................................1...............1.....1......1...............
..........1.......1..1.............................1...............................................
.............................1.....1..........................................................1..1.
...............................1..........1...................1.................................1..
...............1.....................................1.......................1....................1
..1........................................................1......................1......1.........
...1........................1..................................1..1................................


The above can be obtained in a simpler way, starting from the matrix's str and using replace once:

sage: print(A.str().replace(' ', ''))
[100000010000001000000000000000000000000000000000000000000000000000010000000000000000000000000000000]
[000000000000010000000000000000000000000000000000000000000000000000000000000000000000011000000100000]
[000010000001100000000000000000000000001000000000000000000000000000000000000000000000000000000000000]
[000000001000000010000000000000000000000010000000000000000000000000000000000100000000000000000000000]
[000100000000000000000000000000001000000100000000000000000000000000000000000000100000000000000000000]
[000000000000000000000010000000000000000000000001000000000010000000000000000000010000000000000000000]
[000001000000000000000000001000000000000000000000000000000100000000001000000000000000000000000000000]
[000000000000000000000000000000000000000000001000000000000000000001000000000000000100000100000000000]
[000000000000000000000000000000000000010000000000000000000000000000000000000000000000000010110000000]
[000000100000000000000000000000000000000000000010000010000000000000000000000000000000100000000000000]
[000000000000000000000000000000000000100000010000000000000000010000000000000000000000000000000001000]
[000000000100000000001000000000000000000000000000010000000000000000000000000000000000000000001000000]
[000000000000000000000000000000000110000000000100000000000000000000000001000000000000000000000000000]
[000000000000000000000000000100000000000000000000001000001000000000000100000000000000000000000000000]
[000000000000000000000000010000000000000001000000000000010000000000000000100000000000000000000000000]
[010000000000000000010001000000100000000000000000000000000000000000000000000000000000000000000000000]
[000000000000000001000000000000000000000000000000000000000000000010000000010000001000000000000000000]
[000000000000000000000000100000000000000000000000100000000000100000000000001000000000000000000000000]
[000000000000000000000000000000000000000000000000000000100000000000000010000010000001000000000000000]
[000000000010000000100100000000000000000000000000000100000000000000000000000000000000000000000000000]
[000000000000000000000000000001000001000000000000000000000000000000000000000000000000000000000010010]
[000000000000000000000000000000010000000000100000000000000000001000000000000000000000000000000000100]
[000000000000000100000000000000000000000000000000000001000000000000000000000001000000000000000000001]
[001000000000000000000000000000000000000000000000000000000001000000000000000000000010000001000000000]
[000100000000000000000000000010000000000000000000000000000000000100100000000000000000000000000000000]


or twice:

sage: print(A.str().replace(' ', '').replace('0', '.'))
[1......1......1....................................................1...............................]
[.............1.......................................................................11......1.....]
[....1......11.........................1............................................................]
[........1.......1.......................1..................................1.......................]
[...1............................1......1......................................1....................]
[......................1........................1..........1....................1...................]
[.....1....................1..............................1..........1..............................]
[............................................1....................1...............1.....1...........]
[.....................................1..................................................1.11.......]
[......1.......................................1.....1...............................1..............]
[....................................1......1.................1.................................1...]
[.........1..........1............................1..........................................1......]
[.................................11..........1.........................1...........................]
[...........................1......................1.....1............1.............................]
[.........................1...............1.............1................1..........................]
[.1.................1...1......1....................................................................]
[.................1..............................................1........1......1..................]
[........................1.......................1...........1.............1........................]
[......................................................1...............1.....1......1...............]
[..........1.......1..1.............................1...............................................]
[.............................1.....1..........................................................1..1.]
[...............................1..........1...................1.................................1..]
[...............1.....................................1.......................1....................1]
[..1........................................................1......................1......1.........]
[...1........................1..................................1..1................................]


(one could remove the brackets using .replace('[', '').replace(']', '')).