Documentation: https://montecarlo-nystrom.readthedocs.io
Source Code: https://github.com/ultrasphere-dev/montecarlo-nystrom
Monte-Carlo Nystrom method in NumPy / PyTorch
Install this via pip (or your favourite package manager):
pip install montecarlo-nystromSolve integral equations of the second kind of the following form.
Let
Let
and
Then
The below example solves the case where random_samples) is the uniform distribution on kernel), and rhs), and evaluates the solution at
>>> import numpy as np
>>> from montecarlo_nystrom import montecarlo_nystrom
>>> rng = np.random.default_rng(0)
>>> def random_samples(n):
... return rng.uniform(0, 1, size=(n, 1))
>>> def kernel(x, y):
... return np.linalg.vector_norm(x - y, axis=-1) ** -0.4
>>> def rhs(x):
... x0 = x[..., 0]
... return np.ones_like(x0)
>>> z_N = montecarlo_nystrom(
... random_samples=random_samples,
... kernel=kernel,
... rhs=rhs,
... n=100,
... n_mean=10,
... )
>>> np.round(z_N(np.asarray((0.5,))), 6) # Evaluate at x=0.5
np.float64(0.272957)- Feppon, F., & Ammari, H. (2022). Analysis of a Monte-Carlo Nystrom Method. SIAM J. Numer. Anal. Retrieved from https://epubs.siam.org/doi/10.1137/21M1432338
Thanks goes to these wonderful people (emoji key):
ultrasphere-dev 💻 🤔 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!
This package was created with Copier and the browniebroke/pypackage-template project template.