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

prod_entries

Product of Entries


Description

The product of entries in a vector or matrix.

Usage

prod_entries(..., axis = NA_real_, keepdims = FALSE)

## S3 method for class 'Expression'
prod(..., na.rm = FALSE)

Arguments

...

Numeric scalar, vector, matrix, or Expression objects.

axis

(Optional) The dimension across which to apply the function: 1 indicates rows, 2 indicates columns, and NA indicates rows and columns. The default is NA.

keepdims

(Optional) Should dimensions be maintained when applying the atom along an axis? If FALSE, result will be collapsed into an n x 1 column vector. The default is FALSE.

na.rm

(Unimplemented) A logical value indicating whether missing values should be removed.

Details

This atom is log-log affine, but it is neither convex nor concave.

Value

An Expression representing the product of the entries of the input.

Examples

n <- 2
X <- Variable(n, n, pos=TRUE)
obj <- sum(X)
constraints <- list(prod_entries(X) == 4)
prob <- Problem(Minimize(obj), constraints)
result <- solve(prob, gp=TRUE)
result$value
result$getValue(X)

n <- 2
X <- Variable(n, n, pos=TRUE)
obj <- sum(X)
constraints <- list(prod(X) == 4)
prob <- Problem(Minimize(obj), constraints)
result <- solve(prob, gp=TRUE)
result$value

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.