Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/utilities/perspective_utils.R
#####
## CVXPY SOURCE: utilities/perspective_utils.py
## form_cone_constraint -- reconstruct cone constraint from vectorized form
##
## Given an expression z (column vector) and an original cone constraint,
## construct the corresponding CVXR cone constraint on z.
## CVXPY SOURCE: perspective_utils.py lines 28-58
.form_cone_constraint <- function(z, constraint) {
sz <- constr_size(constraint)
if (S7_inherits(constraint, SOC)) {
## SOC(t, X): first element is t, rest is X
SOC(z[1], z[2:sz])
} else if (S7_inherits(constraint, NonNeg)) {
## Nonnegative cone
z >= 0
} else if (S7_inherits(constraint, ExpCone)) {
## Exponential cone: split into thirds
n <- sz
step <- n %/% 3L
ExpCone(z[1:step], z[(step + 1L):(2L * step)], z[(2L * step + 1L):n])
} else if (S7_inherits(constraint, Zero)) {
## Zero cone (equality)
z == 0
} else if (S7_inherits(constraint, PSD)) {
## PSD: reshape vector to square matrix
N <- sz
n <- as.integer(sqrt(N))
z_mat <- Reshape(z, c(n, n), order = "F")
PSD(z_mat)
} else {
cli_abort(
"Unsupported cone constraint type for perspective: {.cls {sub('.*::', '', class(constraint)[[1L]])}}."
)
}
}
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.