Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cummax_axis

Cumulative Maximum


Description

The cumulative maximum, \max_{i=1,…,k} x_i for k=1,…,n. When calling cummax, matrices are automatically flattened into column-major order before the max is taken.

Usage

cummax_axis(expr, axis = 2)

## S4 method for signature 'Expression'
cummax(x)

Arguments

axis

(Optional) The dimension across which to apply the function: 1 indicates rows, and 2 indicates columns. The default is 2.

x, expr

An Expression, vector, or matrix.

Examples

val <- cbind(c(1,2), c(3,4))
value(cummax(Constant(val)))
value(cummax_axis(Constant(val)))

x <- Variable(2,2)
prob <- Problem(Minimize(cummax(x)[4]), list(x == val))
result <- solve(prob)
result$value
result$getValue(cummax(x))

CVXR

Disciplined Convex Optimization

v1.0-10
Apache License 2.0 | file LICENSE
Authors
Anqi Fu [aut, cre], Balasubramanian Narasimhan [aut], David W Kang [aut], Steven Diamond [aut], John Miller [aut], Stephen Boyd [ctb], Paul Kunsberg Rosenfield [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.