optimal.cost: A helper function which determines the optimal cost for a...

Description Usage Arguments Value Examples

View source: R/DYNPROG.R

Description

A helper function which determines the optimal cost for a given subsignal

Usage

1
optimal.cost(Q.vec, S.vec, start.index, end.index)

Arguments

Q.vec

The cumulative sum of squares for the full signal

S.vec

The cumulative sum for the full signal

start.index

The first index in the subsignal, inclusive

end.index

The last index in the subsignal, inclusive

Value

The optimal cost for the subsignal

Examples

1
2
3
4
5
signal <- c( runif(25, min=0, max=2),
             runif(25, min=2, max=5) )
Q.vec <- c( 0, cumsum( signal^2 ) )
S.vec <- c( 0, cumsum( signal ) )
cost <- optimal.cost( Q.vec, S.vec, 1, length( signal ) )

Benjamin-Couey/CS599.RPackageTwo documentation built on Dec. 31, 2020, 10:45 a.m.