% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/00_utils.R
\name{circsum}
\alias{circsum}
\title{Compute circular rolling sums}
\usage{
circsum(x, size, step = size)
}
\arguments{
\item{x}{A numeric vector to compute circular sums over.}

\item{size}{Integer; the window size (number of consecutive elements to sum).}

\item{step}{Integer; the step size (the increment in starting index for each sum).}
}
\value{
A numeric vector containing the sum of each contiguous subsequence
around the circle. The length of the resulting vector is the number of
combinations until the pattern between \code{x} and \code{step} repeats
}
\description{
Calculates rolling sums of length \code{k} for all contiguous subsequences
around a circular vector. Returns sums for each valid k-element window
that wraps around the vector as if arranged in a circle.
}
\examples{
# Simple circular sum with window of 2
circsum(c(1, 2, 3, 4), 2)
# Returns: 3 7 (1+2, 3+4)

# Window of 3 elements
circsum(c(1, 2, 3, 4, 5), 3)
# Returns: 6 10 9 8 12 (1+2+3, 4+5+1, 2+3+4, 5+1+2, 3+4+5)

}
