Learn R Programming

CVXR (version 0.99-7)

Parameter-class: The Parameter class.

Description

This class represents a parameter, either scalar or a matrix.

Usage

Parameter(rows = 1, cols = 1, name = NA_character_, sign = UNKNOWN,
  value = NA_real_)

# S4 method for Parameter as.character(x)

# S4 method for Parameter get_data(object)

# S4 method for Parameter name(object)

# S4 method for Parameter size(object)

# S4 method for Parameter is_positive(object)

# S4 method for Parameter is_negative(object)

# S4 method for Parameter grad(object)

# S4 method for Parameter parameters(object)

# S4 method for Parameter value(object)

# S4 method for Parameter value(object) <- value

# S4 method for Parameter canonicalize(object)

Arguments

rows

The number of rows in the parameter.

cols

The number of columns in the parameter.

name

(Optional) A character string representing the name of the parameter.

sign

(Optional) A character string indicating the sign of the parameter. Must be "ZERO", "POSITIVE", "NEGATIVE", or "UNKNOWN". Defaults to "UNKNOWN".

value

(Optional) A numeric element, vector, matrix, or data.frame. Defaults to NA and may be changed with value<- later.

x, object

A '>Parameter object.

Methods (by generic)

  • get_data: Returns list(rows, cols, name, sign string, value).

  • name: The name of the parameter.

  • size: The c(rows, cols) dimensions of the parameter.

  • is_positive: Is the parameter non-negative?

  • is_negative: Is the parameter non-positive?

  • grad: An empty list since the gradient of a parameter is zero.

  • parameters: Returns itself as a parameter.

  • value: The value of the parameter.

  • value<-: Set the value of the parameter.

  • canonicalize: The canonical form of the parameter.

Slots

id

(Internal) A unique integer identification number used internally.

rows

The number of rows in the parameter.

cols

The number of columns in the parameter.

name

(Optional) A character string representing the name of the parameter.

sign_str

A character string indicating the sign of the parameter. Must be "ZERO", "POSITIVE", "NEGATIVE", or "UNKNOWN".

value

(Optional) A numeric element, vector, matrix, or data.frame. Defaults to NA and may be changed with value<- later.

Examples

Run this code
# NOT RUN {
x <- Parameter(3, name = "x0", sign="NEGATIVE") ## 3-vec negative
is_positive(x)
is_negative(x)
size(x)
# }

Run the code above in your browser using DataLab