-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
I found a bug that makes an incorrect gft result with a ring graph.
Example
Gfted one-hot vector's amplitude is constant.
And its phase should be a line.
However, this example shows gft makes an incorrect result.
N = 64;
G = gsp_ring(N);
G = gsp_compute_fourier_basis(G);
f = zeros(N);
f(10) = 1;
plot(1:N,angle(gsp_gft(G,f)))
xlim([1 N])
ylim([-pi pi])
ylabel("phase [rad]")
yticks([-pi,0,pi])
The cause
This is because the sort of eigenvalues and eigenvectors in
gspbox/utils/gsp_compute_fourier_basis.m
Lines 77 to 85 in a7d9aac
| if isfield(G,'type') && strcmp(G.type,'ring')==1 % && mod(G.N,2)==0 | |
| U = dftmtx(G.N)/sqrt(G.N); | |
| E = (2-2*cos(2*pi*(0:G.N-1)'/G.N)); | |
| inds = gsp_classic2graph_eig_order( G.N ); | |
| % [G.E, inds]=sort(E,'ascend'); | |
| G.e = E(inds); | |
| if strcmp(G.lap_type,'normalized') | |
| G.e = G.e/2; | |
| end |
However, this sort is important when we talk about graph frequency...
Metadata
Metadata
Assignees
Labels
No labels
