亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? zz_px.txt

?? 大數運算類
?? TXT
?? 第 1 頁 / 共 2 頁
字號:

/**************************************************************************\

MODULE: ZZ_pX

SUMMARY:

The class ZZ_pX implements polynomial arithmetic modulo p.

Polynomial arithmetic is implemented using the FFT, combined with the
Chinese Remainder Theorem.  A more detailed description of the
techniques used here can be found in [Shoup, J. Symbolic
Comp. 20:363-397, 1995].

Small degree polynomials are multiplied either with classical 
or Karatsuba algorithms.

\**************************************************************************/

#include <NTL/ZZ_p.h>
#include <NTL/vec_ZZ_p.h>

class ZZ_pX {
public:

   ZZ_pX(); // initialize to 0

   ZZ_pX(const ZZ_pX& a); // copy constructor

   ZZ_pX& operator=(const ZZ_pX& a); // assignment
   ZZ_pX& operator=(const ZZ_p& a); // assignment
   ZZ_pX& operator=(const long a); // assignment

   ZZ_pX(long i, const ZZ_p& c);  // initialize to X^i*c
   ZZ_pX(long i, long c);

   ~ZZ_pX(); // destructor
   
};






/**************************************************************************\

                                  Comparison

\**************************************************************************/


long operator==(const ZZ_pX& a, const ZZ_pX& b);
long operator!=(const ZZ_pX& a, const ZZ_pX& b);

// PROMOTIONS: operators ==, != promote {long, ZZ_p} to ZZ_pX on (a, b).

long IsZero(const ZZ_pX& a); // test for 0
long IsOne(const ZZ_pX& a); // test for 1


/**************************************************************************\

                                   Addition

\**************************************************************************/


// operator notation:

ZZ_pX operator+(const ZZ_pX& a, const ZZ_pX& b);
ZZ_pX operator-(const ZZ_pX& a, const ZZ_pX& b);

ZZ_pX operator-(const ZZ_pX& a); // unary -

ZZ_pX& operator+=(ZZ_pX& x, const ZZ_pX& a);
ZZ_pX& operator+=(ZZ_pX& x, const ZZ_p& a);
ZZ_pX& operator+=(ZZ_pX& x, long a);

ZZ_pX& operator-=(ZZ_pX& x, const ZZ_pX& a);
ZZ_pX& operator-=(ZZ_pX& x, const ZZ_p& a);
ZZ_pX& operator-=(ZZ_pX& x, long a);

ZZ_pX& operator++(ZZ_pX& x);  // prefix
void operator++(ZZ_pX& x, int);  // postfix

ZZ_pX& operator--(ZZ_pX& x);  // prefix
void operator--(ZZ_pX& x, int);  // postfix

// procedural versions:


void add(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& b); // x = a + b
void sub(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& b); // x = a - b
void negate(ZZ_pX& x, const ZZ_pX& a); // x = -a


// PROMOTIONS: binary +, - and procedures add, sub promote
// {long, ZZ_p} to ZZ_pX on (a, b).


/**************************************************************************\

                               Multiplication

\**************************************************************************/

// operator notation:

ZZ_pX operator*(const ZZ_pX& a, const ZZ_pX& b);

ZZ_pX& operator*=(ZZ_pX& x, const ZZ_pX& a);
ZZ_pX& operator*=(ZZ_pX& x, const ZZ_p& a);
ZZ_pX& operator*=(ZZ_pX& x, long a);

// procedural versions:

void mul(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& b); // x = a * b

void sqr(ZZ_pX& x, const ZZ_pX& a); // x = a^2
ZZ_pX sqr(const ZZ_pX& a); 

// PROMOTIONS: operator * and procedure mul promote {long, ZZ_p} to ZZ_pX
// on (a, b).

void power(ZZ_pX& x, const ZZ_pX& a, long e);  // x = a^e (e >= 0)
ZZ_pX power(const ZZ_pX& a, long e); 


/**************************************************************************\

                               Shift Operations

LeftShift by n means multiplication by X^n
RightShift by n means division by X^n

A negative shift amount reverses the direction of the shift.

\**************************************************************************/

