R/057_atoms_elementwise_exp.R

#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/atoms/elementwise/exp.R
#####

## CVXPY SOURCE: atoms/elementwise/exp.py
## Exp -- elementwise exponential exp(x)


Exp <- new_class("Exp", parent = Elementwise, package = "CVXR",
  constructor = function(x, id = NULL) {
    if (is.null(id)) id <- next_expr_id()
    x <- as_expr(x)
    shape <- x@shape
    obj <- new_object(S7_object(),
      id    = as.integer(id),
      .cache = new.env(parent = emptyenv()),
      args  = list(x),
      shape = shape
    )
    validate_arguments(obj)
    obj
  }
)

# -- sign: always positive ----------------------------------------
method(sign_from_args, Exp) <- function(x) {
  list(is_nonneg = TRUE, is_nonpos = FALSE)
}

# -- curvature: convex --------------------------------------------
method(is_atom_convex, Exp) <- function(x) TRUE
method(is_atom_concave, Exp) <- function(x) FALSE

# -- monotonicity: always increasing ------------------------------
method(is_incr, Exp) <- function(x, idx, ...) TRUE
method(is_decr, Exp) <- function(x, idx, ...) FALSE

# -- log-log: convex (CVXPY exp.py lines 52-60) ------------------
method(is_atom_log_log_convex, Exp) <- function(x) TRUE
method(is_atom_log_log_concave, Exp) <- function(x) FALSE

# -- numeric ------------------------------------------------------
method(numeric_value, Exp) <- function(x, values, ...) {
  exp(values[[1L]])
}

# -- graph_implementation: stub -----------------------------------
method(graph_implementation, Exp) <- function(x, arg_objs, shape, data = NULL, ...) {
  cli_abort("graph_implementation for {.cls Exp} not yet implemented.")
}

Try the CVXR package in your browser

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

CVXR documentation built on March 6, 2026, 9:10 a.m.