compare_drawdowns: Align two periodic drawdowns

View source: R/compare.R

compare_drawdownsR Documentation

Align two periodic drawdowns

Description

Minimizes the fraction of unequal cells over allowed transformations of y and cyclic shifts. Primitive repeats are tiled to the least common multiple of each axis, so differently sized repeats can be compared without resizing. Ties use the first transformation, then smallest row and column offsets. Both matrices must use the same pick/end and zero/one conventions.

Usage

compare_drawdowns(
  x,
  y,
  reflect = FALSE,
  transpose = FALSE,
  invert = FALSE,
  max_work = 5e+07
)

Arguments

x, y

Binary drawdowns.

reflect, transpose, invert

Transformation flags; see [canonical_drawdown()].

max_work

Cell-comparison budget; see [canonical_drawdown()].

Value

A list with distance, similarity, equivalent (exact zero distance), transformation, offsets applied after transformation and repeat reduction, domain dimensions, and aligned matrices x and y on that domain.

Examples

a <- matrix(c(1, 0, 0, 1), 2)
compare_drawdowns(a, shift_drawdown(a, 1))$equivalent

weaveCompare documentation built on Nov. 9, 2026, 1:10 a.m.