summaryrefslogtreecommitdiff
path: root/modules/overloading/macros/%p_e.sci
blob: 3d8675c13d7eb81807c01c11605a834dee1f2f28 (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
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
//
// 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 f=%p_e(varargin)
    //A(i,j,k,..)

    rhs=size(varargin)
    M=varargin(rhs)

    nind=rhs-1
    dims=[]
    //check if all indexes of order greater than 2 contains only ones
    for k=3:nind
        ind=varargin(k)
        if type(ind)==2|type(ind)==129 then ind=horner(ind,1),end
        if type(ind)==4 then ind=find(ind),end
        if or(ind<>1) then error(21),end
        n=size(ind,"*")
        dims=[dims,n]
    end
    f=M(varargin(1:min(2,rhs-1)))
    k=find(dims>1)
    if k<>[] then
        dims(k($)+1:$)=[]
        N=prod(dims)
        f=mlist(["hm","dims","entries"],int32([size(f) dims]),ones(N,1).*.f(:))
    end
endfunction