File: minss.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (31 lines) | stat: -rw-r--r-- 734 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [Slmin]=minss(Sl,tol)
// Copyright INRIA
[lhs,rhs]=argn(0)
flag=Sl(1);
 if flag(1)<>'lss' then error(91,1),end
 select rhs
   case 1 then tol=[]
   case 2 then tol=tol
   else error('1 or 2 inputs: sl [,tol]')
 end;
 [a,b,c,d,x0,dom]=Sl(2:7)
//
if tol<>[] then
   [nc,u1]=contr(a',c',tol)
 else
   if [a;c]==[] then reltol=0;else reltol=1.d-10*norm([a;c],1);end
   [nc,u1]=contr(a',c',[reltol,1.d-10])
end
u=u1(:,1:nc)
c=c*u;a=u'*a*u;b=u'*b,x0=u'*x0;
if tol<>[] then
  [no,u2]=contr(a,b,tol)
else
  if [a,b]==[] then reltol=0;else reltol=1.d-10*norm([a,b],1);end
  [no,u2]=contr(a,b,[reltol,1.d-10])
end
u=u2(:,1:no)
a=u'*a*u;b=u'*b;c=c*u
if lhs==1 then Slmin=syslin(dom,a,b,c,d,u'*x0),end
//Would be nice to return U=U1*U2