Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dgp2dcp/canonicalizers/geo_mean_canon.R
#####
## CVXPY SOURCE: reductions/dgp2dcp/canonicalizers/geo_mean_canon.py
## DGP canonicalizer for GeoMean: geo_mean(x, p) -> (1/sum(p)) * sum(p_i * x_i)
## In log-space, geometric mean is affine (weighted average of logs).
.dgp_geo_mean_canon <- function(expr, args) {
p_vec <- expr@p
x <- args[[1L]]
n <- length(p_vec)
out <- p_vec[1L] * x[1]
if (n > 1L) {
for (i in 2L:n) {
out <- out + p_vec[i] * x[i]
}
}
result <- (1.0 / sum(p_vec)) * out
list(result, list())
}
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.