// operator notation:

ZZ_pX operator<<(const ZZ_pX& a, long n);
ZZ_pX operator>>(const ZZ_pX& a, long n);

ZZ_pX& operator<<=(ZZ_pX& x, long n);
ZZ_pX& operator>>=(ZZ_pX& x, long n);

// procedural versions:

void LeftShift(ZZ_pX& x, const ZZ_pX& a, long n); 
ZZ_pX LeftShift(const ZZ_pX& a, long n);

void RightShift(ZZ_pX& x, const ZZ_pX& a, long n); 
ZZ_pX RightShift(const ZZ_pX& a, long n); 



/**************************************************************************\

                                  Division

\**************************************************************************/

// operator notation:

ZZ_pX operator/(const ZZ_pX& a, const ZZ_pX& b);
ZZ_pX operator/(const ZZ_pX& a, const ZZ_p& b);
ZZ_pX operator/(const ZZ_pX& a, long b);


ZZ_pX& operator/=(ZZ_pX& x, const ZZ_pX& b);
ZZ_pX& operator/=(ZZ_pX& x, const ZZ_p& b);
ZZ_pX& operator/=(ZZ_pX& x, long b);

ZZ_pX operator%(const ZZ_pX& a, const ZZ_pX& b);

ZZ_pX& operator%=(ZZ_pX& x, const ZZ_pX& b);


// procedural versions:


void DivRem(ZZ_pX& q, ZZ_pX& r, const ZZ_pX& a, const ZZ_pX& b);
// q = a/b, r = a%b

void div(ZZ_pX& q, const ZZ_pX& a, const ZZ_pX& b);
void div(ZZ_pX& q, const ZZ_pX& a, const ZZ_p& b);
void div(ZZ_pX& q, const ZZ_pX& a, long b);
// q = a/b

void rem(ZZ_pX& r, const ZZ_pX& a, const ZZ_pX& b);
// r = a%b

long divide(ZZ_pX& q, const ZZ_pX& a, const ZZ_pX& b);
// if b | a, sets q = a/b and returns 1; otherwise returns 0

long divide(const ZZ_pX& a, const ZZ_pX& b);
// if b | a, sets q = a/b and returns 1; otherwise returns 0


/**************************************************************************\

                                   GCD's

These routines are intended for use when p is prime.

\**************************************************************************/


void GCD(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& b);
ZZ_pX GCD(const ZZ_pX& a, const ZZ_pX& b); 
// x = GCD(a, b),  x is always monic (or zero if a==b==0).


void XGCD(ZZ_pX& d, ZZ_pX& s, ZZ_pX& t, const ZZ_pX& a, const ZZ_pX& b);
// d = gcd(a,b), a s + b t = d 


// NOTE: A classical algorithm is used, switching over to a
// "half-GCD" algorithm for large degree


/**************************************************************************\

                                  Input/Output

I/O format:

   [a_0 a_1 ... a_n],

represents the polynomial a_0 + a_1*X + ... + a_n*X^n.

On output, all coefficients will be integers between 0 and p-1, and
a_n not zero (the zero polynomial is [ ]).  On input, the coefficients
are arbitrary integers which are reduced modulo p, and leading zeros
stripped.

\**************************************************************************/

istream& operator>>(istream& s, ZZ_pX& x);
ostream& operator<<(ostream& s, const ZZ_pX& a);


/**************************************************************************\

                              Some utility routines

\**************************************************************************/

long deg(const ZZ_pX& a);  // return deg(a); deg(0) == -1.

const ZZ_p& coeff(const ZZ_pX& a, long i);
// returns a read-only reference to the coefficient of X^i, or zero if
// i not in range

const ZZ_p& LeadCoeff(const ZZ_pX& a);
// read-only reference to leading term of a, or zero if a == 0

const ZZ_p& ConstTerm(const ZZ_pX& a);
// read-only reference to constant term of a, or zero if a == 0

