sgwt_ftsd : Compute forward transform in spectral domain function r=sgwt_ftsd(f,g,t,L) Compute forward transform by explicitly computing eigenvectors and eigenvalues of graph laplacian Uses persistent variables to store eigenvectors, so decomposition will be computed only on first call Inputs: f - input data g - sgw kernel t - desired wavelet scale L - graph laplacian Outputs: r - output wavelet coefficients
0001 % sgwt_ftsd : Compute forward transform in spectral domain 0002 % 0003 % function r=sgwt_ftsd(f,g,t,L) 0004 % 0005 % Compute forward transform by explicitly computing eigenvectors and 0006 % eigenvalues of graph laplacian 0007 % 0008 % Uses persistent variables to store eigenvectors, so decomposition 0009 % will be computed only on first call 0010 % 0011 % Inputs: 0012 % f - input data 0013 % g - sgw kernel 0014 % t - desired wavelet scale 0015 % L - graph laplacian 0016 % 0017 % Outputs: 0018 % r - output wavelet coefficients 0019 0020 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 0021 % Copyright (C) 2010, David K. Hammond. 0022 % 0023 % The SGWT toolbox is free software: you can redistribute it and/or modify 0024 % it under the terms of the GNU General Public License as published by 0025 % the Free Software Foundation, either version 3 of the License, or 0026 % (at your option) any later version. 0027 % 0028 % The SGWT toolbox is distributed in the hope that it will be useful, 0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0031 % GNU General Public License for more details. 0032 % 0033 % You should have received a copy of the GNU General Public License 0034 % along with the SGWT toolbox. If not, see <http://www.gnu.org/licenses/>. 0035 0036 function r=sgwt_ftsd(f,g,t,L) 0037 persistent V D Lold 0038 if (isempty(V) || any(vec(L~=Lold))) 0039 fprintf('Diagonalizing %g x %g L (could take some time ...)\n',size(L,1),size(L,2)); 0040 [V,D]=eig(full(L)); 0041 Lold=L; 0042 end 0043 lambda=diag(D); 0044 fhat=V'*f; 0045 r=V*(fhat.*g(t*lambda)); 0046