Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dnlp2smooth/canonicalizers/pnorm_canon.R
#####
## CVXPY SOURCE: reductions/dnlp2smooth/canonicalizers/pnorm_canon.py
## 2-norm via quad_over_lin: ||x||_2 <= t <=> quad_over_lin(x, t) <= t.
## Only p = 2 is supported.
.smooth_pnorm_canon <- function(expr, args) {
x <- args[[1L]]
p <- expr@p
shape <- .shape(expr)
t <- Variable(shape, nonneg = TRUE)
## In DNLP the expression is expected to have a value; the check yields an
## informative error later if it does not.
ev <- value(expr)
if (!is.null(ev)) value(t) <- ev
if (p == 2) {
qol <- QuadOverLin(x, t)
qol_res <- .smooth_quad_over_lin_canon(qol, .args(qol))
list(t, c(qol_res[[2L]], list(qol_res[[1L]] <= t)))
} else {
cli_abort("Only {.code p = 2} is supported as {.cls Pnorm} in DNLP.")
}
}
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.