Skip to content

maths: add autocorrelation function - #14895

Merged
cclauss merged 1 commit into
TheAlgorithms:masterfrom
zain-cs:add-autocorrelation
Sep 14, 2026
Merged

maths: add autocorrelation function#14895
cclauss merged 1 commit into
TheAlgorithms:masterfrom
zain-cs:add-autocorrelation

Conversation

@zain-cs

@zain-cs zain-cs commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Adds an autocorrelation function to the maths directory.

Autocorrelation measures the correlation of a signal with a delayed copy of itself. It is widely used in time series analysis, signal processing, and statistics.

Changes

  • Added maths/autocorrelation.py with:
    • autocorrelation(data, lag) function
    • Full docstring with parameter descriptions
    • Doctests for valid and invalid inputs
    • ValueError for invalid lag or zero variance

References

Checklist

  • This PR only changes one algorithm file
  • All functions have type hints
  • All functions have doctests
  • Wikipedia reference included

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files tests are failing Do not merge until tests pass labels Jul 3, 2026
@zain-cs
zain-cs force-pushed the add-autocorrelation branch from 8ec8219 to b3f51ce Compare July 4, 2026 09:09
@zain-cs

zain-cs commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Cleaned up the commit history — squashed the pre-commit auto-fix commits and removed an unrelated commit that got mixed in during a rebase. This PR now contains a single commit for the autocorrelation function.

@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Jul 4, 2026

@anureetkaur55 anureetkaur55 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! the implementation is clean and works as expected . i approve these changes

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 14, 2026
@cclauss
cclauss merged commit ad5ad66 into TheAlgorithms:master Sep 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants