Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98031

LU decomposition

Newsgroups comp.lang.python
Date 2015-11-01 02:04 -0800
Message-ID <1e6c4ce1-885c-43ac-b0a5-054f46d4c96e@googlegroups.com> (permalink)
Subject LU decomposition
From gers antifx <schweiger.gerald@gmail.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

LU decomposition gers antifx <schweiger.gerald@gmail.com> - 2015-11-01 02:04 -0800
  Re: LU decomposition Chris Angelico <rosuav@gmail.com> - 2015-11-01 21:18 +1100
  Re: LU decomposition Peter Otten <__peter__@web.de> - 2015-11-01 12:55 +0100
  Re: LU decomposition Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-11-03 15:52 +0000
  Re: LU decomposition Nagy László Zsolt <gandalf@shopzeus.com> - 2015-11-03 19:21 +0100

csiph-web