deep_flatten: Recursively flatten a nested list of expressions into one...

View source: R/049_atoms_affine_reshape.R

deep_flattenR Documentation

Recursively flatten a nested list of expressions into one column vector

Description

Flattens x into a single column vector. An Expression or numeric is vectorized column-major; a list is flattened element by element and the pieces stacked in order, recursively. This is what lets vdot() accept nested lists: vdot(list(a, b), c(1, 2)) is a * 1 + b * 2.

Usage

deep_flatten(x)

Arguments

x

An Expression, a numeric value, or a (possibly nested) list of them.

Value

An Expression of shape c(n, 1).

See Also

vec(), vdot()

Examples

a <- Variable(); b <- Variable()
deep_flatten(list(a, b))

CVXR documentation built on Aug. 24, 2026, 9:10 a.m.