invmodp.m

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

M
19
字号
function binv = invmodp(b, p)% function binv = invmodp(b, p)% % Compute the inverse of b modulo p% Copyright 2004 by Todd K. Moon% Permission is granted to use this program/data% for educational/research onlyif(b == 0)  error('Error: Illegal division by zero');end[g,x,y] = gcd(p,b);if(g ~= 1)  error('Error: attempting to divide by noninvertible number');endbinv =  mod(y,p);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?