ALB Namespace Reference


Classes

class  ALB

Functions

def Test
def PrintVersion
def do_letter_arg
def do_search
def main

Variables

string RSLTS_txt = "RSLTS.txt"
string RSLTS_tmp = "RSLTS.tmp"
int verbose = 0

Function Documentation

def ALB::do_letter_arg (   arg,
  alb 
)

Definition at line 461 of file ALB.py.

00461                              :
00462 
00463     if arg == "T":
00464         Test( )
00465         
00466     if arg == "V":
00467         print sys.version
00468         
00469     if arg == "m":
00470        globals.testMode ^= True
00471         
00472     if arg == "d":
00473         testDebug += 1
00474         
00475     if arg == "q":
00476         globals.quiet += 1
00477         
00478     if arg == "v":
00479         verbose += 1
00480         
00481     if arg == "l":
00482         global filename
00483         alb.load( filename )
00484         
00485     if arg == "s":
00486         alb.doSave( True )
00487         
00488     if arg == "p":
00489         print globals.ResultCache
00490     
def do_search( arg, obj, method, cnt, min, max ):

def ALB::do_search (   arg,
  obj,
  method,
  cnt,
  min,
  max 
)

Definition at line 491 of file ALB.py.

00491                                                 :
00492 
00493     lc = arg.lower()
00494 
00495     # 1 - SearchBasedOnPower
00496     #  for results matching seed(2^N), 
00497     #      find min/max powers of 3,5,7,11,13,17,19
00498     #      extend max by 2
00499     #      with each prime/power combo as seed, search
00500 
00501     if lc == "s_p" or \
00502        lc == "s_power" or \
00503        arg == "SearchBasedOnPower":
00504         pydb.debugger( )
00505         return obj.SearchBasedOnPower( cnt, min, max )
00506 
00507     # 2 - SearchBasedOnPowerAndDate
00508     #  for results matching seed(2^N),
00509     #      if 1 or more newer than 03/30,
00510     #    find min/max powers of 3,5,7,11,13,17,19
00511     #    extend max by 2
00512     #    with each prime/power combo as seed, search
00513 
00514     if lc == "s_pd" or \
00515        lc == "s_powerdate" or \
00516        arg == "SearchBasedOnPowerAndDate":
00517         pydb.debugger( )
00518         return obj.SearchBasedOnPowerAndDate( cnt, min, max )
00519 
00520     # 3 - SearchBasedOnLowCountAndFactorReduction
00521     #  for each N, find results matching seed(2^N)
00522     #      if count is 0 or 1,
00523     #            for p in 19,17,13,11,7,5,
00524     #        reduce primes greater than p
00525     #        find min/max powers of 3,5,7,11,13,17,19
00526     #         extend max by 2
00527     #    with each prime/power combo as seed, search
00528 
00529     if lc == "s_lcfr" or \
00530        lc == "s_low_count_factor_reduction" or \
00531        arg == "SearchBasedOnLowCountAndFactorReduction":
00532         return obj.SearchBasedOnLowCountAndFactorReduction( min, max )
00533 
00534     pydb.debugger( )
00535     return method( cnt, min, max )
00536 
def main( ):

def ALB::main (  ) 

Definition at line 537 of file ALB.py.

