16阶以下子环搜索:根据搜索结果自动生成代码
Posted 华仔Ivan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了16阶以下子环搜索:根据搜索结果自动生成代码相关的知识,希望对你有一定的参考价值。
D:\\MathTool\\gaptool>mr 3 1 2 2 17 0
cnt=512
2->[[0,0,0],[0,0,0],[0,1,0]]
17->[[0,0,0],[0,1,0],[0,0,1]]
0->[[0,0,0],[0,0,0],[0,0,0]]
else if(ID==9)//R4_9
m_r=new ZmodnZ(1,2);
m_n=3;
MATRIXi8 A(3,vector<TElem>(3,0));
MATRIXi8 B(3,vector<TElem>(3,0));
MATRIXi8 C(3,vector<TElem>(3,0));
A[0][0]=0;
A[0][1]=0;
A[0][2]=0;
A[1][0]=0;
A[1][1]=0;
A[1][2]=0;
A[2][0]=0;
A[2][1]=1;
A[2][2]=0;
B[0][0]=0;
B[0][1]=0;
B[0][2]=0;
B[1][0]=0;
B[1][1]=1;
B[1][2]=0;
B[2][0]=0;
B[2][1]=0;
B[2][2]=1;
C[0][0]=0;
C[0][1]=0;
C[0][2]=0;
C[1][0]=0;
C[1][1]=0;
C[1][2]=0;
C[2][0]=0;
C[2][1]=0;
C[2][2]=0;
gen.push_back(A);
gen.push_back(B);
gen.push_back(C);
D:\\MathTool\\gaptool>mr 3 1 2 1 2 4
cnt=512
1->[[0,0,0],[0,0,0],[0,0,1]]
2->[[0,0,0],[0,0,0],[0,1,0]]
4->[[0,0,0],[0,0,0],[1,0,0]]
else if(ID==30)//R8_30
m_r=new ZmodnZ(1,2);
m_n=3;
MATRIXi8 A(3,vector<TElem>(3,0));
MATRIXi8 B(3,vector<TElem>(3,0));
MATRIXi8 C(3,vector<TElem>(3,0));
A[0][0]=0;
A[0][1]=0;
A[0][2]=0;
A[1][0]=0;
A[1][1]=0;
A[1][2]=0;
A[2][0]=0;
A[2][1]=0;
A[2][2]=1;
B[0][0]=0;
B[0][1]=0;
B[0][2]=0;
B[1][0]=0;
B[1][1]=0;
B[1][2]=0;
B[2][0]=0;
B[2][1]=1;
B[2][2]=0;
C[0][0]=0;
C[0][1]=0;
C[0][2]=0;
C[1][0]=0;
C[1][1]=0;
C[1][2]=0;
C[2][0]=1;
C[2][1]=0;
C[2][2]=0;
gen.push_back(A);
gen.push_back(B);
gen.push_back(C);
D:\\MathTool\\gaptool>mr 3 1 2 1 8 64
cnt=512
1->[[0,0,0],[0,0,0],[0,0,1]]
8->[[0,0,0],[0,0,1],[0,0,0]]
64->[[0,0,1],[0,0,0],[0,0,0]]
else if(ID==43)//R8_43
m_r=new ZmodnZ(1,2);
m_n=3;
MATRIXi8 A(3,vector<TElem>(3,0));
MATRIXi8 B(3,vector<TElem>(3,0));
MATRIXi8 C(3,vector<TElem>(3,0));
A[0][0]=0;
A[0][1]=0;
A[0][2]=0;
A[1][0]=0;
A[1][1]=0;
A[1][2]=0;
A[2][0]=0;
A[2][1]=0;
A[2][2]=1;
B[0][0]=0;
B[0][1]=0;
B[0][2]=0;
B[1][0]=0;
B[1][1]=0;
B[1][2]=1;
B[2][0]=0;
B[2][1]=0;
B[2][2]=0;
C[0][0]=0;
C[0][1]=0;
C[0][2]=1;
C[1][0]=0;
C[1][1]=0;
C[1][2]=0;
C[2][0]=0;
C[2][1]=0;
C[2][2]=0;
gen.push_back(A);
gen.push_back(B);
gen.push_back(C);
#define USE_MNR_UINT32
#include<iostream>
#include"ZmodnZ.h"
#include"M2r.h"
#include"Mnr.h"
int main(int argc, char* argv[])
int n=2;
int n1=1;
int n2=8;
int idx1=0;
int idx2=1;
int idx3=2;
if(argc>1)
n=atoi(argv[1]);
if(argc>2)
n1=atoi(argv[2]);
if(argc>3)
n2=atoi(argv[3]);
if(argc>4)
idx1=atoi(argv[4]);
if(argc>5)
idx2=atoi(argv[5]);
if(argc>6)
idx3=atoi(argv[6]);
ZmodnZ* r=new ZmodnZ(n1,n2);
if(n>2)
Mnr* R=new Mnr(r,n);
R->m_flag=1;
string str1=Mnr::MStr(R->m_Set[idx1]);
printf("%d->%s\\n",idx1,str1.c_str());
string str2=Mnr::MStr(R->m_Set[idx2]);
printf("%d->%s\\n",idx2,str2.c_str());
string str3=Mnr::MStr(R->m_Set[idx3]);
printf("%d->%s\\n",idx3,str3.c_str());
vector<int> v;
v.push_back(idx1);
v.push_back(idx2);
v.push_back(idx3);
Subring S(R,v);
int ID=IdRing(&S);
cout<<"else if(ID=="<<ID<<")//R"<<S.size()<<"_"<<ID<<endl;
cout<<"m_r=new ZmodnZ("<<n1<<","<<n2<<");"<<endl;
cout<<"m_n="<<n<<";"<<endl;
cout<<"MATRIXi8 A("<<n<<",vector<TElem>("<<n<<",0));"<<endl;
cout<<"MATRIXi8 B("<<n<<",vector<TElem>("<<n<<",0));"<<endl;
cout<<"MATRIXi8 C("<<n<<",vector<TElem>("<<n<<",0));"<<endl;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cout<<"A["<<i<<"]["<<j<<"]="<<R->m_Set[idx1][i][j]<<";"<<endl;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cout<<"B["<<i<<"]["<<j<<"]="<<R->m_Set[idx2][i][j]<<";"<<endl;
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cout<<"C["<<i<<"]["<<j<<"]="<<R->m_Set[idx3][i][j]<<";"<<endl;
cout<<"gen.push_back(A);"<<endl;
cout<<"gen.push_back(B);"<<endl;
cout<<"gen.push_back(C);"<<endl;
delete R;
R=NULL;
else
M2r* R=new M2r(r);
R->m_flag=1;
string str1=M2r::MStr(R->m_Set[idx1]);
printf("%d->%s\\n",idx1,str1.c_str());
string str2=M2r::MStr(R->m_Set[idx2]);
printf("%d->%s\\n",idx2,str2.c_str());
string str3=M2r::MStr(R->m_Set[idx3]);
printf("%d->%s\\n",idx3,str3.c_str());
vector<int> v;
v.push_back(idx1);
v.push_back(idx2);
v.push_back(idx3);
Subring S(R,v);
int ID=IdRing(&S);
cout<<"else if(ID=="<<ID<<")//R"<<S.size()<<"_"<<ID<<endl;
cout<<"m_r=new ZmodnZ("<<n1<<","<<n2<<");"<<endl;
for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
cout<<"A["<<i<<"]["<<j<<"]="<<R->m_Set[idx1][i][j]<<";"<<endl;
for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
cout<<"B["<<i<<"]["<<j<<"]="<<R->m_Set[idx2][i][j]<<";"<<endl;
for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
cout<<"C["<<i<<"]["<<j<<"]="<<R->m_Set[idx3][i][j]<<";"<<endl;
cout<<"gen.push_back(A);"<<endl;
cout<<"gen.push_back(B);"<<endl;
cout<<"gen.push_back(C);"<<endl;
delete R;
R=NULL;
return 0;
以上是关于16阶以下子环搜索:根据搜索结果自动生成代码的主要内容,如果未能解决你的问题,请参考以下文章