Hey,

I have to write a LU-decomposition. My Code worked so far but (I want to become 
better:) ) I want to ask you, if I could write this LU-decomposition in a 
better way?

def LU(x):
    L = np.eye((x.shape[0]))
    n = x.shape[0]
    for ii in range(n-1): 
        for ll in range(1+ii,n): 
            factor = float(x[ll,ii])/x[ii,ii]  
            L[ll,ii] = factor
            for kk in range(0+ii,n):
                    x[ll,kk] = x[ll,kk] - faktor*x[ii,kk]
    LU = np.dot(L,x)

Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to