Displaying 1 result from an estimated 1 matches for "partimax".
Did you mean:
partimag
2008 Jan 07
3
Seeking a more efficient way to find partition maxima
...Idx, c( ( seriesIdx[ -1 ] - 1 ), length( values ) ) )
return( cummax( values )[ parti[ , 2 ] ] )
}
The use of cummax makes that pretty efficient, but if the subvector maxima are not non-decreasing, it doesn't work. The following function works (at least it did on the examples I tried):
partiMax <- function( values, seriesIdx ) {
# assume seriesIdx is increasing integer sequence beginning with 1, ending at less than or equal to length(values)
parti <- cbind( seriesIdx, c( ( seriesIdx[ -1 ] - 1 ), length( values ) ) )
return( sapply( ( 1:length(seriesIdx) ), function ( i ) {retu...