Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3919b53
revise sliding dot product functions
NimaSarajpoor Jan 22, 2026
74aed07
Merge branch 'main' into enhance_sliding_dot_product
NimaSarajpoor Jan 23, 2026
3c70d47
Moved functions to sdp module
NimaSarajpoor Jan 24, 2026
203869e
add sdp functions and their tests
NimaSarajpoor Jan 24, 2026
a2b5d4e
minor fix for cases without any docstring
NimaSarajpoor Jan 24, 2026
c20c8dc
add pyfftw_sdp, tests, and relevant fixes
NimaSarajpoor Jan 25, 2026
f6d5054
minor fix
NimaSarajpoor Jan 25, 2026
44d4ee0
update pyproject.toml
NimaSarajpoor Jan 25, 2026
2f40bcd
merge from main and resolve conflicts
NimaSarajpoor Jan 28, 2026
0ed0cf0
revert change
NimaSarajpoor Jan 28, 2026
2832230
Merge branch 'main' into enhance_sliding_dot_product
NimaSarajpoor Feb 1, 2026
84eb855
minor change
NimaSarajpoor Feb 1, 2026
4dd4b54
minor change
NimaSarajpoor Feb 1, 2026
3fde978
improve coverage and fix test
NimaSarajpoor Feb 1, 2026
ee58563
revert environment yml file and fix coverage
NimaSarajpoor Feb 1, 2026
1de5370
minor change
NimaSarajpoor Feb 1, 2026
3f69885
improve coverage test for pyfftw
NimaSarajpoor Feb 2, 2026
d320d97
improve regex pattern for capturing pyfftw
NimaSarajpoor Feb 2, 2026
a318173
merge, resolve conflict, and minor changes
NimaSarajpoor Feb 2, 2026
39920de
fixed regex pattern for removing tests from coverage
NimaSarajpoor Feb 3, 2026
e446369
addressed comments
NimaSarajpoor Feb 3, 2026
e3c37a3
add oaconvolve and general function
NimaSarajpoor Feb 3, 2026
ed8e0fd
add test function to check empty list for boundaries
NimaSarajpoor Feb 3, 2026
27072de
remove unncessary warning
NimaSarajpoor Feb 3, 2026
ff11e3a
fix coverage
NimaSarajpoor Feb 3, 2026
1ea94ed
minor change
NimaSarajpoor Feb 4, 2026
d0dab71
minor chanage in default sdp and core sdp
NimaSarajpoor Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_docstring_args(fd, file_name, func_name, class_name=None):
Extract docstring parameters from function definition
"""
docstring = ast.get_docstring(fd)
if len(re.findall(r"Parameters", docstring)) != 1:
if docstring is None or len(re.findall(r"Parameters", docstring)) != 1:
msg = "Missing required 'Parameters' section in docstring in \n"
msg += f"file: {file_name}\n"
if class_name is not None:
Expand All @@ -23,7 +23,7 @@ def get_docstring_args(fd, file_name, func_name, class_name=None):
msg += f"function/method: {func_name}\n"
raise RuntimeError(msg)

if class_name is None:
if len(re.findall(r"Returns", docstring)) > 0:
params_section = re.findall(
r"(?<=Parameters)(.*)(?=Returns)", docstring, re.DOTALL
)[0]
Expand All @@ -43,7 +43,7 @@ def get_signature_args(fd):
return set([a.arg for a in fd.args.args if a.arg != "self"])


def check_args(doc_args, sig_args, file_name, func_name, class_name=None):
def check_args(docstring_args, signature_args, file_name, func_name, class_name=None):
"""
Compare docstring arguments and signature argments
"""
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ dependencies:
- jupyterlab-myst>=2.0.0
- myst-nb>=1.0.0
- polars>=1.14.0
- fftw>=3.3
- pyfftw>=0.15.0
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ ci = [
"isort >= 5.11.0",
'tbb >= 2019.5 ; platform_system == "Linux"',
"polars >= 1.14.0",
"pyfftw >= 0.15.0",
"lxml"
]

Expand Down Expand Up @@ -86,8 +87,8 @@ isort = ">=5.11.0"
polars = ">=1.14.0"
pip = "*"
lxml = "*"
fftw = "*"
pyfftw = "*"
fftw = ">=3.3"
pyfftw = ">=0.15.0"
# readthedocs
sphinx = ">=3.5.3"
pydata-sphinx-theme = "*"
Expand Down
37 changes: 6 additions & 31 deletions stumpy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
from numba import cuda, njit, prange
from scipy import linalg
from scipy.ndimage import maximum_filter1d, minimum_filter1d
from scipy.signal import convolve
from scipy.spatial.distance import cdist

from . import config
from . import config, sdp

try:
from numba.cuda.cudadrv.driver import _raise_driver_not_found
Expand Down Expand Up @@ -652,7 +651,8 @@ def check_window_size(m, max_size=None, n=None):
@njit(fastmath=config.STUMPY_FASTMATH_TRUE)
def _sliding_dot_product(Q, T):
"""
A Numba JIT-compiled implementation of the sliding window dot product.
A wrapper for numba JIT-compiled implementation of
the sliding dot product.

Parameters
----------
Expand All @@ -667,18 +667,12 @@ def _sliding_dot_product(Q, T):
out : numpy.ndarray
Sliding dot product between `Q` and `T`.
"""
m = Q.shape[0]
l = T.shape[0] - m + 1
out = np.empty(l)
for i in range(l):
out[i] = np.dot(Q, T[i : i + m])

return out
return sdp._njit_sliding_dot_product(Q, T)


def sliding_dot_product(Q, T):
"""
Use FFT convolution to calculate the sliding window dot product.
A wrapper for convolution implementation of the sliding dot product.

Parameters
----------
Expand All @@ -692,27 +686,8 @@ def sliding_dot_product(Q, T):
-------
output : numpy.ndarray
Sliding dot product between `Q` and `T`.

Notes
-----
Calculate the sliding dot product

`DOI: 10.1109/ICDM.2016.0179 \
<https://www.cs.ucr.edu/~eamonn/PID4481997_extend_Matrix%20Profile_I.pdf>`__

See Table I, Figure 4

Following the inverse FFT, Fig. 4 states that only cells [m-1:n]
contain valid dot products

Padding is done automatically in fftconvolve step
"""
n = T.shape[0]
m = Q.shape[0]
Qr = np.flipud(Q) # Reverse/flip Q
QT = convolve(Qr, T)

return QT.real[m - 1 : n]
return sdp._convolve_sliding_dot_product(Q, T)


@njit(
Expand Down
Loading
Loading