Skip to content

Commit

Permalink
Fix mistake in adaptive for Chebyshev
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaem committed Nov 16, 2023
1 parent 9515a34 commit 48caff0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion shenfun/matrixbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,10 @@ def _get_matrix(test, trial, measure=1, assemble=None, fixed_resolution=None):
V[i, j] = integrate_sympy(integrand, (x, domain[0], domain[1]))
elif assemble == 'adaptive':
if isinstance(integrand, Number):
V[i, j] = integrand*float(domain[1]-domain[0])
if cheb:
V[i, j] = integrand*np.pi
else:
V[i, j] = integrand*float(domain[1]-domain[0])
else:
V[i, j] = quad(sp.lambdify(x, integrand), float(domain[0]), float(domain[1]), **w)[0]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def test_adaptive_quadrature(b0, b1):
B1 = inner(v, u, assemble='quadrature', kind='stencil')
C = B0-B1
C.incorporate_scale()
assert np.linalg.norm(C.diags('csr').data) < 1e-8
assert np.linalg.norm(C.diags('csr').data) < 1e-7

# Some bases take too long for Chebyshev, so just choose these three
some_cbases3 = [(cbases.ShenDirichlet, cbases.ShenDirichlet),
Expand Down

0 comments on commit 48caff0

Please sign in to comment.