Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dcp2cone/canonicalizers/quad/quad_form_canon.R
#####
## CVXPY SOURCE: reductions/dcp2cone/canonicalizers/quad/quad_form_canon.py
## If x is a Variable, wrap directly. Otherwise add equality constraint.
quad_form_quad_canon <- function(expr, args, solver_context = NULL) {
affine_expr <- args[[1L]]
P <- args[[2L]]
if (.s7_is(affine_expr, Variable)) {
list(SymbolicQuadForm(affine_expr, P, expr), list())
} else {
t <- Variable(shape = .shape(affine_expr))
list(SymbolicQuadForm(t, P, expr), list(affine_expr == t))
}
}
method(quad_canonicalize, QuadForm) <- quad_form_quad_canon
## Membership marker for the CSE cache: `affine_above` is part of a subtree's
## cache key only when the quad branch could fire inside it
## (`.affine_above_relevant`, dcp2cone.R). CVXPY reads this off its
## `quad_canon_methods` dict; CVXR needs an explicit predicate per class.
method(has_quad_canon, QuadForm) <- function(expr) TRUE
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.