Graphegon / pygraphblas

GraphBLAS for Python
https://graphegon.github.io/pygraphblas/pygraphblas/index.html
Apache License 2.0
343 stars 27 forks source link

Add string representation of matrices and vectors #24

Closed marci543 closed 4 years ago

marci543 commented 4 years ago

With @attilanagy234 we wrote a small code to display matrices and vectors.

A = Matrix.from_lists(
    [0, 0, 1, 3, 3, 4, 1, 5],
    [1, 3, 2, 4, 5, 2, 5, 4],
    [9, 3, 8, 6, 1, 4, 7, 2],)
print(A.to_string())
print()
print(A[0].to_string())
    0 1 2 3 4 5
 0|   9   3    | 0
 1|     8     7| 1
 2|            | 2
 3|         6 1| 3
 4|     4      | 4
 5|         2  | 5
    0 1 2 3 4 5

 0|  
 1| 9
 2|  
 3| 3
 4|  
 5|