Skip to content

Conversation

@seanlaw
Copy link
Contributor

@seanlaw seanlaw commented Feb 27, 2025

Tested the njit dot function from numpy:

import numpy as np
from numba import njit


def setup(Q, T):
    sliding_dot_product(Q, T)
    return


@njit(fastmath=True)
def sliding_dot_product(Q, 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

Using ./test.py -noheader -pmin 6 -pmax 23 -pdiff 6 challenger >> timing.csv.

download-29

@seanlaw seanlaw changed the title CHALLENGER njit numpy dot CHALLENGER njit serial numpy dot Feb 27, 2025
@seanlaw
Copy link
Contributor Author

seanlaw commented Feb 27, 2025

The results are comparable to the original njit and, possibly, "better" when len(Q) == len(T) and len(T) <= 2^14.

I would consider comparing the lower p values.

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Nov 22, 2025

@seanlaw
I was looking at the code and the plot provided in the first comment of this PR. The code is similar to njit_sdp.py, and the difference is that np.dot is used here instead of a for-loop. And, similar to njit_sdp, it does not outperform pyfftw when len(T) > len(Q) > 2^6.

So, I was wondering if we should just compare the challenger with njit_sdp and focus on len(Q) <= 2^6 where we know njit_sdp.py can outperform the other methods.

@seanlaw
Copy link
Contributor Author

seanlaw commented Nov 22, 2025

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants