Metadata-Version: 2.4
Name: mlqmcpy
Version: 0.1.0
Summary: Multilevel quasi-Monte Carlo in Python.
Author: Pieterjan Robbe
License-Expression: MIT
Project-URL: Homepage, https://github.com/sandialabs/mlqmcpy
Project-URL: Repository, https://github.com/sandialabs/mlqmcpy
Project-URL: Issues, https://github.com/sandialabs/mlqmcpy/issues
Keywords: monte-carlo,quasi-monte-carlo,mlmc,mlqmc
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.2.2
Requires-Dist: qmcpy>=2.0.0.1c4
Requires-Dist: prettytable>=3.5.0
Requires-Dist: fastgps>=1.0.0.1b8
Requires-Dist: scipy>=1.15.1
Requires-Dist: torch>=2.6.0
Dynamic: license-file

[![Tests](https://github.com/sandialabs/mlqmcpy/actions/workflows/tests.yml/badge.svg)](https://github.com/sandialabs/mlqmcpy/actions/workflows/tests.yml)

# mlqmcpy

Multilevel (quasi-)Monte Carlo methods in Python.

`mlqmcpy` provides iterators and example problems for estimating expectations with
Monte Carlo, quasi-Monte Carlo, multilevel Monte Carlo, and multilevel
quasi-Monte Carlo methods.

## Installation

```bash
pip install mlqmcpy
```

## Quick start

```python
from mlqmcpy import GreedyMLQMCIterator
from mlqmcpy.problems.analytic import analytic

iterator = GreedyMLQMCIterator(2, error_tolerance=1e-2, seed=1234)

for new_samples in iterator:
    new_results = {
        level: analytic.ml(level, samples)
        for level, samples in new_samples.items()
    }
    iterator.update(new_results)

print(iterator.mean)
print(iterator.standard_error)
```

## Development

This project uses [uv](https://docs.astral.sh/uv/) for dependency management.
As a library, `mlqmcpy` does not commit a lockfile; development and CI resolve
from `pyproject.toml`.

```bash
uv sync --group dev --refresh
uv run pytest
uv run ruff check mlqmcpy tests
uv run black --check mlqmcpy tests
uv run isort --check-only mlqmcpy tests
uv build
```

Releases are published from GitHub Releases through PyPI Trusted Publishing.
Configure the PyPI trusted publisher for repository `PieterjanRobbe/mlqmcpy`,
workflow `.github/workflows/release.yml`, and environment `pypi`.
