Skip to main content

Permutation without repetition - written in Cython - for Numpy

pip install permutation-no-repetition

Tested against Windows / Python 3.11 / Anaconda

This module requires Cython and a C/C++ Compiler to be installed.

	
This module provides a Cython-based utility for generating permutations (without repetitions!) of arrays, supporting various data types and dimensions.

Usage:
from permutation_no_repetition import cython_permutations
import numpy as np

inputarray1 = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.int32)
i1 = cython_permutations(inputarray1, start=0, end=-1)
print(i1)

inputarray2 = np.array(
    [
        [1, 2, 3, 4],
        [3, 3, 3, 6],
        [2, 0, 0, 2],
        [2, 0, 0, 2],
        [8, 2, 8, 2],
        [4, 5, 4, 5],
        [3, 3, 3, 6],
        [4, 5, 4, 5],
        [0, 9, 8, 7],
        [1, 2, 3, 4],
    ]
)
i2 = cython_permutations(inputarray2, start=0, end=-1)
print(i2)

inputarray3 = np.array(
    [
        100,
        1,
        2,
        2,
        3,
        4,
        115,
        5,
        6,
        7,
    ],
    dtype=np.float32,
)
i3 = cython_permutations(inputarray3, start=0, end=-1)
print(i3)

int_array_7 = np.array([1, 2, 3, 4, 5, 6, 7], dtype=np.int32)
test_int_array_7 = cython_permutations(int_array_7, start=0, end=-1)
print(test_int_array_7)
int_array_8 = np.array([1, 2, 3, 4, 5, 6, 7, 8], dtype=np.int64)
test_int_array_8 = cython_permutations(int_array_8, start=0, end=-1)
print(test_int_array_8)
int_array_9 = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.uint8)
test_int_array_9 = cython_permutations(int_array_9, start=0, end=-1)
print(test_int_array_9)
int_array_10 = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=np.uint16)
test_int_array_10 = cython_permutations(int_array_10, start=0, end=-1)
print(test_int_array_10)
float_array_7 = np.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7], dtype=np.float32)
test_float_array_7 = cython_permutations(float_array_7, start=0, end=-1)
print(test_float_array_7)
float_array_8 = np.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8], dtype=np.float64)
test_float_array_8 = cython_permutations(float_array_8, start=0, end=-1)
print(test_float_array_8)
complex_array_7 = np.array(
    [1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j, 11 + 12j, 13 + 14j], dtype=np.complex64
)
test_complex_array_7 = cython_permutations(complex_array_7, start=0, end=-1)
print(test_complex_array_7)
complex_array_8 = np.array(
    [1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j, 11 + 12j, 13 + 14j, 15 + 16j],
    dtype=np.complex128,
)
test_complex_array_8 = cython_permutations(complex_array_8, start=0, end=-1)
print(test_complex_array_8)
bool_array_7 = np.array([True, False, True, False, True, False, True], dtype=np.bool_)
test_bool_array_7 = cython_permutations(bool_array_7, start=0, end=-1)
print(test_bool_array_7)
str_array_7 = np.array(
    ["apple", "banana", "cherry", "date", "elderberry", "fig", "grape"], dtype=np.str_
)
test_str_array_7 = cython_permutations(str_array_7, start=0, end=-1)
print(test_str_array_7)
unicode_array_7 = np.array(["α", "β", "γ", "δ", "ε", "ζ", "η"], dtype=np.unicode_)
test_unicode_array_7 = cython_permutations(unicode_array_7, start=0, end=-1)
print(test_unicode_array_7)
bytes_array_7 = np.array([b"a", b"b", b"c", b"d", b"e", b"f", b"g"], dtype="S1")
test_bytes_array_7 = cython_permutations(bytes_array_7, start=0, end=-1)
print(test_bytes_array_7)
bytes_array_8 = np.array([b"a", b"b", b"c", b"d", b"e", b"f", b"g", b"h"], dtype="S1")
test_bytes_array_8 = cython_permutations(bytes_array_8, start=0, end=-1)
print(test_bytes_array_8)

Metadata

Release files for permutation-no-repetition 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for permutation-no-repetition 0.10
File Size Uploaded Provenance Actions
permutation_no_repetition-0.10.tar.gz 23.6 kB Without provenance Details for permutation_no_repetition-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for permutation-no-repetition 0.10
File Interpreter ABI Platform Actions
permutation_no_repetition-0.10-py3-none-any.whl Python 3 none any Details for permutation_no_repetition-0.10-py3-none-any.whl

Total release size: 47.4 kB

Release files / permutation_no_repetition-0.10.tar.gz

Download URL permutation_no_repetition-0.10.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cd4a0c6595d5a8fe799ad50803f7df7a5928e160da6e9b8f7d4a35e26eb902b8
BLAKE2b-256 checksum
How to use checksums
a9bc6d055f9b79df7186785ba3186f5786a408b676c912a95dbe89728c6db3c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / permutation_no_repetition-0.10-py3-none-any.whl

Download URL permutation_no_repetition-0.10-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98bb103c64d47e1df8f79974aa9270276f2da4b70e846484811bb8fe0e5dc75e
BLAKE2b-256 checksum
How to use checksums
974b0b46ed586c10a41b7eb078a31ea80d941b7b403a8078b00465f96342128b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for permutation-no-repetition 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page