-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v1.0.1] Drop quadpy
dependency
#95
Labels
enhancement
New feature or request
Comments
this would be a simple replacement def gauss_legendre(order, dim):
"Gauss-Legendre Points and Weights."
x, w = np.polynomial.legendre.leggauss(order)
points = np.stack(
np.meshgrid(*([x] * dim), indexing="ij")
)[::-1].reshape(dim, -1).T
idx = ["i", "j", "k"][:dim]
weights = np.einsum(", ".join(idx), *([w] * dim)).ravel()
return points, weights |
even nicer because it works on arbitrary dimensions... import numpy as np
from string import ascii_lowercase
def gauss_legendre(order, dim):
"Gauss-Legendre Points and Weights."
x, w = np.polynomial.legendre.leggauss(order)
points = np.stack(
np.meshgrid(*([x] * dim), indexing="ij")
)[::-1].reshape(dim, -1).T
idx = list(ascii_lowercase)[: dim]
weights = np.einsum(", ".join(idx), *([w] * dim)).ravel()
return points, weights |
Merged
see felupe/felupe/quadrature/_gausslegendre.py Lines 34 to 60 in 20771c9
|
fixed by #96 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As mentioned in #92
quadpy
increases the import time drastically. We can drop that dependency and use built-in functions of numpy.The text was updated successfully, but these errors were encountered: