# HG changeset patch
# User Robert Bradshaw <robertwb@math.washington.edu>
# Date 1239261657 25200
# Node ID db9a6680a5024372ffc6372c6927999b63f1f9c8
# Parent a97683def5a424c2bb278a83cc2c65363c22505b
Missing Mat(GF(2)) subdivisions #5715
diff r a97683def5a4 r db9a6680a502 sage/matrix/matrix_mod2_dense.pyx
a

b


417  417  [0 1 0] 
418  418  [0 1 1] 
419  419  [0 0 0] 
 420  sage: block_matrix([B, 1, 0, B]) 
 421  [0 1 01 0 0] 
 422  [0 1 10 1 0] 
 423  [0 0 00 0 1] 
 424  [+] 
 425  [0 0 00 1 0] 
 426  [0 0 00 1 1] 
 427  [0 0 00 0 0] 
420  428  """ 
421  429  if self._nrows ==0 or self._ncols == 0: 
422  430  return "[]" 
423   cdef int i,j 
424   s = [] 
 431  
 432  cdef int i,j, last_i 
 433  cdef list s = [] 
 434  empty_row = " "*(self._ncols*21) 
 435  cdef char *row_s 
 436  cdef char *div_s 
 437  
 438  cdef list row_div, col_div 
 439  if self.subdivisions is not None: 
 440  row_s = empty_row 
 441  div_s = row_divider = "[%s]" % ("" * (self._ncols*21)) 
 442  row_div, col_div = self.get_subdivisions() 
 443  last_i = 0 
 444  for i in col_div: 
 445  if i == last_i or i == self._ncols: 
 446  # Adjacent column divisions messy, use generic code 
 447  return matrix_dense.Matrix_dense.str(self) 
 448  row_s[2*i1] = '' 
 449  div_s[2*i] = '+' 
 450  last_i = i 
 451  
425  452  for i from 0 <= i < self._nrows: 
426   rl = [] 
 453  row_s = row = "[%s]" % empty_row 
427  454  for j from 0 <= j < self._ncols: 
428   rl.append(str(mzd_read_bit(self._entries,i,j))) 
429   s.append( " ".join(rl) ) 
430   return "[" + "]\n[".join(s) + "]" 
431   
 455  row_s[1+2*j] = c'0' + mzd_read_bit(self._entries,i,j) 
 456  s.append(row) 
 457  
 458  if self.subdivisions is not None: 
 459  for i in reversed(row_div): 
 460  s.insert(i, row_divider) 
 461  
 462  return "\n".join(s) 
 463  
 464  
432  465  ######################################################################## 
433  466  # LEVEL 2 functionality 
434  467  # * def _pickle 