R/078_atoms_affine_vec.R

Defines functions vec

Documented in vec

#####
## DO NOT EDIT THIS FILE!! EDIT THE SOURCE INSTEAD: rsrc_tree/atoms/affine/vec.R
#####

## CVXPY SOURCE: atoms/affine/vec.py
## Vec -- vectorize (flatten to column vector)

#' Vectorize an expression (column vector)
#'
#' Reshapes an expression into a column vector of shape (n*m, 1).
#'
#' @param x An Expression or numeric value.
#' @returns A Reshape atom (column vector).
#' @export
vec <- function(x) {
  x <- as_expr(x)
  Reshape(x, c(expr_size(x), 1L), order = "F")
}

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.