def lu_pivoting(): form = matrixAlgorithms() result = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) result = lu_decomposition(matrix_a) form.result.data = result return render_template("lu_pivoting.html", form=form)
def gauss_simple(): form = matrixAlgorithms() result = [] message = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) b_solution = form.b_solution.data.split(" ") data = eliminacion(matrix_a, b_solution) #form.result.data = result result = zip(*[i for i in data[0].values()]) message = data[1] return render_template("gauss_simple.html", form=form, result=result, message=message)
def gauss_totalpivot(): form = matrixAlgorithms() result = [] message = "" if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) b_solution = form.b_solution.data.split(" ") data = eliminacion_gaussiana_pivoteo(matrix_a, b_solution, 1) result = zip(*[i for i in data[0].values()]) if data[1]: message += "%s \n" % (data[1]) else: message = data[2] return render_template("gauss_totalpivot.html", form=form, result=result, message=message)
def lu_simple_gaussian(): form = matrixAlgorithms() result = [] message = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) n = form.n_max.data b_solution = form.b_solution.data.split(" ") data = lu_simple_gauss(matrix_a, int(n), b_solution) if len(data[0]): result = zip(*[i for i in data[0].values()]) else: result = "" message = data[1] return render_template("lu_simple_gaussian.html", form=form, result=result, message=message)
def gauss_partialpivot(): form = matrixAlgorithms() result = [] message = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) b_solution = form.b_solution.data.split(" ") data = gaussPivPar(matrix_a, b_solution) #form.result.data = result if len(data[0]) > 0: result = zip(*[i for i in data[0].values()]) else: result = "" message = data[1] return render_template("gauss_partialpivot.html", form=form, result=result, message=message)
def lucholeskypivoting(): form = matrixAlgorithms() result = [] message = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) matrix_a = np.array(matrix_a) b_solution = form.b_solution.data.split(" ") n = form.n_max.data data = cholesky(matrix_a, int(n), b_solution) if len(data[0]): result = zip(*[i for i in data[0].values()]) else: result = "" message = data[1] return render_template("cholesky.html", form=form, result=result, message=message)
def sor(): form = matrixAlgorithms() result = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) matrix_a = np.array(matrix_a) b_solution = form.b_solution.data.split(" ") b_solution = [int(x) for x in b_solution] tol = form.tol.data w_sor = form.w_sor.data data = sor_method(matrix_a, b_solution, tol, w_sor) if len(data[0]): result = zip(*[i for i in data[0].values()]) else: result = "" message = data[1] return render_template("sor.html", form=form, result=result, message=message)
def gauss_seidel(): form = matrixAlgorithms() result = [] message = [] if request.method == 'POST': matrix_a = np.matrix(form.matrix_a.data) x_0 = form.x_0.data.split(" ") n_max = form.n_max.data tol = form.tol.data instance = seidelClass(n_max, tol, x_0, matrix_a) data = instance.gaussSeidel() if len(data[0]): result = zip(*[i for i in data[0].values()]) else: result = "" message = data[1] return render_template("gauss_seidel.html", form=form, result=result, message=message)