On 5/10/2013 1:58 PM, Haemish wrote: > When I code for fmincon, I makes a ctr.m as follows; > > ... > ceq=~~ > cd=; > if nargout > 2 > dceq=2178*1090 matrix > dc=; > ... > > But dceq above is too large and sparse that the calculation time is so > long and sometimes the system stops. > > I think that to use sparse matrix and coding as follow seem to be the > solution > > ... > ceq=~~ > cd=; > if nargout > 2 > dceq=2178*1090 matrix > dceq=sparse(dceq); > dc=; > ... > > But the calculation is still so slow. > > Are there any problems on my soluation > > Thank you.
You should be doing sparse internal calculations for your dceq function, not doing a nonsparse calculation and then returning a sparse solution. What I mean is, you should not have to call sparse(dceq) because your constraint gradient should already be sparse. And you should be sure to set GradObj and GradCon to 'on' in the options.