python 有限域函数库_有限域:计算矩阵的逆
假設(shè)您的有限域是$GF(8)$,那么所有的計(jì)算函數(shù)(例如add(),mul())必須在同一個(gè)域(GF(8))上計(jì)算。
在有限域上計(jì)算矩陣逆的方法與在其他場(chǎng)上計(jì)算矩陣逆的方法完全相同,高斯-喬丹消去法可以做到。
{計(jì)算{256}的矩陣}(從^到^)是^碼的^的逆矩陣。希望對(duì)你有幫助。在void GMatrixU8::Inverse(){
GMatrixU8 mat_inv;
int w = this->ww;
int dim;
int i, nzero_row, j;
int temp, jtimes;
dim = this->rr;
mat_inv.Make_identity(this->rr, this->cc, this->ww);
for(i = 0; i < dim; i++){
nzero_row = i;
if(0 == Get(i,i)){
do{
++nzero_row;
if(nzero_row >= dim){ ERROR("Non-full rank matrix!"); }
temp = Get(nzero_row, i);
}while((0 == temp)&&(nzero_row < dim));
Swap_rows(i, nzero_row);
mat_inv.Swap_rows(i, nzero_row);
}
for(j = 0; j < dim; j++){
if(0 == Get(j,i))
continue;
if(j != i){
jtimes = galois_single_divide(Get(j,i), Get(i,i), w);
Row_plus_irow(j, i, jtimes);
mat_inv.Row_plus_irow(j, i, jtimes);
}else{
jtimes = galois_inverse(Get(i, i), w);
Row_to_irow(i , jtimes);
mat_inv.Row_to_irow(i , jtimes);
}
}
}
this->ele = mat_inv.ele;
}
總結(jié)
以上是生活随笔為你收集整理的python 有限域函数库_有限域:计算矩阵的逆的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
 
                            
                        - 上一篇: 产品经理|竞品分析(附《竞品分析报告》模
- 下一篇: 全景图像拼接——图像融合
