Exemplo n.º 1
0
def elimination(iter_stack):
    # load matrices
    Ai = iter_stack.A
    Bi = iter_stack.B
    
    Bi_loc = loc_hint("B", iter_stack.i, Bi) if mode=="manual" else al.left_ortho_complement(Bi)
        
    # store
    iter_stack.store_elimination_matrices(Bi_loc)

    P1i_new = Bi_loc
    P0i_new = Bi_loc*Ai

    return P1i_new, P0i_new
Exemplo n.º 2
0
def elimination(iter_stack):
    # load matrices
    Ai = iter_stack.A
    Bi = iter_stack.B

    Bi_loc = loc_hint("B", iter_stack.i,
                      Bi) if mode == "manual" else al.left_ortho_complement(Bi)

    # store
    iter_stack.store_elimination_matrices(Bi_loc)

    P1i_new = Bi_loc
    P0i_new = Bi_loc * Ai

    return P1i_new, P0i_new
Exemplo n.º 3
0
def loc_hint(matrix_string, i,  matrix):
    error_string = "There must have been a mistake. Try again.\n"
    pc.print_matrix(matrix_string, i, "", matrix)
    while True:
        try:
            loc = eval(raw_input("Please enter " + str(matrix_string) + str(i) + "_loc or \"auto\":\n"))
            if loc==auto:
                loc = al.left_ortho_complement(matrix)
            try:
                if al.is_zero_matrix(loc*matrix):
                    pc.print_matrix(matrix_string, i, "_loc", loc)
                    return loc
                else:
                    print error_string
            except:
                print error_string
        except Exception as exc:
            print exc
            print error_string
Exemplo n.º 4
0
def loc_hint(matrix_string, i, matrix):
    error_string = "There must have been a mistake. Try again.\n"
    pc.print_matrix(matrix_string, i, "", matrix)
    while True:
        try:
            loc = eval(
                input("Please enter " + str(matrix_string) + str(i) +
                      "_loc or \"auto\":\n"))
            if loc == auto:
                loc = al.left_ortho_complement(matrix)
            try:
                if al.is_zero_matrix(loc * matrix):
                    pc.print_matrix(matrix_string, i, "_loc", loc)
                    return loc
                else:
                    print(error_string)
            except:
                print(error_string)
        except Exception as exc:
            print(exc)
            print(error_string)