00537            :
00538 
00539 #    global quiet
00540 #    global ndm_flag
00541 #    global printCycle, printDate, printResult, printState
00542 #    global testConflict, testDebug,globals.testMode
00543 
00544     beg = time.time( )
00545 
00546     globals.quiet = 0
00547 
00548     globals.verbose = 0
00549     globals.ndm_flag = 1        # NZ if _ndm_seen set used to trim search tree
00550     globals.qvs_flag = 0
00551     globals.test_search = False
00552 
00553     global filename
00554     filename = RSLTS_txt
00555 
00556     globals.printDate   = False # True
00557     globals.printResult = False # True
00558     globals.printState  = False # True
00559     globals.testMode    = False         # True if comparing old/new tree traversal
00560     cycleMax    = 0
00561 
00562     globals.printCycle  = False # True
00563     globals.testConflict= True  # False # True if ndm.conflict() used to trim search tree
00564     globals.testDebug   = False # True
00565 
00566     alb = ALB( )
00567     mpng = MPNG.MPNG( alb )
00568 
00569     global t600, a600
00570 
00571     a600 = True
00572     t600 = True
00573 
00574     search = ALB.search
00575 
00576     if len( sys.argv ) == 1:
00577 
00578         PrintVersion( )
00579 
00580         globals.quiet += 2
00581         alb.load( )
00582         cnt = 0
00583         min = 1
00584         max = 1000000
00585         max = 0
00586 
00587         search( alb, cnt, min, max)
00588 
00589     else:
00590 
00591         factors = Factors.Factors( None )
00592         for arg in sys.argv[1:]:
00593 
00594             if arg == "new":  continue
00595             if arg == "old":  continue
00596 
00597             if len( arg ) == 1:
00598                 do_letter_arg( arg, alb )
00599                 continue
00600 
00601             if arg[ 0 ].isdigit( ):
00602                 # "p" or "p^q"
00603                 num = Number.FromString( arg )
00604                 factors.add( num )
00605                 continue
00606 
00607             arg12 = arg[ 0:2 ]
00608 
00609             if arg[ 0 ] == "f":
00610                 # fq - q is 2's exponent
00611                 q = arg[ 1: ]
00612                 two = Number.Number( 2, q )
00613                 verbose = 2
00614                 triples = alb.createStartTriples( two )
00615                 keys = triples.keys( )
00616                 keys.sort( )
00617                 for key in keys:
00618                     print triples[ key ],
00619                 print
00620                 continue
00621             
00622             if arg == "test_search":
00623                 globals.test_search = True
00624                 cnt = 3
00625                 min = 1
00626                 max = 1000
00627                 search( alb, cnt, min, max)
00628                 continue
00629 
00630             if arg12 == "cm":   # cm=NNN
00631                 cycleMax = do_arg_with_incr( "cycleMax", cycleMax, arg )
00632                 continue
00633 
00634             if arg12 == "pd":
00635                 globals.printDate = do_arg_with_incr( "printDate", globals.printDate, arg )
00636                 continue
00637 
00638             if arg12 == "pr":
00639 
00640                 if arg == "pro":
00641                     # PrintResultsByOrder
00642                     globals.PrintResultsByOrder = True
00643                     continue
00644 
00645                 if arg == "prv":
00646                     # PrintResultsByValue
00647                     globals.PrintResultsByOrder = False
00648                     continue
00649 
00650                 printResult = do_arg_with_incr( "printResult", printResult, arg )
00651                 continue
00652 
00653             if arg12 == "ps":
00654                 printState = do_arg_with_incr( None, printState, arg )
00655                 continue
00656 
00657             if arg12 == "pc":
00658                 printCycle = do_arg_with_incr( "printCycle", printCycle, arg )
00659                 continue
00660 
00661             if arg12 == "tc":
00662                 testConflict ^= True
00663                 continue
00664 
00665             if arg12 == "td":
00666                 testDebug = do_arg_with_incr( "testDebug", testDebug, arg )
00667                 continue
00668 
00669             if arg[0] == "r" or arg[0] == "R":
00670                 if len( arg ) == 1:
00671                     arg = RSLTS_txt
00672 
00673                 if len( arg ) != 2:
00674                     filename = arg
00675                     continue
00676 
00677                 if arg[0:4] == "rslts" or  arg[0:4] == "RSLTS":
00678                     continue
00679 
00680                 if arg == "r0":
00681                     printDate   = False
00682                     alb.load( )
00683                     cnt = 3
00684                     min = 1
00685                     max = 1000 # 10 200 500 1000
00686                     search( cnt, min, max)
00687                     return
00688 
00689                 if arg == "rd1":
00690                     PrintVersion( )
00691 
00692                     arg = "r1"
00693 #                   ndm_flag = 1
00694                     globals.quiet += 2
00695 #                   printCycle   = False
00696 #                   testConflict = True
00697 #                   testDebug    = False
00698 
00699                 if arg == "r1":
00700                     alb.load( )
00701                     cnt = 0
00702                     min = 1
00703                     max = 1000000
00704                     search( cnt, min, max)
00705                     continue
00706 
00707                 if arg == "rw":
00708                     alb.load( filename )
00709                     alb.save( filename + ".new" )
00710                     return
00711 
00712             if arg[0] == "c":
00713                 print "         %s" % ALB.instance
00714                 print "ALB.fc:  %s" % ALB.instance._fc  #FactorCache( )
00715                 print "ALB.sfc: %s" % ALB.instance._sfc #SigmaFactorCache( )
00716                 
00717                 print "ALB.FC:  %s" % FactorCache.instance( )
00718                 print "ALB.SFC: %s" % SigmaFactorCache.instance( )
00719                 print "ALB.RC:  %s" % ResultCache.instance( )
00720                 continue
00721 
00722             if arg == "ndm":
00723                 ndm_flag += 1
00724                 continue
00725 
00726             if arg == "qvs":
00727                 globals.qvs_flag += 1
00728                 continue
00729 
00730             if arg12 == "s_":
00731                 # s_abcd=min,max,cnt
00732                 try:
00733                     tokens = re.split( "[=.,]*", arg )
00734                     arg = tokens[ 0 ]
00735                     min = int( tokens[ 1 ] )
00736                     max = int( tokens[ 2 ] )
00737                     cnt = int( tokens[ 3 ] )
00738                 except:
00739                     min = 1
00740                     max = 20
00741                     cnt = 200
00742 
00743                 do_search( arg, alb, search, cnt, min, max )
00744 
00745                 alb.doSave( )
00746 
00747             if arg12 == "cy":
00748                 printCycle = False
00749                 globals.quiet += 2
00750                 count = alb.cycle( cycleMax, factors)
00751                 print "%d cycles" % count
00752 
00753             if arg[0] == "s":
00754                 # s
00755                 # s=min.max.cnt
00756                 try:
00757                     tokens = re.split( "[s.=]*", arg )
00758                     min = int( tokens[ 1 ] )
00759                     max = int( tokens[ 2 ] )
00760                     cnt = int( tokens[ 3 ] )
00761                 except:
00762                     min = 1
00763                     max = 20
00764                     cnt = 200
00765 
00766                 alb.search( cnt, min, max )
00767                 continue
00768 
00769             if arg == "x":
00770                 # print results cache
00771                 break
00772 
00773             if arg == "X":
00774                 return
00775 
00776             if arg[ 0:5 ] == "a600:":
00777                 a600 = arg[ 5: ] == 't'
00778                 print "a600 = %s" % a600
00779                 continue
00780 
00781             if arg[ 0:5 ] == "t600:":
00782                 t600 = arg[ 5: ] == 't'
00783                 print "t600 = %s" % t600
00784                 continue
00785 
00786             print "unknown option - %s" % arg
00787             continue
00788 
00789         if len( factors.factors( ) ) != 0:
00790             printCycle = False
00791             globals.quiet += 2
00792 #           testDebug = True
00793             count = alb.cycle( cycleMax, factors)
00794             print "%d cycles" % count
00795 
00796         fin = time.time( )
00797         tim = fin - beg
00798         if tim > 1:
00799             print "time: %4.2f" % tim
00800 
00801         print
00802         print globals.ResultCache.counts( )
00803         print
00804 
if __name__ == '__main__':

