Learn R Programming

CVXR (version 1.9.1)

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

Value

A Constant object (inherits from Leaf and Expression).

Arguments

value

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

name

Optional character string name.

Examples

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

Run the code above in your browser using DataLab