Constant: Create a Constant Expression

ConstantR Documentation

Create a Constant Expression

Description

Wraps a numeric value as a CVXR constant for use in optimization expressions. Constants are typically created implicitly when combining numeric values with CVXR expressions via arithmetic operators.

Usage

Constant(value, name = NULL)

Arguments

value

A numeric scalar, vector, matrix, or sparse matrix.

name

Optional character string name.

Value

A Constant object (inherits from Leaf and Expression).

Examples

c1 <- Constant(5)
c2 <- Constant(matrix(1:6, 2, 3))


CVXR documentation built on March 6, 2026, 9:10 a.m.