==Around line 120 of msmf_corr_coeff solving LP problems==
For a large R, e.g. R = 200, solve 200 linear programming problems in parallel should be beneficial, especially when the each LP itself is easy to solve (takes less than 0.1 seconds each). Initially we managed to use gurobi inside a parfor:
% Gurobi inisde parfor. For large R (>100). By Wei.
model.rhs = [full(constrB); full(constrM)];
model.A = [sparse(B);sparse(-B)];
model.ub = ones(L,1);
model.lb = zeros(L,1);
model.sense = '<';
for r = 1 : R
% solve_LP is a function wrapper. It calls gurobi to solve a single LP.
asgr(:,r) = solve_LP(r,f,model);
end
% The function wrapper to use Gurobi
function X = solve_LP(r,f,model)
model.obj = f(:,r);
parameters.outputflag = 0;
result = gurobi(model, parameters);
X = result.x;
end