Sampler-focused multivariate Laplace implementation for simulation workflows.
Project description
mv-laplace
mv-laplace is a sampler-focused implementation of the Multivariate Laplace distribution.
Overview
The package exposes a MvLaplaceSampler class for generating multivariate Laplace-like samples from a location vector and covariance matrix. It is intentionally focused on sampling and practical workflow support rather than a full SciPy-style distribution API.
Installation
pip install mv-laplace
Python Version
Python >= 3.11
Support
- Supported Python:
3.11+ - Primary package index: PyPI (
mv-laplace)
Quick Start
import numpy as np
from mv_laplace import MvLaplaceSampler
loc = np.array([0.0, 1.0, -2.0])
cov = np.array([
[1.0, 0.2, 0.1],
[0.2, 2.0, -0.3],
[0.1, -0.3, 1.5],
])
sampler = MvLaplaceSampler(loc=loc, cov=cov)
samples = sampler.sample(sample_size=1000)
Implemented API
Constructor
MvLaplaceSampler(loc, cov)
Methods
sample(sample_size=None)
Input Expectations
locshould be a length-Mvector.covshould be anM x Mcovariance matrix.- Input validation and most constructor error behavior are delegated to underlying SciPy distributions.
sample(sample_size=None)returns:- shape
(M,)whensample_sizeisNone - shape
(N, M)whensample_sizeis an integerN
- shape
Testing
The project includes a pytest suite under tests/, including coverage for:
- output shape behavior for single and batched sampling
- finite-value checks for generated samples
- empirical mean/variance checks for diagonal-covariance cases
Run tests with:
uv run pytest -q
Development Setup
Install development dependencies:
uv sync --all-extras --dev
Run lint and tests:
uv run ruff check .
uv run pytest -q
Roadmap
- Add richer input validation and explicit error messages.
- Add summary-statistic utilities and SciPy-style API extensions.
- Explore a Multivariate Asymmetric Laplace distribution class.
Version History
See VersionHistory.md.
Contributing
- Community and core-developer contribution workflow is documented in
CONTRIBUTING.md. - Repository guardrails and policy details are defined in
AGENTS.md.
Release Process (High-Level)
- Pull requests from
release/*andhotfix/*intomainrun publish dry-run checks. - Merged
release/*/hotfix/*PRs tomaintrigger publish, tagging, release metadata, and post-release verification workflows. - Recovery actions (including yank/unyank verification with runbook guidance) are run manually when needed.
Reporting Issues
- Bug reports and feature requests: GitHub Issues
- Security-sensitive concerns can be reported privately using GitHub repository security reporting.
Repository Policy
High-level development policy summary (full details in AGENTS.md):
- GitFlow is used:
feature/* -> dev,release/*|hotfix/* -> main, with PR-based merges. - Release and hotfix branches must use SemVer suffixes:
release/<MAJOR.MINOR.PATCH>,hotfix/<MAJOR.MINOR.PATCH>. - Community contributions are welcome through
feature/* -> devpull requests;release/*andhotfix/*flows are core-developer managed. - CI runs on PRs to
devandmain; release dry-runs run onrelease/*/hotfix/*PRs tomain; release publish runs after merge tomain. - Semantic Versioning is required (
MAJOR.MINOR.PATCH) and versioning must be intentional. - Some defaults are guidance (for example draft PR by default) and developer discretion is explicitly supported.
uv.lockis developer-local and is not tracked in this repository.- Functional library code is authored manually.
- AI tooling may assist with test authoring, documentation drafting/editing, GitHub Actions/workflow authoring and maintenance, and development guidance for planning/decision support.
For release notes and historical change context, see VersionHistory.md.
License
This project is licensed under the GNU GPL. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mv_laplace-0.2.1.tar.gz.
File metadata
- Download URL: mv_laplace-0.2.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee83b33692c5b429a244099be13a5c6d96a7651e7360ecfe409e25256588ecfd
|
|
| MD5 |
241da8c52f5735180c01e62f54e268ec
|
|
| BLAKE2b-256 |
57325a52a79832ac3d829e8ae39a708af13325db460a19dc9b939c8db822bf58
|
File details
Details for the file mv_laplace-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mv_laplace-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66013a9e5be3796ae5598442c27fc196ad4239d9be47d543843e2baf9fbcd3f4
|
|
| MD5 |
97f3a7447bac00d5083af3a09a329461
|
|
| BLAKE2b-256 |
4d8b6e9c9a7052b579e743731d6b2d365590013cff708a7a4b77cf5abd574cff
|