<s> """<STR_LIT>""" <EOL> import ellyBits <EOL> class DerivabilityMatrix ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , nmax ) : <EOL> """<STR_LIT>""" <EOL> self . dm = [ ] <EOL> for i in range ( nmax ) : <EOL> rw = ellyBits . EllyBits ( nmax ) <EOL> rw . set ( i ) <EOL> self . dm . append ( rw ) <EOL> def derivable ( self , n , gbs ) : <EOL> """<STR_LIT>""" <EOL> return self . dm [ n ] . intersect ( gbs ) <EOL> def join ( self , left , rght ) : <EOL> """<STR_LIT>""" <EOL> if self . dm [ rght ] . test ( left ) : <EOL> return <EOL> rw = self . dm [ left ] <EOL> lm = len ( self . dm ) <EOL> for i in range ( lm ) : <EOL> if self . dm [ i ] . test ( rght ) : <EOL> self . dm [ i ] . combine ( rw ) <EOL> def row ( self , n ) : <EOL> """<STR_LIT>""" <EOL> return self . dm [ n ] <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> def dump ( m ) : <EOL> """<STR_LIT>""" <EOL> print <NUM_LIT:0> , m . dm [ <NUM_LIT:0> ] . hexadecimal ( ) <EOL> print <NUM_LIT:1> , m . dm [ <NUM_LIT:1> ] . hexadecimal ( ) <EOL> print <NUM_LIT:2> , m . dm [ <NUM_LIT:2> ] . hexadecimal ( ) <EOL> print <NUM_LIT:3> , m . dm [ <NUM_LIT:3> ] . hexadecimal ( ) <EOL> print <NUM_LIT:4> , m . dm [ <NUM_LIT:4> ] . hexadecimal ( ) <EOL> print <NUM_LIT:5> , m . dm [ <NUM_LIT:5> ] . hexadecimal ( ) <EOL> print "<STR_LIT>" <EOL> mtx = DerivabilityMatrix ( <NUM_LIT> ) <EOL> print mtx <EOL> dump ( mtx ) <EOL> mtx . join ( <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> dump ( mtx ) <EOL> mtx . join ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> dump ( mtx ) <EOL> mtx . join ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> dump ( mtx ) <EOL> mtx . join ( <NUM_LIT:3> , <NUM_LIT:4> ) <EOL> dump ( mtx ) <EOL> mtx . join ( <NUM_LIT:4> , <NUM_LIT:5> ) <EOL> dump ( mtx ) </s>