void SetCoeff(ZZ_pX& x, long i, const ZZ_p& a);
void SetCoeff(ZZ_pX& x, long i, long a);
// makes coefficient of X^i equal to a;  error is raised if i < 0

void SetCoeff(ZZ_pX& x, long i);
// makes coefficient of X^i equal to 1;  error is raised if i < 0

void SetX(ZZ_pX& x); // x is set to the monomial X

long IsX(const ZZ_pX& a); // test if x = X

void diff(ZZ_pX& x, const ZZ_pX& a); // x = derivative of a
ZZ_pX diff(const ZZ_pX& a); 

void MakeMonic(ZZ_pX& x); 
// if x != 0 makes x into its monic associate; LeadCoeff(x) must be
// invertible in this case.

void reverse(ZZ_pX& x, const ZZ_pX& a, long hi);
ZZ_pX reverse(const ZZ_pX& a, long hi);

void reverse(ZZ_pX& x, const ZZ_pX& a);
ZZ_pX reverse(const ZZ_pX& a);

// x = reverse of a[0]..a[hi] (hi >= -1);
// hi defaults to deg(a) in second version

void VectorCopy(vec_ZZ_p& x, const ZZ_pX& a, long n);
vec_ZZ_p VectorCopy(const ZZ_pX& a, long n);
// x = copy of coefficient vector of a of length exactly n.
// input is truncated or padded with zeroes as appropriate.




/**************************************************************************\

                             Random Polynomials

\**************************************************************************/

void random(ZZ_pX& x, long n);
ZZ_pX random_ZZ_pX(long n);
// generate a random polynomial of degree < n 



/**************************************************************************\

                    Polynomial Evaluation and related problems

\**************************************************************************/


void BuildFromRoots(ZZ_pX& x, const vec_ZZ_p& a);
ZZ_pX BuildFromRoots(const vec_ZZ_p& a);
// computes the polynomial (X-a[0]) ... (X-a[n-1]), where n = a.length()

void eval(ZZ_p& b, const ZZ_pX& f, const ZZ_p& a);
ZZ_p eval(const ZZ_pX& f, const ZZ_p& a);
// b = f(a)

void eval(vec_ZZ_p& b, const ZZ_pX& f, const vec_ZZ_p& a);
vec_ZZ_p eval(const ZZ_pX& f, const vec_ZZ_p& a);
//  b.SetLength(a.length()).  b[i] = f(a[i]) for 0 <= i < a.length()

void interpolate(ZZ_pX& f, const vec_ZZ_p& a, const vec_ZZ_p& b);
ZZ_pX interpolate(const vec_ZZ_p& a, const vec_ZZ_p& b);
// interpolates the polynomial f satisfying f(a[i]) = b[i].  p should
// be prime.

/**************************************************************************\

                       Arithmetic mod X^n

All routines require n >= 0, otherwise an error is raised.

\**************************************************************************/

void trunc(ZZ_pX& x, const ZZ_pX& a, long n); // x = a % X^n
ZZ_pX trunc(const ZZ_pX& a, long n); 

void MulTrunc(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& b, long n);
ZZ_pX MulTrunc(const ZZ_pX& a, const ZZ_pX& b, long n);
// x = a * b % X^n

void SqrTrunc(ZZ_pX& x, const ZZ_pX& a, long n);
ZZ_pX SqrTrunc(const ZZ_pX& a, long n);
// x = a^2 % X^n

void InvTrunc(ZZ_pX& x, const ZZ_pX& a, long n);
ZZ_pX InvTrunc(const ZZ_pX& a, long n);
// computes x = a^{-1} % X^m.  Must have ConstTerm(a) invertible.

/**************************************************************************\

                Modular Arithmetic (without pre-conditioning)

Arithmetic mod f.

All inputs and outputs are polynomials of degree less than deg(f), and
deg(f) > 0.

NOTE: if you want to do many computations with a fixed f, use the
ZZ_pXModulus data structure and associated routines below for better
performance.

\**************************************************************************/

