Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions RSDFT/DiagonalizationFiles/chefsi1.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@
if (OPTIMIZATIONLEVEL~=0)
G=Rayleighritz(Vin,W,n2);
else
for j=1:n2
for i=1:j
G(i,j) = Vin(:,i)'*W(:,j);
G(j,i) = G(i,j);
end
end
G = rayleighRitzProduct(Vin,W);
if (enableMexFilesTest==1)
G2=Rayleighritz(Vin,W,n2);
if (any(abs(G-G2)>0.000001))
Expand Down
9 changes: 1 addition & 8 deletions RSDFT/DiagonalizationFiles/chsubsp.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@
if (OPTIMIZATIONLEVEL~=0)
G=Rayleighritz(Vin,W,n2);
else
%preallocating G
G=zeros(n2,n2);
for j=1:n2
for i=1:j
G(i,j) = Vin(:,i)'*W(:,j);
G(j,i) = G(i,j);
end
end
G = rayleighRitzProduct(Vin,W);
if (enableMexFilesTest==1)
G2=Rayleighritz(Vin,W,n2);
if (any(abs(G-G2)>0.000001))
Expand Down
9 changes: 1 addition & 8 deletions RSDFT/DiagonalizationFiles/first_filt.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@
if (OPTIMIZATIONLEVEL~=0)
G=Rayleighritz(Vin,W,n2);
else
% reuse G and overwrite it
G=zeros(n2,n2);
for j=1:n2
for i=1:j
G(i,j) = Vin(:,i)'*W(:,j);
G(j,i) = G(i,j);
end
end
G = rayleighRitzProduct(Vin,W);
end

[Q, D] = eig(G);
Expand Down
7 changes: 1 addition & 6 deletions RSDFT/DiagonalizationFiles/lanczos.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,7 @@
if (OPTIMIZATIONLEVEL~=0)
G=Rayleighritz(Vin,W,mev);
else
for j=1:mev
for i=1:j
G(i,j) = Vin(:,i)'*W(:,j);
G(j,i) = G(i,j);
end
end
G = rayleighRitzProduct(Vin,W);
if (enableMexFilesTest==1)
G2=Rayleighritz(Vin,W,mev);
if (any(abs(G-G2)>0.000001))
Expand Down
7 changes: 1 addition & 6 deletions RSDFT/DiagonalizationFiles/lanczosForChsubsp.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,7 @@
if (OPTIMIZATIONLEVEL~=0)
G=Rayleighritz(Vin,W,mev);
else
for j=1:mev
for i=1:j
G(i,j) = Vin(:,i)'*W(:,j);
G(j,i) = G(i,j);
end
end
G = rayleighRitzProduct(Vin,W);
if (enableMexFilesTest==1)
G2=Rayleighritz(Vin,W,mev);
if (any(abs(G-G2)>0.000001))
Expand Down
6 changes: 6 additions & 0 deletions RSDFT/DiagonalizationFiles/rayleighRitzProduct.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function G = rayleighRitzProduct(Vin,W)
%% G = rayleighRitzProduct(Vin,W)
%% computes the same Rayleigh-Ritz projection as the old MATLAB loops.

G = Vin' * W;
G = triu(G) + triu(G,1)';