Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dnlp2smooth/canonicalizers/log_sum_exp_canon.R
#####
## CVXPY SOURCE: reductions/dnlp2smooth/canonicalizers/log_sum_exp_canon.py
## t = log_sum_exp(x) <=> exp(t) = sum(exp(x)) <=> sum(exp(x - t)) = 1.
## Introduce v = x - t (nonpositive).
.smooth_log_sum_exp_canon <- function(expr, args) {
x <- args[[1L]]
t <- Variable(.shape(expr))
v <- Variable(.shape(x), nonpos = TRUE)
xv <- value(x)
if (!is.null(xv)) {
tv <- numeric_value(expr, list(xv))
value(t) <- tv
value(v) <- pmin(xv - as.numeric(tv), -1)
}
constraints <- list(SumEntries(Exp(v)) == 1, v == x - t)
list(t, constraints)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.