def ALB::PrintVersion (  ) 

Definition at line 455 of file ALB.py.

00455                    :
00456     print "Python %s" % sys.version
00457     print
00458     print TimeStamp.TimeStamp( )
00459     print
00460 
def do_letter_arg( arg, alb ):

def ALB::Test (  ) 

Definition at line 440 of file ALB.py.

00440            :
00441     import Number
00442     mag = 1
00443     sgm = 1
00444     product = Number.Number( 1, 1 )
00445     for factor in ( "2^25", "3^4", "7^1", "11^2", "19^2", "127^1", "683^1", "2731^1", "8191^1" ):
00446         ( p, q ) = re.split( "\^", factor )
00447         n = Number.Number( p, q )
00448         s = n.sgmftr( ).magnitude( )
00449         sgm = sgm * s
00450         m = n.magnitude( )
00451         mag = mag * m
00452         print "%s   %s %s   %s %s" % ( n, m, mag, s, sgm )
00453     print "%s %s" % ( sgm / mag, sgm % mag )
00454 
def PrintVersion( ):


Variable Documentation

string ALB::RSLTS_tmp = "RSLTS.tmp"

Definition at line 27 of file ALB.py.

string ALB::RSLTS_txt = "RSLTS.txt"

Definition at line 26 of file ALB.py.

int ALB::verbose = 0

Definition at line 29 of file ALB.py.


Generated on Sun Mar 22 09:59:14 2009 for Multiperfect Number Generator by  doxygen 1.5.8