Skip to main content

Module for finding sequences in arrays using Cython and NumPy.

Project description

Module for finding sequences in arrays using Cython and NumPy.

pip install cythonsequencefinder

Tested against Windows / Python 3.11 / Anaconda

Cython (and a C/C++ compiler) must be installed to use the optimized Cython implementation.

from time import perf_counter
import numpy as np
from cythonsequencefinder import np_search_sequence
from cythonsequencefinder import find_seq

seq = np.array([1, 2, 4, 5], dtype=np.int32)
sequence_size = len(seq)
arr = np.random.randint(low=0, high=10, size=1000000, dtype=np.int32)
start = perf_counter()
rax = find_seq(arr, seq, distance=1)
print(perf_counter() - start)
start = perf_counter()
rax2 = np_search_sequence(arr, seq, distance=1)
print(perf_counter() - start)
# 0.004291800003557 - cython
# 0.007874400005675852 - numpy

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

cythonsequencefinder-0.10.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

cythonsequencefinder-0.10-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file cythonsequencefinder-0.10.tar.gz.

File metadata

  • Download URL: cythonsequencefinder-0.10.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for cythonsequencefinder-0.10.tar.gz
Algorithm Hash digest
SHA256 20c22bda56db2a38009194d5f7cfb65ff354f441c7ef9da2bb1dca250fd43da8
MD5 a497840a2b1efaec2aae4a9e47e32ee6
BLAKE2b-256 70dacb7c548470670c930ada65ef93914242e1ccfa54415d19f68ccbd08bccd6

See more details on using hashes here.

File details

Details for the file cythonsequencefinder-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for cythonsequencefinder-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b65404d66417cb27de9ffea667c7cb7153dc7d0eeb695f8dc47835fde8c591f5
MD5 162b27ab2c6291763d81080eff6e7968
BLAKE2b-256 e31ce19b0cc93b7dc1beff61f382f065de273381089211b897c7557f03f4f997

See more details on using hashes here.

Supported by

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