0001
0002 K = length(Jk);
0003
0004 Jkp = zeros(size(Jk));
0005 Jc = zeros(1,N+1);
0006
0007
0008 for j=1:Jk(1)
0009 Jc(j) = 1;
0010 end
0011 for k=2:K
0012 for j=Jk(k-1)+1:Jk(k)
0013 Jc(j) = k;
0014 end
0015 end
0016 for j=Jk(K)+1:N+1
0017 Jc(j) = K+1;
0018 end
0019
0020
0021 for j=1:N
0022 for k = Jc(j):Jc(j+1)-1
0023 Jkp(k)=j;
0024 end
0025 end
0026
0027
0028 j0 = 0;
0029 for k=1:K
0030 if Jk(k) > j0
0031 for j=j0+1:Jk(k)
0032 Jc(j) = k;
0033 end
0034 j0=Jk(k);
0035 end
0036 end
0037 for j=j0+1:N+1
0038 Jc(j) = K+1;
0039 end
0040
0041
0042 k0 = 1;
0043 for j=1:N
0044 if Jc(j+1) > k0
0045 for k = k0:Jc(j+1)-1
0046 Jkp(k)=j;
0047 end
0048 k0 = Jc(j+1);
0049 end
0050 end
0051
0052 return
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 if k < K
0079 for k=Jc(N):K
0080 Jkp(k) = N;
0081 end
0082 end
0083
0084 return
0085
0086 j = 1;
0087 for k=1:K
0088 if j < N && Jc(j+1) < k,
0089 Jkp(k) = j;
0090 else
0091 j = j+1;
0092 Jkp(k) = j;
0093 end
0094
0095 end
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121