File: minss.sci

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (31 lines) | stat: -rw-r--r-- 727 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)
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)
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
endfunction