📄 testgs2.cc.txt
字号:
// Program: testGS2.cc --- test the GS decoder and multivar poly arithmetic// Todd K. Moon, Jan 24, 2004// the TYPE is defined as a sort of cheap templatized trick,// so that examples in both GF(2^m) and GF(p) can be setup,// without the programming overhead of a templatized function.// Copyright 2004 by Todd K. Moon// Permission is granted to use this program/data// for educational/research only#define TYPE ModAr#if TYPE==ModAr#include "ModAr.h"#endif#if TYPE==GFNUM2m#include "GFNUM2m.h"#endif#include "polynomialT.cc"#include "rothruck.h"// create instantiations of the polynomial class template class polynomialT<TYPE>;template class polytemp<TYPE>;template class polynomialT<polynomialT<TYPE> >; // two-variable polynomialsmain(){ TYPE::setdefaultm(5); // work over GF19 TYPE::setshowmod(0); // don't show modulus // build polynomial Q(x,y) with given y-roots TYPE p1c[] = {1,2}; polynomialT<TYPE> p1(1,p1c); TYPE p2c[] = {4,3,2}; polynomialT<TYPE> p2(2,p2c); TYPE p3c[] = {1,3,1,2}; polynomialT<TYPE> p3(3,p3c); TYPE fc[] = {4,2}; polynomialT<TYPE> f(1,fc); polynomialT<polynomialT<TYPE> > Qnew(polynomialT<TYPE>(1)); polynomialT<polynomialT<TYPE> > l1; l1.setc(1,polynomialT<TYPE>(1)); l1[0] = -p1; Qnew *= l1; l1[0] = -p2; Qnew *= l1; l1[0] = -p3; Qnew *= l1; Qnew *= f; Qnew.setvarname("y"); Qnew.setbeforeafterprint("y","(",")"); cout << "Qnew=" << Qnew << endl; rpolynode *rptr,*rptr1; // pointer to list of polynomials int D = 2; rptr = rothruck(Qnew,D); // find the y-roots of Q to to degree D cout << "y-roots of Q(x,y): " << endl; for(rptr1 = rptr; rptr1 != NULL; rptr1 = rptr1->next) { cout << rptr1->f << endl; }}#include "rothruck.cc"/*Local Variables:compile-command: "g++ -o testGS2 -Wno-deprecated -g testGS2.cc ModAr.o polynomialT.cc"End:*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -