This class represents a constant.
Constant(value)# S4 method for Constant
as.character(x)
# S4 method for Constant
constants(object)
# S4 method for Constant
get_data(object)
# S4 method for Constant
value(object)
# S4 method for Constant
grad(object)
# S4 method for Constant
size(object)
# S4 method for Constant
is_positive(object)
# S4 method for Constant
is_negative(object)
# S4 method for Constant
canonicalize(object)
as.Constant(expr)
A numeric element, vector, matrix, or data.frame. Vectors are automatically cast into a matrix column.
constants
: Returns itself as a constant.
get_data
: A list with the value of the constant.
value
: The value of the constant.
grad
: An empty list since the gradient of a constant is zero.
size
: The c(row, col)
dimensions of the constant.
is_positive
: A logical value indicating whether all elemenets of the constant are non-negative.
is_negative
: A logical value indicating whether all elemenets of the constant are non-positive.
canonicalize
: The canonical form of the constant.
value
A numeric element, vector, matrix, or data.frame. Vectors are automatically cast into a matrix column.
is_1D_array
(Internal) A logical value indicating whether the value is a vector or 1-D matrix.
sparse
(Internal) A logical value indicating whether the value is a sparse matrix.
size
(Internal) A vector of containing the number of rows and columns.
is_pos
(Internal) A logical value indicating whether all elements are non-negative.
is_neg
(Internal) A logical value indicating whether all elements are non-positive.
# NOT RUN {
x <- Constant(5)
y <- Constant(diag(3))
get_data(y)
value(y)
is_positive(y)
size(y)
as.Constant(y)
# }
Run the code above in your browser using DataLab