def rdft_lu_solver(a,b,r=[]): (fra, fr) = rdft(a,r) frb = fr.dot(b) (l,u) = lu.lu(fra) y = lu.l_step(l,frb) x = lu.u_step(u,y) return x
def rdft_lu_solver(a, b, r=[]): (fra, fr) = rdft(a, r) frb = fr.dot(b) (l, u) = lu.lu(fra) y = lu.l_step(l, frb) x = lu.u_step(u, y) return x
def rdft_lu_solver_with_lu(a,b,r=[]): (fra, fr) = rdft(a,r) frb = fr.dot(b) fra_save = np.array(fra) frb_save = np.array(frb) (l,u) = lu.lu(fra) y = lu.l_step(l,frb) x = lu.u_step(u,y) return (x, l, u, fra_save, frb_save, fr)
def rdft_lu_solver_with_lu(a, b, r=[]): (fra, fr) = rdft(a, r) frb = fr.dot(b) fra_save = np.array(fra) frb_save = np.array(frb) (l, u) = lu.lu(fra) y = lu.l_step(l, frb) x = lu.u_step(u, y) return (x, l, u, fra_save, frb_save, fr)
def solve_gauss(a, b, x): (size, _) = a.shape g = rdft.generate_g(size) ga = g.dot(a) ga_save = np.array(ga) gb = g.dot(b) (l, u) = lu.lu(ga) y = lu.l_step(l, gb) x1 = lu.u_step(u, y) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, g, b, x2, linalg.cond(ga)) return (x2, ga, a, x1)
def solve_gauss(a,b,x): (size,_) = a.shape g = rdft.generate_g(size) ga = g.dot(a) ga_save = np.array(ga) gb = g.dot(b) (l,u) = lu.lu(ga) y = lu.l_step(l,gb) x1 = lu.u_step(u,y) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, g, b, x2, linalg.cond(ga)) return (x2, ga, a, x1)
def solve_rdft_givens_both(a,b,x): (size,_) = a.shape f = rdft.generate_f(size) r = rdft.generate_r(size) g1 = givens.givens_generation(size) g2 = givens.givens_generation(size) fr = f.dot(r) frg = fr.dot(g1) frgb = frg.dot(b) ag = a.dot(g2) frgag = frg.dot(ag) (l,u) = lu.lu(frgag) y = lu.l_step(l,frgb) z = lu.u_step(u,y) x1 = g2.dot(z) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, frg, b, x2, linalg.cond(frgag), g2) x2 = iteration.remove_imag(x2) return (x2, x1)
def solve_rdft_givens_both(a, b, x): (size, _) = a.shape f = rdft.generate_f(size) r = rdft.generate_r(size) g1 = givens.givens_generation(size) g2 = givens.givens_generation(size) fr = f.dot(r) frg = fr.dot(g1) frgb = frg.dot(b) ag = a.dot(g2) frgag = frg.dot(ag) (l, u) = lu.lu(frgag) y = lu.l_step(l, frgb) z = lu.u_step(u, y) x1 = g2.dot(z) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, frg, b, x2, linalg.cond(frgag), g2) x2 = iteration.remove_imag(x2) return (x2, x1)
def solve(A, y): L, U = lu(A) Ux = forwardSub(L, y) x = backwardSub(U, Ux) return x