def QR_solve(A):
    col_labels = sorted(A.D[1], key=repr)
    Acolms = dict2list(mat2coldict(A), col_labels)
    (Qlist, Rlist) = aug_orthogonalize(Acolms)
    Q = coldict2mat(list2dict(Qlist, col_labels))
    R = coldict2mat(list2dict(Rlist, col_labels))
    return Q, R
def QR_factor(A):
    col_labels = sorted(A.D[1], key=repr)
    Acols = dict2list(mat2coldict(A),col_labels)
    Qlist, Rlist = aug_orthonormalize(Acols)
    #Now make Mats
    Q = coldict2mat(Qlist)
    R = coldict2mat(list2dict(Rlist, col_labels))
    return Q,R
Example #3
0
def QR_factor(A):
    col_labels = sorted(A.D[1], key=repr)
    Acols = dict2list(mat2coldict(A), col_labels)
    Qlist, Rlist = aug_orthonormalize(Acols)
    #Now make Mats
    Q = coldict2mat(Qlist)
    R = coldict2mat(list2dict(Rlist, col_labels))
    return Q, R
Example #4
0
def factor(A):
    """ Implementation of the Gram-Schmidt procedure.
    """
    col_labels = sorted(A.D[1], key=hash)
    Acols = dict2list(matrix2coldict(A), col_labels)
    Qlist, Rlist = aug_orthonormalize(Acols)
    # Now make Matrices
    Q = coldict2mat(Qlist)
    R = coldict2mat(list2dict(Rlist, col_labels))
    return Q, R
Example #5
0
def fog(d1, d2):
    import dictutil
    d1k = list(d1.keys())
    d1v = dictutil.dict2list(d1, d1.keys())
    d2v = dictutil.dict2list(d2, d1v)
    return dictutil.list2dict(d2v, d1k)
Example #6
0
def fog(d1,d2):
    import dictutil
    d1k=list(d1.keys())
    d1v=dictutil.dict2list(d1,d1.keys())
    d2v=dictutil.dict2list(d2,d1v)
    return dictutil.list2dict(d2v,d1k)
Example #7
0
#0.6
#Task 0.6.1
import math
help(math)
math.sqrt(3)
#Task 0.6.2
from random import randint
randint(1,10)
def movie_review(name): return ["See it","A gem!","Ideologcial claptrap!"][randint(0,2)]
movie_review('hello')

#Task 0.6.3
import dictutil
dictutil.dict2list({'a':'A','b':'B','c':'C'},['b','c','a'])
dictutil.list2dict(['A','B','C'], ['a','b','c'])

from importlib import reload
reload(dictutil)
#Task 0.6.4
dictutil.listrange2dict(['A','B','C'])

for x in {1,2,3}:
    print(x)

v = [1,2,0]
i = 0
while v[i] == 0:
    print(v[i])
    i = i + 1
if True : print('True')
Example #8
0
import dictutil as du

a = du.list2dict(['A', 'B', 'C'], ['a', 'b', 'c'])
print(a)