Subversion Repositories wimsdev

Rev

Rev 7692 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7692 Rev 13586
Line 1... Line 1...
1
!if $wims_read_parm!=slib_header
1
!if $wims_read_parm!=slib_header
2
 !goto proc
2
  !goto proc
3
!endif
3
!endif
4
 
4
 
5
slib_parms=2\
5
slib_parms=2\
6
 ,[x_1,...,x_n]\
6
 ,[x_1,...,x_n]\
7
 ,[a_1,...,a_m]
7
 ,[a_1,...,a_m]
Line 19... Line 19...
19
 
19
 
20
slib_v=!declosing $slib_data
20
slib_v=!declosing $slib_data
21
slib_w=!declosing $slib_weight
21
slib_w=!declosing $slib_weight
22
 
22
 
23
!if $slib_v$slib_w=$empty
23
!if $slib_v$slib_w=$empty
24
	slib_out=0
24
  slib_out=0
25
	!exit
25
	!exit
26
!else
26
!else
27
	slib_v=!sort numeric item  of $slib_v
27
	slib_v=!sort numeric item  of $slib_v
28
	slib_max=!item -1 of $slib_v
28
	slib_max=!item -1 of $slib_v
29
	slib_min=!item 1 of $slib_v
29
	slib_min=!item 1 of $slib_v
Line 49... Line 49...
49
		slib_w= !listuniq $slib_w
49
		slib_w= !listuniq $slib_w
50
	!endif
50
	!endif
51
	slib_cpt=0
51
	slib_cpt=0
52
	slib_cntw=!itemcnt $slib_w
52
	slib_cntw=!itemcnt $slib_w
53
	slib_wpointer=2
53
	slib_wpointer=2
54
# end est le point de separation
54
  # end est le point de separation
55
	slib_end=!item $slib_wpointer of $slib_w
55
	slib_end=!item $slib_wpointer of $slib_w
56
	slib_result=
56
	slib_result=
57
	!for slib_i=1 to $slib_cnt
57
	!for slib_i=1 to $slib_cnt
58
		 slib_dat=!item $slib_i of $slib_v
58
		slib_dat=!item $slib_i of $slib_v
59
		 !if $slib_dat<$slib_end or ($slib_dat=$slib_max and $slib_wpointer=$slib_cntw)
59
		!if $slib_dat<$slib_end or ($slib_dat=$slib_max and $slib_wpointer=$slib_cntw)
60
  # On est toujours dans le meme intervalle
60
      # On est toujours dans le meme intervalle
61
 			 !advance slib_cpt
61
 			!advance slib_cpt
62
 		!else
62
 		!else
63
  # Le point de separation franchi
63
      # Le point de separation franchi
64
  # creer un nouveau point de separation
64
      # creer un nouveau point de separation
65
:point
65
      :point
66
  			!advance slib_wpointer
66
  		!advance slib_wpointer
67
 			slib_end=!item $slib_wpointer of $slib_w
67
 			slib_end=!item $slib_wpointer of $slib_w
68
 			!if $slib_wpointer < $slib_cntw
68
 			!if $slib_wpointer < $slib_cntw
69
 				slib_end1=!item $[$slib_wpointer+1] of $slib_w
69
 				slib_end1=!item $[$slib_wpointer+1] of $slib_w
70
 			!else
70
 			!else
71
				 slib_end1=$slib_end+2
71
				slib_end1=$slib_end+2
72
			 !endif
72
			!endif
73
				 slib_result=!append item $[$slib_cpt/$slib_cnt] to $slib_result
73
			slib_result=!append item $[$slib_cpt/$slib_cnt] to $slib_result
74
			!if $slib_dat>=$slib_end1
74
			!if $slib_dat>=$slib_end1
75
 				slib_cpt=0
75
 			  slib_cpt=0
76
				!goto point
76
			  !goto point
77
			!else
77
			!else
78
				slib_cpt=1
78
				slib_cpt=1
79
			!endif
79
			!endif
80
		!endif
80
		!endif
81
	!next slib_i
81
	!next slib_i
82
#Le dernier intervalle
82
  #Le dernier intervalle
83
	slib_result=!append item $[$slib_cpt/$slib_cnt] to $slib_result
83
	slib_result=!append item $[$slib_cpt/$slib_cnt] to $slib_result
84
 
84
 
85
	!if $[$slib_wpointer+1] <=$slib_cntw
85
	!if $[$slib_wpointer+1] <=$slib_cntw
86
		slib_zero=!values 0 for x=$[$slib_wpointer+1] to $slib_cntw
86
		slib_zero=!values 0 for x=$[$slib_wpointer+1] to $slib_cntw
87
		slib_result=$slib_result,$slib_zero
87
		slib_result=$slib_result,$slib_zero