summaryrefslogtreecommitdiff
path: root/macros/lsqnonneg.sci
diff options
context:
space:
mode:
authorHarpreet2015-12-16 16:28:46 +0530
committerHarpreet2015-12-16 16:28:46 +0530
commitfd86d04fdabb5719fff776af7dafe8f42dc39141 (patch)
treec8bb276467993592fe61873268eef3462825af13 /macros/lsqnonneg.sci
parent436f0daf6e4f241b8fa582a943bad09ddc091f59 (diff)
downloadFOSSEE-Optimization-toolbox-fd86d04fdabb5719fff776af7dafe8f42dc39141.tar.gz
FOSSEE-Optimization-toolbox-fd86d04fdabb5719fff776af7dafe8f42dc39141.tar.bz2
FOSSEE-Optimization-toolbox-fd86d04fdabb5719fff776af7dafe8f42dc39141.zip
Bugs from lsqlin and lsqnonneg fixed
Diffstat (limited to 'macros/lsqnonneg.sci')
-rw-r--r--macros/lsqnonneg.sci14
1 files changed, 6 insertions, 8 deletions
diff --git a/macros/lsqnonneg.sci b/macros/lsqnonneg.sci
index c65b1ba..77e5e44 100644
--- a/macros/lsqnonneg.sci
+++ b/macros/lsqnonneg.sci
@@ -134,18 +134,16 @@ function [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg (varargin)
[xopt,fopt,status,iter,Zl,Zu,lmbda] = solveqp(nbVar,nbCon,Q,p,conMatrix,conLB,conUB,LB,UB,x0,options);
xopt = xopt';
- residual = C*xopt-d;
+ residual = -1*(C*xopt-d);
resnorm = residual'*residual;
exitflag = status;
output = struct("Iterations" , []);
output.Iterations = iter;
- lambda = struct("lower" , [], ..
- "upper" , [], ..
- "constraint" , []);
-
- lambda.lower = Zl;
- lambda.upper = Zu;
- lambda.constraint = lmbda;
+ lambda = struct("lower" , [], ..
+ "upper" , []);
+
+ lambda.lower = Zl;
+ lambda.upper = Zu;
select status
case 0 then