void MulMod(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& b, const ZZ_pX& f);
ZZ_pX MulMod(const ZZ_pX& a, const ZZ_pX& b, const ZZ_pX& f);
// x = (a * b) % f

void SqrMod(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& f);
ZZ_pX SqrMod(const ZZ_pX& a, const ZZ_pX& f);
// x = a^2 % f

void MulByXMod(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& f);
ZZ_pX MulByXMod(const ZZ_pX& a, const ZZ_pX& f);
// x = (a * X) mod f

void InvMod(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& f);
ZZ_pX InvMod(const ZZ_pX& a, const ZZ_pX& f);
// x = a^{-1} % f, error is a is not invertible

long InvModStatus(ZZ_pX& x, const ZZ_pX& a, const ZZ_pX& f);
// if (a, f) = 1, returns 0 and sets x = a^{-1} % f; otherwise,
// returns 1 and sets x = (a, f)


// for modular exponentiation, see below



/**************************************************************************\

                     Modular Arithmetic with Pre-Conditioning

If you need to do a lot of arithmetic modulo a fixed f, build a
ZZ_pXModulus F for f.  This pre-computes information about f that
speeds up subsequent computations.

It is required that deg(f) > 0 and that LeadCoeff(f) is invertible.

As an example, the following routine computes the product modulo f of a vector
of polynomials.

#include <NTL/ZZ_pX.h>

void product(ZZ_pX& x, const vec_ZZ_pX& v, const ZZ_pX& f)
{
   ZZ_pXModulus F(f);
   ZZ_pX res;
   res = 1;
   long i;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影在线播放| 精品国产免费人成在线观看| 国产精品三级电影| 国产寡妇亲子伦一区二区| 久久婷婷久久一区二区三区| 国内精品国产成人国产三级粉色| 欧美变态tickle挠乳网站| 国产精品自拍一区| 国产精品麻豆99久久久久久| 91最新地址在线播放| 亚洲h精品动漫在线观看| 日韩女优毛片在线| 国产成人免费在线| 一区二区三区中文字幕电影| 欧美一区二区三区性视频| 国产高清在线精品| 亚洲成人动漫精品| 久久综合国产精品| 欧美在线观看视频一区二区三区| 午夜久久久影院| 国产欧美一二三区| 欧美曰成人黄网| 韩国精品主播一区二区在线观看| 中文字幕亚洲不卡| 91麻豆精品国产91久久久使用方法 | 欧美一区二区三区在线看| 国产一区二区三区黄视频 | 久久99国产精品久久| 中文字幕 久热精品 视频在线| 欧美在线免费观看视频| 国产一区二区在线免费观看| 亚洲人一二三区| 精品国产不卡一区二区三区| 91浏览器在线视频| 精品亚洲成a人| 一区二区三区资源| 欧美经典一区二区| 欧美电影免费观看高清完整版在线 | 99久久精品国产一区| 麻豆一区二区三| 一区二区三区在线不卡| 久久久国产精品不卡| 欧美日韩中字一区| 99视频有精品| 国产一区二区看久久| 午夜激情久久久| 1000精品久久久久久久久| 精品久久人人做人人爱| 欧美日韩成人激情| 色婷婷av一区| 成人性生交大合| 精品一区二区久久| 天堂精品中文字幕在线| 亚洲自拍偷拍欧美| 国产精品成人免费精品自在线观看 | 91精品91久久久中77777| 丁香啪啪综合成人亚洲小说| 久久精品噜噜噜成人88aⅴ| 亚洲国产一区二区三区| 国产精品久久久久久亚洲伦| 久久久久久免费| 91精品欧美久久久久久动漫| 欧美在线一区二区三区| av在线播放不卡| 99国产一区二区三精品乱码| 国产精品原创巨作av| 国产剧情av麻豆香蕉精品| 精品一区二区三区欧美| 日本成人超碰在线观看| 日本不卡高清视频| 麻豆91在线看| 麻豆精品在线播放| 久久福利视频一区二区| 日韩av成人高清| 免费成人av资源网| 麻豆精品在线视频| 激情小说欧美图片| 国产电影一区二区三区| 国产精品18久久久久久久网站| 黄色日韩网站视频| 国产剧情av麻豆香蕉精品| 国产成人aaa| 国产传媒欧美日韩成人| 成人黄色片在线观看| 91日韩精品一区| 欧美日韩aaaaaa| 日韩欧美在线综合网| 久久综合久久99| 国产精品美女久久久久aⅴ国产馆| 中文字幕中文字幕一区二区| 亚洲视频小说图片| 一区二区三区色| 视频一区视频二区在线观看| 麻豆精品久久久| 国产成人在线免费观看| 一本久久精品一区二区| 欧美日韩精品高清| 欧美电影免费观看高清完整版在 | jlzzjlzz亚洲日本少妇| 91看片淫黄大片一级在线观看| 一本大道久久a久久综合| 欧美三级在线视频| 精品少妇一区二区三区| 国产精品久久久久久久久免费相片 | 欧美日韩在线一区二区| 日韩欧美在线网站| 国产精品美女一区二区三区| 夜夜精品视频一区二区| 美女在线一区二区| 99久久久久免费精品国产| 欧美性极品少妇| 久久久久一区二区三区四区| 亚洲欧美日韩国产手机在线| 日韩成人av影视| 成人国产精品视频| 欧美美女视频在线观看| 国产片一区二区三区| 亚洲国产中文字幕在线视频综合| 麻豆久久久久久| 91精彩视频在线| 国产欧美日韩不卡| 图片区小说区区亚洲影院| 中文字幕五月欧美| 欧美精品第1页| 国产精品久久久久久户外露出 | 在线免费观看不卡av| 91麻豆精品国产91久久久| 国产精品少妇自拍| 天堂成人国产精品一区| 99在线视频精品| 国产精品99久久久久久有的能看 | 色噜噜狠狠色综合中国| 亚洲综合区在线| 91视频国产资源| 99久久伊人久久99| 日韩欧美国产一二三区| 亚洲精品中文字幕在线观看| 久久97超碰色| 91精品久久久久久久91蜜桃| 18欧美乱大交hd1984| 国产在线播放一区| 欧美一区永久视频免费观看| 一区二区三区欧美激情| 成人黄色小视频在线观看| 精品国产成人系列| 青青草国产成人av片免费| 91福利在线观看| 亚洲男同1069视频| av一区二区三区在线| 中文字幕av免费专区久久| 国产毛片精品国产一区二区三区| 欧美一区二区三区免费在线看| 亚洲男人天堂一区| 91丨porny丨在线| 亚洲欧洲精品一区二区三区| 国产伦精品一区二区三区视频青涩 | 99久久夜色精品国产网站| 精品国产a毛片| 麻豆精品在线看| 日韩午夜精品视频| 日韩av中文字幕一区二区三区| 在线观看中文字幕不卡| 亚洲一级二级三级在线免费观看| 9人人澡人人爽人人精品| 国产日产欧产精品推荐色| 久久精品99国产国产精| 欧美xxxxxxxx| 国内精品在线播放| 国产亚洲视频系列| 国产高清精品网站| 日本一区二区三区高清不卡| 国产成人免费网站| 国产视频911| 99久久精品国产观看| 亚洲美女视频一区| 欧美影院午夜播放| 日韩精品电影在线观看| 欧美一区二区大片| 韩国理伦片一区二区三区在线播放| 欧美mv和日韩mv的网站| 国产一区二区三区不卡在线观看 | 在线电影一区二区三区| 日韩激情一二三区| 欧美电影精品一区二区| 国产一区不卡视频| 亚洲视频每日更新| 欧美日韩色综合| 六月丁香婷婷色狠狠久久| 精品国产一区二区三区四区四 | 精品嫩草影院久久| 国产精品中文欧美| 亚洲男人的天堂在线aⅴ视频| 欧美图区在线视频| 黄色资源网久久资源365| 国产精品理论片在线观看| aaa国产一区| 青娱乐精品在线视频| 国产精品萝li| 欧美一区二区三区小说| 岛国精品在线播放|