fromcrtpoly.m
来自「压缩文件中是Error Correction Coding - Mathemat」· M 代码 · 共 39 行
M
39 行
function [f,gamma] = fromcrtpoly(y,m,gammain)% function [f,gamma] = fromcrtpoly(y,m,gammain)% function [f] = fromcrtpoly(y,m)% function [f,gamma] = fromcrtpoly(y,m)% function [f] = fromcrtpoly(y,mp,gammain)%% Compute the representation of the polynomial f using the Chinese Remainder% Theorem (CRT) using the moduli m = [m1,m2,...,mr]. It is assumed % (without checking) that the moduli are relatively prime. % Optionally, the gammas may be passed in (speeding computation), and% are returned as optional return values.% Copyright 2004 by Todd K. Moon% Permission is granted to use this program/data% for educational/research onlyr = length(y);mp = 1;for i=1:r mp = polymult(mp,m{i});endif(nargin==2) f = 0; for i=1:r [q,rm] = polydiv(mp,m{i}); [g,b,y1] = gcdpoly(q,m{i}); gamma{i} = polymult(q,b); f = polyadd(f,polymult(gamma{i},y{i})); endelse % use the passed-in gammas f = 0; for i=1:r f = polyadd(f,polymult(gammain{i},y{i})); end gamma = gammain;end% Take the result modulo m[q,f] = polydiv(f,mp);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?