sum_squares | R Documentation |
The sum of the squared entries in a vector or matrix.
sum_squares(expr)
expr |
An Expression, vector, or matrix. |
An Expression representing the sum of squares of the input.
set.seed(212)
m <- 30
n <- 20
A <- matrix(stats::rnorm(m*n), nrow = m, ncol = n)
b <- matrix(stats::rnorm(m), nrow = m, ncol = 1)
x <- Variable(n)
obj <- Minimize(sum_squares(A %*% x - b))
constr <- list(0 <= x, x <= 1)
prob <- Problem(obj, constr)
result <- solve(prob)
result$value
result$getValue(x)
result$getDualValue(constr[[1]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.