Nothing
#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/atoms/affine/hstack.R
#####
## CVXPY SOURCE: atoms/affine/hstack.py
## HStack -- horizontal concatenation of expressions
HStack <- new_class("HStack", parent = AffAtom, package = "CVXR",
constructor = function(..., id = NULL) {
if (is.null(id)) id <- next_expr_id()
all_args <- lapply(list(...), as_expr)
if (length(all_args) == 0L) {
cli_abort("{.cls HStack} requires at least one argument.")
}
## Compute shape: same rows, sum of cols
rows <- all_args[[1L]]@shape[1L]
total_cols <- 0L
for (arg in all_args) {
if (arg@shape[1L] != rows) {
cli_abort("All arguments to {.fn hstack} must have the same number of rows.")
}
total_cols <- total_cols + arg@shape[2L]
}
shape <- c(rows, total_cols)
obj <- new_object(S7_object(),
id = as.integer(id),
.cache = new.env(parent = emptyenv()),
args = all_args,
shape = shape
)
obj
}
)
method(shape_from_args, HStack) <- function(x) {
rows <- x@args[[1L]]@shape[1L]
total_cols <- sum(vapply(x@args, function(a) a@shape[2L], integer(1)))
c(rows, total_cols)
}
# -- log-log: affine (CVXPY hstack.py) ---------------------------
method(is_atom_log_log_convex, HStack) <- function(x) TRUE
method(is_atom_log_log_concave, HStack) <- function(x) TRUE
method(numeric_value, HStack) <- function(x, values, ...) {
do.call(cbind, values)
}
method(graph_implementation, HStack) <- function(x, arg_objs, shape, data = NULL, ...) {
list(hstack_linop(arg_objs, shape), list())
}
#' Horizontal concatenation of expressions
#'
#' @param ... Expressions (same number of rows)
#' @returns An HStack atom
#' @export
hstack <- function(...) {
HStack(...)
}
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.