poly.h
来自「在Z2[X]中判断一个多项式是否本原多项式」· C头文件 代码 · 共 61 行
H
61 行
#ifndef POLY__H
#define POLY__H
#include <vector>
using namespace std;
class Poly;
ostream & operator << (ostream &, const Poly &);
istream & operator >> (istream &, Poly &);
class Poly {
// types
public:
typedef vector<int> coef_vector;
typedef coef_vector::size_type size_t;
typedef vector<Poly> poly_vector;
// variables
private:
coef_vector coef;
static poly_vector irreducible;
// methods
private:
inline void refresh();
bool isPrimitive_step2() const;
static void generateIrreducible(const size_t);
public:
// constructors
Poly();
Poly(const Poly &);
Poly(const string &);
// destructors
~Poly();
// overloaded operators
Poly & operator = (const Poly &);
bool operator == (const Poly &) const;
Poly operator + (const Poly &) const;
Poly operator - (const Poly &) const;
Poly operator * (const Poly &) const;
Poly operator / (const Poly &) const;
Poly operator % (const Poly &) const;
// others
bool isZero() const;
bool isOne() const;
bool isPrimitive() const;
bool isIrreducible() const;
Poly inverse (const Poly &) const;
static void listPrimitive(const size_t);
friend ostream & operator << (ostream &, const Poly &);
friend istream & operator >> (istream &, Poly &);
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?