Home > vbmeg > functions > estimation > bayes > vb_covariance_cal.m

vb_covariance_cal

PURPOSE ^

Covariance calculation

SYNOPSIS ^

function xxcv = vb_covariance_cal(xxP,nextIX,nextDD,Rradius,Rmax,Cov_fmri)

DESCRIPTION ^

 Covariance calculation

 Ver 1.0 written by M. Sato  2003-3-15
 Modified by Taku Yoshioka 2003-08-13

 Cov_fmri: 0ならばfMRI活動強度情報を使わない

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    xxcv = vb_covariance_cal(xxP,nextIX,nextDD,Rradius,Rmax,Cov_fmri)
0002 % Covariance calculation
0003 %
0004 % Ver 1.0 written by M. Sato  2003-3-15
0005 % Modified by Taku Yoshioka 2003-08-13
0006 %
0007 % Cov_fmri: 0ならばfMRI活動強度情報を使わない
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 %%%%%%% Covariance calculation %%%%%%%
0013 Nvertex         = length(xxP);
0014 
0015 val    = []; % Filter value
0016 ipoint = []; % Center point index
0017 inext  = []; % Neighbor index
0018 
0019 for i=1:Nvertex,
0020     dd0    = nextDD{i};
0021     inx    = find( dd0 <= Rmax );        % Find neighbor index within Rmax
0022     
0023     ix       = nextIX{i}(inx);            % neighbor index
0024     Nnext  = length(ix);
0025     ip       = repmat( i ,[Nnext 1] );    % current  index
0026     dd       = dd0(inx);                     % distance from point-i
0027     
0028     gauss  = exp( - (dd/Rradius).^2 );
0029 
0030     if Cov_fmri==0,
0031         Pval   = ones(Nnext,1);            % No fMRI-information
0032     else
0033         Pval   = xxP(i).*xxP(ix);        % fMRI-Activation at 'i' and 'ix'
0034     end;
0035     
0036     ipoint = [ ipoint ; ip ];
0037     inext  = [ inext  ; ix ];
0038     val    = [ val    ; Pval.*gauss ];
0039 end;
0040 
0041 xxcv = sparse( ipoint , inext , val , Nvertex, Nvertex, length(ipoint) ) ;
0042 %xxcv = spdiags( xxP(Itrans(1:Nvertex)).^2 , 0, xxcv);
0043 
0044 % Symmetrize matrix by shorter path
0045 xxcv = max( xxcv , xxcv');
0046 
0047 % Symmetrize matrix
0048 %xxcv = (xxcv + xxcv')*0.5;
0049

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