summaryrefslogtreecommitdiff
path: root/modules/overloading/macros/%lss_i_lss.sci
blob: ae9eca09e13406d59438f1df157341c2e0e13b06 (plain)
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
32
33
34
35
36
37
38
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA - Serge Steer
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

function s=%lss_i_lss(i,j,s1,s2)
    //%lss_i_lss(i,j,s1,s2) <=>  s2(i,j)=s1
    //!
    if type(i)==10|type(j)==10 then
        error(21)
    end
    [s1 s2]=sysconv(s1,s2)
    [m1,p1]=size(s1(5));[m2,p2]=size(s2(5));

    if size(i)==[-1,-1] then i=1:m2,end
    if size(j)==[-1,-1] then j=1:p2,end
    if max(i)>m2 then
        s2=[s2;0*ones(max(i)-m2,p2)]
        [m2,p2]=size(s2(5));
    end
    if max(j)>p2 then
        s2=[s2,0*ones(m2,max(j)-p2)]
        [m2,p2]=size(s2(5));
    end
    jj=0*ones(1,p2);jj(j)=ones(1,prod(size(j)));
    ii=0*ones(1,m2);ii(i)=ones(1,prod(size(i)));
    s=diag(ones(ii)-ii)*s2*diag(jj)+s2*diag(ones(jj)-jj)
    ii1=0*ones(m2,m1);ii1(m2-m1+1:m2,:)=eye(m1,m1)
    ii1=ii1([find(ii==0),i],:)
    jj1=0*ones(p1,p2);jj1(:,p2-p1+1:p2)=eye(p1,p1)
    jj1=jj1(:,[find(jj==0),j])
    s=s+ii1*s1*jj1
    s=minss(s)
endfunction