Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Parameter-class

The Parameter class.


Description

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

Usage

Parameter(
  rows = NULL,
  cols = NULL,
  name = NA_character_,
  value = NA_real_,
  ...
)

## S4 method for signature 'Parameter'
get_data(object)

## S4 method for signature 'Parameter'
name(x)

## S4 method for signature 'Parameter'
value(object)

## S4 replacement method for signature 'Parameter'
value(object) <- value

## S4 method for signature 'Parameter'
grad(object)

## S4 method for signature 'Parameter'
parameters(object)

## S4 method for signature '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.

value

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

...

Additional attribute arguments. See Leaf for details.

object, x

A Parameter object.

Methods (by generic)

  • get_data: Returns list(dim, name, value, attributes).

  • name: The name of the parameter.

  • value: The value of the parameter.

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

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

  • parameters: Returns itself as a parameter.

  • canonicalize: The canonical form of the parameter.

Slots

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.

value

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

Examples

x <- Parameter(3, name = "x0", nonpos = TRUE) ## 3-vec negative
is_nonneg(x)
is_nonpos(x)
size(x)

CVXR

Disciplined Convex Optimization

v1.0-10
Apache License 2.0 | file LICENSE
Authors
Anqi Fu [aut, cre], Balasubramanian Narasimhan [aut], David W Kang [aut], Steven Diamond [aut], John Miller [aut], Stephen Boyd [ctb], Paul Kunsberg Rosenfield [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.