Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/reductions/dcp2cone/canonicalizers/log_det_canon.R
#####
## CVXPY SOURCE: reductions/dcp2cone/canonicalizers/log_det_canon.py
## log_det(A) -> sum(log(d)) subject to PSD([[D, Z], [Z^T, A]]),
## where Z = vec_to_upper_tri(z, strict=FALSE), d = diag_mat(Z), D = diag_vec(d)
## Then log(d) is further canonicalized via log_canon -> ExpCone constraints
log_det_canon <- function(expr, args, solver_context = NULL) {
A <- args[[1L]]
n <- A@shape[1L]
## z: vector for the upper triangle (including diagonal)
z_len <- (n * (n + 1L)) %/% 2L
z <- Variable(c(z_len, 1L))
Z <- vec_to_upper_tri(z, strict = FALSE)
d <- DiagMat(Z) ## extract diagonal as a vector (n,1)
D <- DiagVec(d) ## create diagonal matrix from vector (n,n)
## Block matrix constraint
X <- bmat(list(list(D, Z), list(t(Z), A)))
constraints <- list(PSD(X))
## Recursive canonicalization of log(d) -> ExpCone
log_expr <- Log(d)
log_result <- log_canon(log_expr, log_expr@args)
log_obj <- log_result[[1L]]
log_constr <- log_result[[2L]]
constraints <- c(constraints, log_constr)
list(sum_entries(log_obj), constraints)
}
method(dcp_canonicalize, LogDet) <- log_det_canon
method(has_dcp_canon, LogDet) <- 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.