예제 #1
0
 def longstr(self):
     lins = self.lins
     ss = [elim.shortstr(lin.A) for lin in lins]
     rows = max([s.rows for s in ss])
     #print("rows", rows, [s.rows for s in ss])
     smap = SMap()
     col = 2
     for s, lin in zip(ss, lins):
         tgt, src = lin.hom
         smap.paste(s, rows - s.rows, col)
         col1 = col + s.cols + 4
         for i in range(col, col1 - 2):
             smap[rows + 1, i] = '-'
         smap[rows + 1, i] = '>'
         smap[rows + 1, col - 2] = str(src.n)
         col = col1 + 1
     smap[rows + 1, col - 2] = str(tgt.n)
     result = str(smap)
     result = result.replace(" 0 ", " . ")
     return result
예제 #2
0
def shortstr(A):
    s = elim.shortstr(A)
    s = str(s)
    s = s.replace(" 0 ", " . ")
    return s
예제 #3
0
 def __str__(self):
     #return "Matrix(%d, %d)"%(len(self.rows), len(self.cols))
     s = str(shortstr(self.todense()))
     s = s.replace(" 0 ", " . ")
     return s