# HG changeset patch
# User Franco Saliola <saliola@gmail.com>
# Date 1304537446 14400
# Node ID 5618206552041d6cceb98855b37358dfaff3602d
# Parent 6d95d3c83827c0d3a5aece4a75a83456eaa4b608
trac_11293: reviewer patch; efficiency improvements
diff r 6d95d3c83827 r 561820655204 sage/combinat/posets/posets.py
a

b


717  717  
718  718   Rob Beezer (20110504) 
719  719  """ 
720   return [r for r in self.relations_iterator()] 
 720  return list(self.relations_iterator()) 
721  721  
722  722  def relations_iterator(self): 
723  723  r""" 
… 
… 

743  743  
744  744   Rob Beezer (20110504) 
745  745  """ 
746   # Relies on vertices 0 to n1 in the Hasse diagram being a 
747   # linear extension of the elements of the poset 
748   n = self._hasse_diagram.order() 
 746  # Relies on vertices the fact that _elements correspond to the rows and 
 747  # columns of the lequal matrix 
 748  leq_mat = self.lequal_matrix() 
 749  n = leq_mat.nrows() 
 750  elements = self._elements 
749  751  for i in range(n): 
750  752  for j in range(i+1, n): 
751   if self._hasse_diagram.is_less_than(i, j): 
752   yield [self._vertex_to_element(i), self._vertex_to_element(j)] 
 753  if leq_mat[i,j]: 
 754  yield [elements[i], elements[j]] 
753  755  
754  756  def is_lequal(self, x, y): 
755  757  """ 