Learn R Programming

CVXR (version 1.9.2)

deep_flatten: 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)

Value

An Expression of shape c(n, 1).

Arguments

x

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

See Also

vec(), vdot()

Examples

Run this code
a <- Variable(); b <- Variable()
deep_flatten(list(a, b))

Run the code above in your browser using DataLab