cvxr

R CVXR matrix multiplication %*% Error in mul_dims_promote(lh_dim, rh_dim) : Incompatible dimensions

爱⌒轻易说出口 提交于 2020-04-14 11:52:46
问题 Hello I am trying to run the example from here: http://rtutorial.altervista.org/lp_solvers.html A snippet and test where it goes wrong: library(CVXR) #create Variable objects that can be manipulated by the solver. x<-Variable(3) #coefficients for objective function C<-c(2,4,3) #problem: C %*% x Error: Error in mul_dims_promote(lh_dim, rh_dim) : Incompatible dimensions > x [1] "Variable((3, 1), nonneg=FALSE, nonpos=FALSE, pos=FALSE, neg=FALSE, complex=FALSE, imag=FALSE, symmetric=FALSE, diag

Log_sum_exp of a convex function is not dcp compliant?

戏子无情 提交于 2020-01-06 04:42:12
问题 I have a convex function f(b): f(b) = log(pi) - lambda * log( t(r) %*% b) dim(pi) = (n,1), lambda is a scalar constant, dim(r) = (n,n) b is the parameter, dim(b) = (n,1) The call to is_convex(f) is_dcp(f) both return TRUE. However, I don’t understand why the following returns FALSE: is_dcp(log_sum_exp(f)) As far as I understand, log_sum_exp of a convex function is convex? I noticed that both is_convex(f) and is_concave(f) return FALSE. So it seems like CVRX is unable to deduce the convexity