Skip to content

incorrect gft results with a ring graph #17

@1taroh

Description

@1taroh

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])

phase

The cause

This is because the sort of eigenvalues and eigenvectors in

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions