I am trying to solve the following problem in CVXR. Here y is an n by m matrix, x is n by G by m and b is m by G.
b<- Variable(m,G)
b_transpose <- t(b)
expr<-sapply(1:m, function(i) x[,,i] %*% b_transpose[,i])
obj<- sum_squares(y-expr)
prob<- Problem(Minimize(obj))
I get the following error: Error in y - expr : non-numeric argument to binary operator.
I believe I am not passing the n by m matrix expr
in a way that CVXR expects. Any help will be deeply appreciated. Thanks!