📄 fht.m
字号:
function F = fht(f)% function F = fht(f)% Compute the fast Hadamard transform of the vector f,% where the length of f must be a power of 2% % This transform actually works "in place"% Todd K. Moon, March 24, 2004% Copyright 2004 by Todd K. Moon% Permission is granted to use this program/data% for educational/research onlyn = length(f);m = log2(n); % number of stages of iterationF = f; % reserve space for transform for i=0:m-1 % count over the stagesi skip = 2^i; % amount to "skip" in indexingskip j = 0;j while(j < n) j1 = j;j1 for k1=0:(2^i-1) % number adjacent H2 steps tmp = F(j1+1); % do the H2 transform F(j1+1) = F(j1+1) + F(j1+skip+1); F(j1+skip+1) = tmp - F(j1+skip+1); j1 = j1+1; end j = j + 2*skip; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -