R/207_reductions_dgp2dcp_canonicalizers_norm1_canon.R

Defines functions .dgp_norm1_canon

#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dgp2dcp/canonicalizers/norm1_canon.R
#####

## CVXPY SOURCE: reductions/dgp2dcp/canonicalizers/norm1_canon.py
## DGP canonicalizer for Norm1: ||x||_1 -> sum(x) in log-space
## Since args are already in log-space and all positive, |x_i| = x_i.

.dgp_norm1_canon <- function(expr, args) {
  ## Delegate to sum canonicalizer (matching CVXPY)
  tmp <- SumEntries(args[[1L]], axis = expr@axis, keepdims = expr@keepdims)
  .dgp_sum_canon(tmp, tmp@args)
}

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.