Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dnlp2smooth/canonicalizers/geo_mean_canon.R
#####
## CVXPY SOURCE: reductions/dnlp2smooth/canonicalizers/geo_mean_canon.py
## geo_mean(x; w) via the log-domain: t >= 0, log(t) == sum(w .* log(x)).
.dnlp_geomean_MIN_INIT <- 1e-3
.smooth_geo_mean_canon <- function(expr, args) {
t <- Variable(.shape(expr), nonneg = TRUE)
v <- value(args[[1L]])
if (!is.null(v)) {
value(t) <- max(numeric_value(expr, list(v)), .dnlp_geomean_MIN_INIT)
}
weights <- as.numeric(expr@w)
log_expr <- Log(args[[1L]])
## NOTE (matches CVXPY): log_canon is passed the ORIGINAL expr@args, not the
## already-canonicalized `args`.
lc <- .smooth_log_canon(log_expr, .args(expr))
var <- lc[[1L]]
list(t, c(list(Log(t) == SumEntries(weights * var)), lc[[2L]]))
}
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.