Subversion Repositories wimsdev

Rev

Rev 7692 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
13586 bpr 2
  !goto proc
20 reyssat 3
!endif
4161 bpr 4
 
4330 bpr 5
slib_author=Adeline, Grelot; Bernadette, PERRIN-RIOU
4161 bpr 6
 
20 reyssat 7
slib_example=[2,-7,6]\
8
[2,-7,6;1,1,4]\
9
[2,1;-7,1;6,4]\
10
[2,-7,6],[1,1,4]
11
 
12
!exit
13
 
14
:proc
15
 
16
!readproc slib/stat/dataproc $wims_read_parm
13586 bpr 17
slib_cnt=!itemcnt item $slib_data
20 reyssat 18
!if $slib_cnt=0
13586 bpr 19
  slib_out=0
20 reyssat 20
!else
13586 bpr 21
  !if $slib_weight<>$empty
22
    slib_d=$empty
23
    !for slib_i =1 to $slib_cnt
24
      slib_w=!item $slib_i of $slib_weight
25
      slib_j=!item $slib_i of $slib_data
26
      slib_r = !values $slib_j for x=1 to $slib_w
27
      slib_d=!append item $slib_r to $slib_d
28
    !next slib_i
29
  slib_data=$slib_d
30
  slib_cnt=!itemcnt item $slib_data
31
  !endif
32
  slib_fml=$empty
20 reyssat 33
 
13586 bpr 34
  !for slib_t in  $slib_data
35
    !!slib_t=!item $slib_i of $slib_data
36
    slib_fml=!append item $[$slib_t] to $slib_fml
37
  !next slib_i
38
  slib_fml=!sort numeric item $slib_fml
39
  !if $[$slib_cnt%2]=1
40
    slib_out=!item $[($slib_cnt+1)/2] of $slib_fml
41
  !else
42
    slib_t1=!item $[$slib_cnt/2] of $slib_fml
43
    slib_t2=!item $[$slib_cnt/2+1] of $slib_fml
44
    slib_out=$[($slib_t1+$slib_t2)/2]
45
  !endif
7692 bpr 46
!endif
20 reyssat 47
slib_out =!trim $slib_out