fht.m

来自「压缩文件中是Error Correction Coding - Mathemat」· M 代码 · 共 35 行

M
35
字号
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 + =
减小字号Ctrl + -
显示快捷键?