Skip to contents

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

Examples

a <- Variable(); b <- Variable()
deep_flatten(list(a, b))
#> CVXR::VStack(Reshape(var57, c(1, 1)), Reshape(var58, c(1, 1)))