def solve_rdft_improved(a, b, x): (size, _) = a.shape f = rdft.generate_f(size) r = rdft.generate_random_r(size) fr = f.dot(r) ra = r.dot(a) (x1, l, u, fra, frb, _) = rdft.rdft_lu_solver_with_lu(a, b, r) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, fr, b, x2, linalg.cond(fra)) x2 = iteration.remove_imag(x2) return (x2, fra, fr, ra, x1)
def solve_rdft_improved(a,b,x): (size,_) = a.shape f = rdft.generate_f(size) r = rdft.generate_random_r(size) fr = f.dot(r) ra = r.dot(a) (x1, l, u, fra, frb, _) = rdft.rdft_lu_solver_with_lu(a,b,r) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, fr, b, x2, linalg.cond(fra)) x2 = iteration.remove_imag(x2) return (x2, fra, fr, ra, 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_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(a, b, x): (size, _) = a.shape f = rdft.generate_f(size) r = rdft.generate_r(size) ## === care === ## g = givens.givens_generation(size) fr = f.dot(r) frg = fr.dot(g) rg = r.dot(g) (x1, l, u, fra, frb, _) = rdft.rdft_lu_solver_with_lu(a, b, rg) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, frg, b, x2, linalg.cond(fra)) x2 = iteration.remove_imag(x2) return (x2, x1)
def solve_rdft_givens(a,b,x): (size,_) = a.shape f = rdft.generate_f(size) r = rdft.generate_r(size) ## === care === ## g = givens.givens_generation(size) fr = f.dot(r) frg = fr.dot(g) rg = r.dot(g) (x1, l, u, fra, frb, _) = rdft.rdft_lu_solver_with_lu(a,b,rg) x2 = np.array(x1) x2 = iteration.iteration_another(a, l, u, frg, b, x2, linalg.cond(fra)) 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_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)