8 lines = output_str.strip().split(
"\n")
12 _, root, _, weight = line.split()
13 roots.append(
float(root))
14 weights.append(
float(weight))
15 return np.array(roots), np.array(weights)
19 result = subprocess.run(
26 "{:.1f}".format(alpha),
27 "{:.1f}".format(beta),
30 stdout=subprocess.PIPE,
36 result = subprocess.run(
39 "scripts/sympy_gauss_jac.py",
47 stdout=subprocess.PIPE,
52 @pytest.mark.parametrize(
"n, alpha, beta, method",
[
(3, 1, 5, "rec"),
59 marks=pytest.mark.xfail(reason=
"High beta values diverge"),
72 fortran_roots, fortran_weights =
run_fortran(n, alpha, beta, method)
73 python_roots, python_weights =
run_python(n, alpha, beta)
75 assert np.allclose(fortran_roots, python_roots, atol=1e-14)
76 assert np.allclose(fortran_weights, python_weights, atol=1e-14)
77
def run_python(n, alpha, beta)
def test_gjp_quad_rec(n, alpha, beta, method)
def run_fortran(n, alpha, beta, method)
def extract_values(output_str)