1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
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 M=%p_i_s(varargin)
14    [lhs,rhs]=argn(0)
15    M=varargin(rhs)
16    N=varargin(rhs-1)//inserted matrix
17    index=varargin(1) //
18
19    if rhs==3&(type(index)==10|type(index)==15) then
20        M=createstruct(index,N)
21        if type(index(1))<>10 & index(2)=="entries" then
22            // change struct to cell
23            f=getfield(1,M);f(1)="ce"
24            M=setfield(1,f,M)
25        end
26    elseif rhs>4 then //more than 2 indices: insertion of a polynomial in an  matrix of numbers
27        M=varargin($)
28        M=matrix(M(:), size(M))
29        varargin($)=M;
30        M=generic_i_hm(0,varargin(:))
31    else
32        //should not occurs (hard coded case)
33    end
34endfunction
35