Example #1
0
    def ichol(K, eta):
        #DEBUG: IO.pickle('/tmp/matrices/K' + str(N) + '.txt', K)
        N = len(K)  # shape[0]
        d = np.diag(K).copy()

        j = 0
        perm = [0] * N
        nu = [0] * N
        R = Lists.zeros2(N, N)
        while j < N:
            best_i = np.argmax(d)
            if d[best_i] <= eta:
                break
            perm[j] = best_i
            p_j = perm[j]
            nu[j] = np.sqrt(d[p_j])
            for i in xrange(N):
                R[j][i] = K[i][p_j]
                for jj in xrange(j):  # inner summation.  R
                    R[j][i] -= R[jj][i]*R[jj][p_j]
                R[j][i] /= nu[j]
                d[i] -= R[j][i]*R[j][i]
            # finally
            j += 1
        D = j

        model = common.Struct()
        model.D = D
        model.R = R[:D]
        model.perm = perm[:D]
        model.nu = np.array(nu[:D])
        model.K = K
        return model
Example #2
0
 def loadSinks(self):
     self.sink_list.add(Info.init())
     self.sink_list.add(Buttons.init())
     self.sink_list.add(Menus.init())
     self.sink_list.add(Images.init())
     self.sink_list.add(Layouts.init())
     self.sink_list.add(Lists.init())
     self.sink_list.add(Popups.init())
     self.sink_list.add(Tables.init())
     self.sink_list.add(Text.init())
     self.sink_list.add(Trees.init())
     self.sink_list.add(Frames.init())
     self.sink_list.add(Tabs.init())
 def loadSinks(self):
     self.sink_list.addSink(Info.init())
     self.sink_list.addSink(Buttons.init())
     self.sink_list.addSink(Menus.init())
     self.sink_list.addSink(Images.init())
     self.sink_list.addSink(Layouts.init())
     self.sink_list.addSink(Lists.init())
     self.sink_list.addSink(Popups.init())
     self.sink_list.addSink(Tables.init())
     self.sink_list.addSink(Text.init())
     self.sink_list.addSink(Trees.init())
     self.sink_list.addSink(Frames.init())
     self.sink_list.addSink(Tabs.init())
Example #4
0
    def getRepresentations(model, K):
        N = len(K)
        D = model.D
        r = Lists.zeros2(N, D)

        for j in xrange(D):
            p_j = model.perm[j]
            for i in xrange(N):
                r[i][j] = K[i][p_j]
                for jj in xrange(j):
                    r[i][j] -= r[i][jj] * model.R[jj][p_j]
                r[i][j] /= model.nu[j]

        return np.mat(r)
Example #5
0
 def loadSinks(self):
     #self.sink_list.addSink(DataTree.init())
     #self.sink_list.addSink(RecipeSystemIFACE.init())
     self.sink_list.addSink(ADViewerIFACE.init())
     self.sink_list.addSink(RecipeViewer.init())
     self.sink_list.addSink(FITSStoreFACE.init())
     self.sink_list.addSink(DisplayIFACE.init())
     self.sink_list.addSink(Info.init())
     if False:
         self.sink_list.addSink(Buttons.init())
         self.sink_list.addSink(Menus.init())
         self.sink_list.addSink(Images.init())
         self.sink_list.addSink(Layouts.init())
         self.sink_list.addSink(Lists.init())
         self.sink_list.addSink(Popups.init())
         self.sink_list.addSink(Tables.init())
         self.sink_list.addSink(Text.init())
     if False: #preserving originaly order
         self.sink_list.addSink(Frames.init())
         self.sink_list.addSink(Tabs.init())
Example #6
0
 def __init__(self, card_ID, user_ID, DB):
     self.Attachment_list = Lists.Attachment_List_Manager(
         card_ID, user_ID, DB)
     self.Checklist_list = Lists.Checklist_List_Manager(
         card_ID, user_ID, DB)
     self.Activity_list = Lists.Activity_List_Manager(card_ID, DB.cursor())
     self.Comment_list = Lists.Comment_List_Manager(card_ID, user_ID, DB)
     self.Activity_manager = Lists.Activity_Manager(card_ID, user_ID, DB)
     self.Label_list = Lists.Label_List_Manager(card_ID, user_ID, DB)
     self.cursor = DB.cursor()
     self.card_ID = card_ID
     self.user_ID = user_ID
     self.db = DB
     self.init_ids()
     self.start()
Example #7
0
    def display_frame(self, screen,clock,background,backForHaz):
        #screen.blit(background, (0,0))
        if constants.hazard != 0:
            screen.blit(backForHaz, (0,constants.menu_height))
        Lists.all_sprites_list.clear(screen, background)
        Lists.deathCircle_list.clear(screen, background)

        #removed for distribuitino testing
        # screen.blit(backgroundImage, [0,constants.menu_height])
        # screen.blit(menuImage,[0,0])



        if constants.game_over:
