Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and deploy docs

on:
push:
branches: [main]
paths:
- "docs/**"
- "py_package/**"
- "R/**"
- "man/**"

permissions:
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Sphinx dependencies
run: pip install -r docs/requirements.txt

- name: Generate R API RST files
run: python docs/rd_to_rst.py

- name: Build HTML docs
run: sphinx-build docs/python docs/_build -W --keep-going

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ inst/include/
py_package/dist/
py_package/venv/
__pycache__/
*.pyc
*.pyc

# Sphinx build output
docs/_build/
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# robustrolling

[![R package check](https://github.com/Ptak07/rolling_window/actions/workflows/r_check.yml/badge.svg)](https://github.com/Ptak07/rolling_window/actions/workflows/r_check.yml)
[![C++ tests](https://github.com/Ptak07/rolling_window/actions/workflows/cpp_test.yml/badge.svg)](https://github.com/Ptak07/rolling_window/actions/workflows/cpp_test.yml)
[![Python package](https://github.com/Ptak07/rolling_window/actions/workflows/python.yml/badge.svg)](https://github.com/Ptak07/rolling_window/actions/workflows/python.yml)
[![R package check](https://github.com/IgorPtak/rolling_window/actions/workflows/r_check.yml/badge.svg)](https://github.com/IgorPtak/rolling_window/actions/workflows/r_check.yml)
[![C++ tests](https://github.com/IgorPtak/rolling_window/actions/workflows/cpp_test.yml/badge.svg)](https://github.com/IgorPtak/rolling_window/actions/workflows/cpp_test.yml)
[![Python package](https://github.com/IgorPtak/rolling_window/actions/workflows/python.yml/badge.svg)](https://github.com/IgorPtak/rolling_window/actions/workflows/python.yml)

High-performance rolling window metrics for R and Python, implemented in C++17.

Expand Down Expand Up @@ -41,13 +41,13 @@ Six production-grade algorithms covering the most common rolling statistics:
### R

```r
remotes::install_github("Ptak07/rolling_window")
remotes::install_github("IgorPtak/rolling_window")
```

Or build from source:

```bash
git clone https://github.com/Ptak07/rolling_window.git
git clone https://github.com/IgorPtak/rolling_window.git
cd rolling_window
make r-build
```
Expand All @@ -57,7 +57,7 @@ Requires: R ≥ 4.0, a C++17 compiler.
### Python

```bash
git clone https://github.com/Ptak07/rolling_window.git
git clone https://github.com/IgorPtak/rolling_window.git
cd rolling_window
pip install py_package/
```
Expand Down
27 changes: 27 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* robustrolling — custom overrides on top of furo */

:root {
--color-brand-primary: #2E86AB;
--color-brand-content: #2E86AB;
--color-highlight-on-target: #e8f4f8;
}

/* Tighten the algorithm table on landing page */
.algorithm-table td, .algorithm-table th {
padding: 0.4rem 0.6rem;
font-size: 0.9rem;
}

/* Monospace for inline code in parameter tables */
dl.field-list > dd code {
font-size: 0.85em;
}

/* Hero paragraph */
.hero {
font-size: 1.1rem;
color: var(--color-foreground-secondary);
margin-bottom: 1.5rem;
border-left: 4px solid var(--color-brand-primary);
padding-left: 1rem;
}
34 changes: 34 additions & 0 deletions docs/_static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions docs/python/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Python API Reference
====================

All functions accept ``np.ndarray`` and ``pd.Series`` and return the same
type. The ``min_periods`` parameter follows pandas semantics: positions with
fewer valid observations than ``min_periods`` are set to ``nan``.

High-level functions
--------------------

.. automodule:: robustrolling
:members: rolling_max, rolling_min, rolling_median, rolling_variance,
rolling_mean, rolling_skewness, rolling_kurtosis,
rolling_cov, rolling_cor
:no-undoc-members:

Low-level classes
-----------------

Six C++ classes are exposed directly for streaming (one observation at a time)
or for computing multiple statistics in a single pass without calling several
high-level functions.

.. list-table::
:header-rows: 1
:widths: 25 35 40

* - Class
- Algorithm
- Key methods
* - :py:class:`~robustrolling.MonotonicMax`
- Monotonic deque
- ``update``, ``get_max``, ``process_batch``
* - :py:class:`~robustrolling.MonotonicMin`
- Monotonic deque
- ``update``, ``get_min``, ``process_batch``
* - :py:class:`~robustrolling.MultisetMedian`
- ``std::multiset`` + tracked iterator
- ``update``, ``get_median``, ``process_batch``
* - :py:class:`~robustrolling.SlidingWelford`
- Welford + ring buffer
- ``update``, ``get_variance``, ``process_batch``
* - :py:class:`~robustrolling.SlidingMoments`
- Terriberry 4th-moment
- ``update``, ``get_mean``, ``get_skewness``, ``get_kurtosis``
* - :py:class:`~robustrolling.SlidingCovariance`
- 2-D Welford
- ``update``, ``get_covariance``, ``get_correlation``

.. toctree::
:hidden:

low_level
56 changes: 56 additions & 0 deletions docs/python/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import sys
import os

sys.path.insert(0, os.path.abspath("../../py_package"))

project = "robustrolling"
author = "Igor Ptak"
release = "0.1.0"
copyright = "2026, Igor Ptak"

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
]

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}

autodoc_mock_imports = ["robust_rolling_core"]

napoleon_numpy_docstring = True
napoleon_google_docstring = False
napoleon_use_param = False
napoleon_use_rtype = False

autodoc_member_order = "bysource"
autodoc_default_options = {
"members": True,
"undoc-members": False,
"show-inheritance": False,
}

html_theme = "furo"
html_title = "robustrolling"
html_logo = "../_static/logo.svg"
html_favicon = "../_static/logo.svg"
html_static_path = ["../_static"]
html_css_files = ["custom.css"]

html_theme_options = {
"light_css_variables": {
"color-brand-primary": "#2E86AB",
"color-brand-content": "#2E86AB",
"color-highlight-on-target": "#e8f4f8",
},
"dark_css_variables": {
"color-brand-primary": "#5aafe0",
"color-brand-content": "#5aafe0",
},
"sidebar_hide_name": False,
"navigation_with_keys": True,
}
81 changes: 81 additions & 0 deletions docs/python/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
robustrolling
=============

.. raw:: html

<p class="hero">
High-performance rolling-window statistics for R and Python — six
algorithms implemented in C++17, exposed through idiomatic bindings in
both languages, with O(1) or O(log n) updates per element.
</p>

.. toctree::
:maxdepth: 2
:caption: API Reference

api
r_api/index

Algorithm overview
------------------

.. list-table::
:header-rows: 1
:widths: 26 22 12 20 20

* - C++ class
- Algorithm
- Complexity
- R function(s)
- Python function(s)
* - ``SlidingWelfordRing``
- Welford online variance (ring buffer)
- O(1)
- ``rolling_variance``
- ``rolling_variance``, ``SlidingWelford``
* - ``MonotonicMax``
- Monotonic deque maximum
- O(1) amortised
- ``rolling_max``
- ``rolling_max``, ``MonotonicMax``
* - ``MonotonicMin``
- Monotonic deque minimum
- O(1) amortised
- ``rolling_min``
- ``rolling_min``, ``MonotonicMin``
* - ``MultisetMedian``
- ``std::multiset`` tracked-iterator median
- O(log n)
- ``rolling_median``
- ``rolling_median``, ``MultisetMedian``
* - ``SlidingMoments``
- Terriberry 4th-moment online algorithm
- O(1)
- ``rolling_mean``, ``rolling_skewness``, ``rolling_kurtosis``
- ``rolling_mean``, ``rolling_skewness``, ``rolling_kurtosis``, ``SlidingMoments``
* - ``SlidingCovariance``
- 2-D Welford online covariance
- O(1)
- ``rolling_cov``, ``rolling_cor``
- ``rolling_cov``, ``rolling_cor``, ``SlidingCovariance``

Install for R
-------------

.. code-block:: r

# Requires a C++17 compiler (GCC ≥ 7, Clang ≥ 5, MSVC ≥ 2017)
install.packages("remotes")
remotes::install_github("IgorPtak/rolling_window")

Install for Python
------------------

.. code-block:: bash

# Requires Python ≥ 3.8 and a C++17 compiler
pip install git+https://github.com/IgorPtak/rolling_window.git#subdirectory=py_package

# Or clone and install locally:
git clone https://github.com/IgorPtak/rolling_window.git
pip install rolling_window/py_package/
Loading
Loading