Cumulative Sum
The cumulative sum, ∑_{i=1}^k x_i for k=1,…,n.
When calling cumsum
, matrices are automatically flattened into column-major order before the sum is taken.
cumsum_axis(expr, axis = 2) ## S4 method for signature 'Expression' cumsum(x)
axis |
(Optional) The dimension across which to apply the function: |
x, expr |
An Expression, vector, or matrix. |
val <- cbind(c(1,2), c(3,4)) value(cumsum(Constant(val))) value(cumsum_axis(Constant(val))) x <- Variable(2,2) prob <- Problem(Minimize(cumsum(x)[4]), list(x == val)) result <- solve(prob) result$value result$getValue(cumsum(x))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.