#             font = pygame.font.SysFont("serif", 25)
#             text = font.render("Game Over, press SpaceBar to continue", True, colors.BLACK)
#             x = (constants.screen_width // 2) - (text.get_width() // 2)
#             y = ((constants.screen_height+constants.menu_height) // 2) - (text.get_height() // 2)
#             screen.blit(text, [x, y])
            for i in range(0,len(Lists.removePointLists)/2):
                x = Lists.removePointLists.pop(0)
                y = Lists.removePointLists.pop(0)
                pygame.draw.rect(background,colors.WHITE,[y,x,30,10])
            if constants.highScore < constants.score:
                constants.highScore = constants.score
            Lists.reset()
            constants.reset()
            constants.lastEndTime = self.gameTime + constants.pauseTimeSinceStart
            xSpeed = constants.player.change_x
            ySpeed = constants.player.change_y
            currDirection = constants.currHold
            #remove any lingering inputs
            self.__init__()
            constants.player.changespeed(xSpeed, ySpeed)
            constants.currHold = currDirection

        else:

            ##indicate the hazard direction

            #display the fps
#             if (pygame.time.get_ticks()/1000 % 2 == 0):
#                 fpsFont = pygame.font.SysFont("Arial", 25)
#                 fpsText = fpsFont.render(str(clock.get_fps()),True,colors.VIOLET)
#                 pygame.draw.rect(screen,colors.WHITE,[constants.screen_width-40,constants.menu_height,40,20])
#                 screen.blit(fpsText, [constants.screen_width-40,constants.menu_height])

            Lists.all_sprites_list.draw(screen)
            Lists.deathCircle_list.draw(screen)

            #animatePointGains(screen,background)

             # Draws the menu at the top of the screen
#             pygame.draw.polygon(screen,colors.RED,[[100,constants.menu_height/4],[100+constants.menu_height/4,constants.menu_height/4]],2)
#             pygame.draw.polygon(screen,colors.RED,[[100+constants.menu_height/4,constants.menu_height/4],[100+constants.menu_height/4,constants.menu_height/2]],2)
#             pygame.draw.polygon(screen,colors.RED,[[100+constants.menu_height/4,constants.menu_height/2],[100,constants.menu_height/2]],2)
#             pygame.draw.polygon(screen,colors.RED,[[100,constants.menu_height/2],[100,constants.menu_height/4]],2)
            self.gameTime = pygame.time.get_ticks()
            if constants.timeStop:
                pygame.draw.rect(screen, colors.RED, [100,constants.menu_height/4,2+constants.menu_height/4,2+constants.menu_height/4])

            if constants.hazard != 0:
                constants.hazCountDown(screen, constants.hazard)
                constants.hazSpawn(screen, constants.player, constants.hazard)
        pygame.display.update([0,constants.menu_height,constants.screen_width,constants.screen_height])
Example #8
0
import Lists
import os


command = ""
Lists.lists()
print("-----------------")
while command != "exit" :
    command = input("커맨드입력 \n리스트 선택 및 수정 : set \n수정하지 않고 넘어가기 : pass \n>>>> ")

    if command == "set" :
        Lists.set_list()

    elif command == "pass" :
        break

command = ""
while command != "exit" :
    command = input("커맨드입력\n오늘 한일 : done 남은 일만 보기 : remain \n한일 초기화 : clear 한일 모두 초기화 : clearA\n>>>> ")

    if command == "done" :
        txt_name = Lists.choose()
        print(txt_name)
        check_list = Lists.open_txt(txt_name)
        print(check_list)
        done = input("몇 번째 할일을 했습니까?       뒤로가기 : undo\n>>>> ")
        if done == "undo" :
            pass
        else:
            done = int(done)
            print(check_list[done - 1] + " 가 한일에 추가됩니다.")
 def __init__(self, email, password):
     ws.Webscraper.__init__(self)
     self.loggedin = self.login(email, password)
     self.lists = l.Lists()
Example #10
0
import Lists
import stringMeth
import Logical


"""
number = float(input(" Please Enter any Value : "))
Lists.square(number)


list1 = [10, 20, 4, 45, 99]

Lists.square(10)
Lists.myMax(list1)
Lists.myMin(list1)
Lists.totalNum(list1)

print()
"""


string = input("Enter string:")

stringMeth.middleChar()
stringMeth.countVowel()
stringMeth.calculateLen(string)
stringMeth.calculateWord(string)

print()

# Logical
 def __init__(self):
     self.lists = Lists.Lists()
     self.default_max_len = 1000
     self.default_min_len = 2
     self.dict_path = './dictionaries/'
     self.fileName = "dictionary.txt"