Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b1663611 authored by hhakim's avatar hhakim
Browse files

Optimize matfaust.circ by merging intermediate permutation and diagonal factors.

parent a028ff3d
Branches
Tags
No related merge requests found
......@@ -55,6 +55,7 @@
%> @b See also matfaust.anticirc, matfaust.toeplitz
%==========================================================================================
function C = circ(c)
import matfaust.Faust
log2c = log2(numel(c));
if(log2c ~= floor(log2c))
error('Only power of two length vectors are supported')
......@@ -74,5 +75,13 @@ function C = circ(c)
c = c.';
end
S = sparse(diag(FH*(c/n)));
C = F * matfaust.Faust(S*factors(FH, 1)) * right(FH, 2);
% C = F * matfaust.Faust(S*factors(FH, 1)) * right(FH, 2);
nf = numfactors(F);
if(nf > 3)
C = left(F, nf-1) * Faust(factors(F, nf) * S * factors(FH, 1) * factors(FH, 2)) * right(FH, 3);
elseif(nf > 2)
C = left(F, nf-1) * Faust(factors(F, nf) * S * factors(FH, 1) * factors(FH, 2)) * Faust(right(FH, 3));
else
C = Faust(left(F, nf-1)) * Faust(factors(F, nf) * S * factors(FH, 1) * factors(FH, 2));
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment