This class represents a parameter, either scalar or a matrix.
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)
The number of rows in the parameter.
The number of columns in the parameter.
(Optional) A character string representing the name of the parameter.
(Optional) A character string indicating the sign of the parameter. Must be "ZERO", "POSITIVE", "NEGATIVE", or "UNKNOWN". Defaults to "UNKNOWN".
(Optional) A numeric element, vector, matrix, or data.frame. Defaults to NA
and may be changed with value<-
later.
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.
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.
# 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