R/measureSweepChange.R

Defines functions .measureSweepChange

# Relative change between consecutive sweeps (eq-vmd-parada, eq-mvmd-parada):
# sum over modes and channels of ||U(n+1) - U(n)||^2 / ||U(n)||^2, with norms
# over the T bins of the T x K x C mode spectra. A coordinate without energy
# in the previous sweep leaves the ratio undefined; the change is then Inf, so
# the stopping test fails until the iteration limit.
.measureSweepChange <- function(current, previous) {
    Energy <- colSums(Mod(previous)^2)
    if (any(Energy == 0)) return(Inf)
    sum(colSums(Mod(current - previous)^2) / Energy)
}

Try the xemd package in your browser

Any scripts or data that you put into this service are public.

xemd documentation built on Nov. 9, 2026, 1:09 a.m.