LU decomposition

gers antifx schweiger.gerald at gmail.com
Sun Nov 1 05:04:49 EST 2015


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



More information about the Python-list mailing list