1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA - Serge STEER
3// Copyright (C) 2012 - 2016 - Scilab Enterprises
4// Copyright (C) 2018 - Samuel GOUGEON
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function s2 = %s_i_r(varargin)
14    s1 = varargin($-1)
15    s2 = varargin($)
16    //s2(i,j)=s1 s1 matrix of scalar
17    sel = 1:$-2
18    if type(varargin(2))==1 & varargin(2)==0
19        sel = 1     // linearized indices
20    end
21    num = s2.num;
22    if s1==[] then
23        den = s2.den;
24        num(varargin(sel)) = [];
25        den(varargin(sel)) = [];
26    else
27        ind = list();
28        for i = size(num),ind($+1) = 1:i; end
29        num(varargin(sel)) = s1
30        den = ones(num)
31        den(ind(:)) = s2.den;
32        den(varargin(sel)) = 1
33    end
34    s2 = rlist(num,den,s2.dt)
35endfunction
36