kronbinations is used to remove nested loops and perform parameter sweeps.
Project description
kronbinations
Install via
pip install kronbinations
Import via
from kronbinations import *
Description
kronbinations is used to remove nested loops, to perform multidimensional parameter sweeps and to generate arrays to store results of such sweeps.
Usage:
- Pass arbitrarily many arrays to the constructor
kronbinations
, to iterate over all combinations of the arrays elements.
k = kronbinations(array([1,2,3]), array(['a','b','c']), array([False,True,False]))
- If you need to store results of some computation in an array, you can construct these arrays via
k.empty()
,k.ones()
,k.zeros()
, ,k.full()
,k.randint()
,k.rng_random(rng=np.random.default_rng())
(or pass numpy arguments , eg.k.zeros(dtype=int)
). - Finally you can iterate over all combinations using:
for index, values, changed in k.kronprod(index=True, change=True, progress=True):
# Demonstrating a few of the functions here
if changed[0]:
print('First value changed')
x[index] = values[0]
Authors:
By Michael Schilling
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
kronbinations-0.2.tar.gz
(4.0 kB
view details)
File details
Details for the file kronbinations-0.2.tar.gz
.
File metadata
- Download URL: kronbinations-0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9f11207f3a70d1f00c4220fe8101ed87d12228c7a12053bdeb57b6930f6313fd
|
|
MD5 |
50c8d83f04d7c0d0cc46de6d70bfea0b
|
|
BLAKE2b-256 |
3c0feae96287011fec6d12218f187b533912dbaf3a9e277d07c95d9c5475f5ff
|