CVX Forum: a community-driven support forum
Latest Categories Search
Home / Uncategorized / Pairwise Differences in CVX

Pairwise Differences in CVX

Uncategorized
Oct 11, 2013
K
Kevin L. Keys
Oct 11, 2013 #1

If I want CVX to give me the pairwise differences of the elements of a vector X, what is the most efficient way to do so? In standard MATLAB I would normally use bsxfun(@minus, X, X'), but CVX objects do not support bsxfun).

M
Michael C. Grant
Oct 14, 2013 #2

If X is a column vector, this will work:

X*ones(size(X))' - ones(size(X))*X'

Archive of CVX Forum: a community-driven support forum — Generated as a static archive