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

get_AtQA_index

PURPOSE ^

Sparse matrix index for each vertex & each delay

SYNOPSIS ^

function [sp_indx] = get_AtQA_index(Nvact, Ndelta, NL_indx, AtQA)

DESCRIPTION ^

 Sparse matrix index for each vertex & each delay

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [sp_indx] = get_AtQA_index(Nvact, Ndelta, NL_indx, AtQA)
0002 
0003 % Sparse matrix index for each vertex & each delay
0004 sp_indx = cell(Nvact,Ndelta);
0005 
0006 % number of elements
0007 %Nindx_nl = zeros(Nvact,Ndelta);
0008 %Nindx_sp = zeros(Nvact,Ndelta);
0009 
0010 for nl = 1:Ndelta
0011     for nv = 1:Nvact
0012         if ~isempty(NL_indx{nv,nl})
0013 %          AtQA{nl}(NL_indx{nv,nl},NL_indx{nv,nl}) = 1;
0014           
0015           [J_indx, I_indx] = meshgrid(NL_indx{nv,nl});
0016           sp_indx{nv,nl}  = sp_calc_index(I_indx(:), J_indx(:), AtQA{nl});
0017           
0018 %          Nindx_nl(nv,nl) = length(NL_indx{nv,nl});
0019 %          Nindx_sp(nv,nl) = length(sp_indx{nv,nl});
0020         end
0021     end
0022 end
0023 
0024 %NLN_indx = sum(sum(Nindx_nl))
0025 %NL2_indx = sum(sum(Nindx_nl.^2))
0026 %Nsp_indx = sum(sum(Nindx_sp))
0027 
0028 return
0029 %------------------------- END -----------------------------
0030 
0031 Nmem = zeros(Ndelta,1);
0032 for nl = 1:Ndelta
0033     indx_all = [];
0034     for nv = 1:Nvact
0035       indx_all = [indx_all; nl_indx{nv,nl}];
0036     end
0037     indx_all = unique(indx_all);
0038     Nmem(nl) = length(indx_all);
0039 end
0040 
0041 AtQA = cell(Ndelta,1);
0042 for nl = 1:Ndelta
0043   AtQA{nl} = spalloc(Nvact, Nvact, Nmem(nl));
0044 end
0045 
0046 %% Initialization
0047 %AtQA = cell(Ndelta,1);
0048 %for nl = 1:Ndelta
0049 %    AtQA{nl} = spalloc(Nvact, Nvact, Nvact);
0050 %end
0051 %
0052 %for nl = 1:Ndelta
0053 %    for nv = 1:Nvact
0054 %        if ~isempty(nl_indx{nv,nl})
0055 %            Nz = length(nl_indx{nv,nl});
0056 %
0057 %            AtQA{nl}(NL_indx{nv,nl},NL_indx{nv,nl}) = zeros(Nz,Nz);
0058 %        end
0059 %    end
0060 %end

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