Home > vbmeg > functions > estimation > bayes > dynamics > mex-programs > sp_get_index.m

sp_get_index

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 K = length(Jk);
0003 
0004 Jkp = zeros(size(Jk));
0005 Jc  = zeros(1,N+1);
0006 
0007 % --- Jc
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 % --- Jk
0021 for j=1:N
0022     for k = Jc(j):Jc(j+1)-1
0023         Jkp(k)=j;
0024     end
0025 end
0026 
0027 % --- Jc
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 % --- Jk
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 %for k=1:K
0055 %    if Jk(k) > j
0056 %        for jj=j+1:Jk(k)
0057 %            Jc(jj) = k;
0058 %        end
0059 %        j = Jk(k);
0060 %    end
0061 %end
0062 
0063 %for jj=j+1:N+1
0064 %    Jc(jj) = k+1;
0065 %end
0066 
0067 %
0068 %k0 = 1;
0069 %for j=1:N
0070 %    if Jc(j) > k0
0071 %        for k=k0:Jc(j)-1
0072 %            Jkp(k) = j-1;
0073 %        end
0074 %        k0=Jc(j);
0075 %    end
0076 %end
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 %    Jkp(k) = j;
0095 end
0096 
0097 %for k=1:K
0098 %    if Jk(k) > j
0099 %        for jj=j:Jk(k)-1
0100 %            Jc(jj) = Jc(j);
0101 %        end
0102 %        j = Jk(k);
0103 %        Jc(j) = k;
0104 %    end
0105 %end
0106 
0107 
0108 %k   0  1  2
0109 %j   1  2  4
0110 %
0111 %j   1  2  3  4  5  6  7  8  9 [matlab]
0112 %j   0  1  2  3  4  5  6  7  8
0113 %jc  0  0 <1 <2  2 <3  3  3  3
0114 %
0115 %    for (k=0; (k < nzmax ); k++) {
0116 %      if Jk[k] > j{
0117 %          for ((j < Jk[k]); j++){
0118 %              jcs[j] = k-1;
0119 %          }
0120 %      }
0121 %    }

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005