Skip to main content

Generate random vectors whose components sum up to one

Project description

Generate random vectors whose components sum up to one

This Python3 module implements different approaches [1] to randomly and uniformly generate d-dimensional vectors whose components sum up to one.

[1] Maziero, J. Generating Pseudo-Random Discrete Probability Distributions. Brazilian Journal of Physics 45, 377–382 (2015). https://doi.org/10.1007/s13538-015-0337-8

Installation

Run the following to install the module:

pip install pyrandvec

Usage

from pyrandvec import sample

# Generate 10 4-dimensional vectors with the simplex-method
sample(10, 4, method = 'simplex')

# Generate 10 3-dimensional vectors with the trigonometric methdod with subsequent shuffling
sample(10, 3, method = 'trigonometric', shuffle = True)

Developing randvec

To install the pyrandvec module along with the tools you need to develop and run test, run the following command in your virtual environment (virtualenv):

pip install -e .[dev]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrandvec-1.0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrandvec-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pyrandvec-1.0.1.tar.gz.

File metadata

  • Download URL: pyrandvec-1.0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pyrandvec-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6de9287320ae7c5b929cb786e8f011c3235c248809d3332e2fd1c32c5ea19c65
MD5 260d803441510d49b92d29afb13dbccc
BLAKE2b-256 a19a82f2046197de459f08f5588782962cbb4a802552d5021a2d4ead87874b7b

See more details on using hashes here.

File details

Details for the file pyrandvec-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyrandvec-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pyrandvec-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91d16a79060911d3978b0d68911614f92f056a45333f523e5bb08cb24f4fd77a
MD5 4879254dd6d501685f4fd86e3786e756
BLAKE2b-256 70e326dd55e84eee438e9054080aa6a6799d100ae0560e76c6e84089e26639cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page