1 c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 c This file must be used under the terms of the CeCILL.
5 c This source file is licensed as described in the file COPYING, which
6 c you should have received as part of this distribution. The terms
7 c are also available at
8 c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
10 subroutine indxg(il,siz,ilr,mi,mx,lw,iopt1)
12 c Converts a scilab index variable to a vector of indices
14 c subroutine indxg(il,siz,ilr,mi,lw,iopt)
15 c il : beginning of a a scilab variable structure.
16 c siz : integer, matrix size, used for implicits index descriptions
17 c ilr : adress of first elment of resulting vector of indices in
19 c mi : size of resulting vector of indices
20 c mx : maximum value of resulting vector of indices
21 c lw : pointer to free space in stk (modified by execution)
22 c iopt1 : flag with decimal form n+10*i
23 c if n==0 null indices are accepted
24 c else null indices are rejected
26 c implicit indices ":" gives a vector istk(ilr)=1:siz, mi=siz,mx=siz
28 c implicit indice ":" gives mi=-1,mx=siz
32 integer siz,iopt1,iopt
33 double precision e1,v(3)
44 if(istk(il).lt.0) il=istk(il+1)
46 if(istk(il).eq.1.or.istk(il).eq.8) then
47 c Index is a vector of scalars
61 if (istk(il).eq.1) then
62 if(istk(il+3).ne.0) then
66 call entier(m*n,stk(l),istk(ilr))
68 call tpconv(istk(il+3),4,m*n,istk(il+4),1,istk(ilr),1)
73 if(iopt.eq.1.and.istk(ilr+i).le.0) then
77 mx=max(mx,istk(ilr+i))
106 elseif (istk(il).eq.2) then
107 c . Index is a vector of polynomial
110 if(istk(il+3).ne.0) then
124 c . evaluate it for siz
126 call ddmpev(stk(l),istk(il+8),1,e1,stk(lr),1,1,mi)
127 call entier(mi,stk(lr),istk(ilr))
131 if(istk(ilr+i).le.0) then
135 mx=max(mx,istk(ilr+i))
138 elseif (istk(il).eq.129) then
139 c . Index is an implicit polynomial vector (beg:step:end)
143 call ddmpev(stk(l),istk(il+8),1,e1,v,1,1,3)
147 c sign used to avoid integer overflow
148 if(ipas.eq.0.or.(ifin-ideb)*sign(1,ipas).lt.0) then
152 if(ipas.lt.0.and.ifin.le.0.or.ipas.gt.0.and.ideb.le.0) then
156 mi=int((abs(ifin-ideb)+1)/abs(ipas))
166 do 20 i=ideb,ifin,ipas
177 elseif (istk(il).eq.4) then
178 c . index is a boolean vector
181 c if(m*n.ne.siz) then
194 if(istk(il+2+i).eq.1) then
205 elseif (istk(il).eq.6) then
206 c . index is a boolean vector
225 if(istk(ir).gt.0) then
226 do 31 kk=0,istk(ir)-1
227 istk(ilr+mi)=1+i+(istk(ic+kk)-1)*m
234 call isort1(istk(ilr),nel,istk(ilw),1)
245 subroutine indxgc(il,siz,ilr,mi,mx,lw)
247 c Converts a scilab index variable to the complementary vector of indices
249 c subroutine indxg(il,siz,ilr,mi,lw)
250 c il : beginning of a scilab variable structure.
251 c siz : integer, matrix size, used for implicits index descriptions
252 c ilr : adress of first elment of resulting vector of indices in
254 c mi : size of resulting vector of indices
255 c mx : maximum value of resulting vector of indices
256 c lw : pointer to free space in stk (modified by execution)
259 * modification by Bruno so as to use a faster algorithm (7 May 2002)
263 integer il, siz, ilr, mi, mx, lw
272 call indxg(il,siz,ilr,mi,mx,lw,1)
289 * computes complement (part of the code modified by Bruno)
292 * 1/ a "vector" w of mi indices stored from istk(ilr)
293 * so that w=[istk(ilr), ....., istk(ilr+mi-1)] is this vector
294 * 2/ the "vector" v of indices v=[1,2,..., siz]
296 * computes the vector v minus w
297 * this new vector is stored from istk(ilc) and its final number of
298 * components will be stored in mi
306 if (k .le. siz) istk(ilc+k-1) = 0
311 if (istk(ilc+i-1) .eq. 1) then