R/183_reductions_complex2real_canonicalizers_param_canon.R

Defines functions c2r_param_canon

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

## CVXPY SOURCE: reductions/complex2real/canonicalizers/param_canon.py
## Canonicalize complex Parameters -> Real_/Imag_ atom wrappers
##
## Parameters are symbolic leaves whose values are set at solve time.
## Complex2Real runs BEFORE EvalParams, so Parameters must be wrapped
## in Real_/Imag_ atoms to extract real and imaginary parts lazily.

c2r_param_canon <- function(expr, real_args, imag_args, real2imag) {
  if (is_real(expr)) {
    list(expr, NULL)
  } else if (is_imag(expr)) {
    list(NULL, Imag_(expr))
  } else {
    list(Real_(expr), Imag_(expr))
  }
}

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.